feat(rt-thread): implement rt-thread sconscirpt (#2674)
This commit is contained in:
committed by
GitHub
parent
58ea2787b4
commit
9ece84de16
@@ -1,15 +1,61 @@
|
||||
# RT-Thread building script for bridge
|
||||
|
||||
import os
|
||||
from building import *
|
||||
import rtconfig
|
||||
import os
|
||||
import shutil
|
||||
|
||||
# get current dir path
|
||||
cwd = GetCurrentDir()
|
||||
objs = []
|
||||
list = os.listdir(cwd)
|
||||
|
||||
src = []
|
||||
inc = []
|
||||
LOCAL_CCFLAGS = ''
|
||||
|
||||
lvgl_cwd = cwd + '/../'
|
||||
lvgl_src_cwd = lvgl_cwd + 'src/'
|
||||
|
||||
src = src + Glob('*.c')
|
||||
inc = inc + [cwd]
|
||||
inc = inc + [lvgl_src_cwd]
|
||||
|
||||
for root, dirs, files in os.walk(lvgl_src_cwd):
|
||||
for dir in dirs:
|
||||
src = src + Glob(os.path.join(root,dir,'*.c'))
|
||||
inc = inc + [os.path.join(root,dir)]
|
||||
|
||||
if rtconfig.CROSS_TOOL == 'gcc':
|
||||
LOCAL_CCFLAGS += ' -std=c99'
|
||||
elif rtconfig.CROSS_TOOL == 'keil':
|
||||
LOCAL_CCFLAGS += ' --c99 --gnu -g -W'
|
||||
|
||||
group = DefineGroup('LVGL', src, depend = ['PKG_USING_LVGL'], CPPPATH = inc, LOCAL_CCFLAGS = LOCAL_CCFLAGS)
|
||||
|
||||
list = os.listdir(cwd)
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
objs = objs + SConscript(os.path.join(d, 'SConscript'))
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
Return('objs')
|
||||
#
|
||||
# try:
|
||||
# shutil.rmtree(os.path.join(lvgl_cwd, '.github'))
|
||||
# shutil.rmtree(os.path.join(lvgl_cwd, 'docs'))
|
||||
# shutil.rmtree(os.path.join(lvgl_cwd, 'scripts'))
|
||||
# shutil.rmtree(os.path.join(lvgl_cwd, 'tests'))
|
||||
# shutil.rmtree(os.path.join(lvgl_cwd, 'zephyr'))
|
||||
# os.remove(os.path.join(lvgl_cwd, '.codecov.yml'))
|
||||
# os.remove(os.path.join(lvgl_cwd, '.editorconfig'))
|
||||
# os.remove(os.path.join(lvgl_cwd, '.gitignore'))
|
||||
# os.remove(os.path.join(lvgl_cwd, '.gitmodules'))
|
||||
# os.remove(os.path.join(lvgl_cwd, 'CMakeLists.txt'))
|
||||
# os.remove(os.path.join(lvgl_cwd, 'component.mk'))
|
||||
# os.remove(os.path.join(lvgl_cwd, 'idf_component.yml'))
|
||||
# os.remove(os.path.join(lvgl_cwd, 'Kconfig'))
|
||||
# os.remove(os.path.join(lvgl_cwd, 'library.json'))
|
||||
# os.remove(os.path.join(lvgl_cwd, 'library.properties'))
|
||||
# os.remove(os.path.join(lvgl_cwd, 'lv_conf_template.h'))
|
||||
# os.remove(os.path.join(lvgl_cwd, 'lvgl.mk'))
|
||||
# except:
|
||||
# pass
|
||||
#
|
||||
|
||||
Return('group')
|
||||
|
||||
104
rt-thread/lv_rt_thread_conf.h
Normal file
104
rt-thread/lv_rt_thread_conf.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-10-15 Meco Man The first version
|
||||
*/
|
||||
|
||||
#ifndef LV_RT_THREAD_CONF_H
|
||||
#define LV_RT_THREAD_CONF_H
|
||||
|
||||
#ifdef __RTTHREAD__
|
||||
|
||||
#define LV_RTTHREAD_INCLUDE <rtthread.h>
|
||||
#include LV_RTTHREAD_INCLUDE
|
||||
|
||||
/*====================
|
||||
COLOR SETTINGS
|
||||
*====================*/
|
||||
|
||||
#ifdef PKG_LVGL_ENABLE_COLOR_16_SWAP
|
||||
#define LV_COLOR_16_SWAP 1
|
||||
#else
|
||||
#define LV_COLOR_16_SWAP 0
|
||||
#endif
|
||||
|
||||
/*=========================
|
||||
MEMORY SETTINGS
|
||||
*=========================*/
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
/*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/
|
||||
# define LV_MEM_CUSTOM 1
|
||||
# define LV_MEM_CUSTOM_INCLUDE LV_RTTHREAD_INCLUDE
|
||||
# define LV_MEM_CUSTOM_ALLOC rt_malloc
|
||||
# define LV_MEM_CUSTOM_FREE rt_free
|
||||
# define LV_MEM_CUSTOM_REALLOC rt_realloc
|
||||
#endif
|
||||
|
||||
/*====================
|
||||
HAL SETTINGS
|
||||
*====================*/
|
||||
|
||||
/*Use a custom tick source that tells the elapsed time in milliseconds.
|
||||
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
|
||||
#define LV_TICK_CUSTOM 1
|
||||
#define LV_TICK_CUSTOM_INCLUDE LV_RTTHREAD_INCLUDE
|
||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (rt_tick_get_millisecond()) /*Expression evaluating to current system time in ms*/
|
||||
|
||||
/*=======================
|
||||
* FEATURE CONFIGURATION
|
||||
*=======================*/
|
||||
|
||||
/*-------------
|
||||
* Logging
|
||||
*-----------*/
|
||||
|
||||
/*Enable the log module*/
|
||||
#ifdef PKG_LVGL_ENABLE_LOG
|
||||
# define LV_USE_LOG 1
|
||||
# define LV_LOG_PRINTF 0
|
||||
#else
|
||||
# define LV_USE_LOG 0
|
||||
#endif
|
||||
|
||||
/*-------------
|
||||
* Asserts
|
||||
*-----------*/
|
||||
|
||||
#define LV_ASSERT_HANDLER_INCLUDE LV_RTTHREAD_INCLUDE
|
||||
#define LV_ASSERT_HANDLER RT_ASSERT(0);
|
||||
|
||||
/*-------------
|
||||
* Others
|
||||
*-----------*/
|
||||
|
||||
/*Change the built in (v)snprintf functions*/
|
||||
#define LV_SPRINTF_CUSTOM 1
|
||||
#define LV_SPRINTF_INCLUDE LV_RTTHREAD_INCLUDE
|
||||
#define lv_snprintf rt_snprintf
|
||||
#define lv_vsnprintf rt_vsnprintf
|
||||
#define LV_SPRINTF_USE_FLOAT 0
|
||||
|
||||
/*=====================
|
||||
* COMPILER SETTINGS
|
||||
*====================*/
|
||||
|
||||
/*For big endian systems set to 1*/
|
||||
#ifdef RT_USING_BIG_ENDIAN
|
||||
# define LV_BIG_ENDIAN_SYSTEM 1
|
||||
#else
|
||||
# define LV_BIG_ENDIAN_SYSTEM 0
|
||||
#endif
|
||||
|
||||
/*Will be added where memories needs to be aligned*/
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN ALIGN(4)
|
||||
|
||||
/*--END OF LV_RT_THREAD_CONF_H--*/
|
||||
|
||||
#endif /*__RTTHREAD__*/
|
||||
|
||||
#endif /*LV_CONF_H*/
|
||||
32
rt-thread/lv_rt_thread_port.c
Normal file
32
rt-thread/lv_rt_thread_port.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-10-18 Meco Man The first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <lvgl.h>
|
||||
#define DBG_TAG "LVGL"
|
||||
#define DBG_LVL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
|
||||
#if LV_USE_LOG && LV_LOG_PRINTF
|
||||
static void lv_rt_log(const char *buf)
|
||||
{
|
||||
LOG_I(buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int lv_port_init(void)
|
||||
{
|
||||
#if LV_USE_LOG && LV_LOG_PRINTF
|
||||
lv_log_register_print_cb(lv_rt_log);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
INIT_COMPONENT_EXPORT(lv_port_init);
|
||||
@@ -18,6 +18,8 @@ extern "C" {
|
||||
|
||||
# ifdef __NuttX__
|
||||
# include <nuttx/config.h>
|
||||
# elif defined(__RTTHREAD__)
|
||||
# define LV_CONF_SKIP
|
||||
# endif
|
||||
|
||||
#endif /*LV_CONF_KCONFIG_EXTERNAL_INCLUDE*/
|
||||
|
||||
Reference in New Issue
Block a user