arch(env): move rt-thread into env_support folder (#3025)
This commit is contained in:
committed by
GitHub
parent
10866ce3f0
commit
bd243f3124
80
env_support/rt-thread/SConscript
Normal file
80
env_support/rt-thread/SConscript
Normal file
@@ -0,0 +1,80 @@
|
||||
from building import *
|
||||
import rtconfig
|
||||
import os
|
||||
import shutil
|
||||
|
||||
# get current dir path
|
||||
cwd = GetCurrentDir()
|
||||
|
||||
src = []
|
||||
inc = []
|
||||
|
||||
lvgl_cwd = cwd + '/../../'
|
||||
|
||||
lvgl_src_cwd = lvgl_cwd + 'src/'
|
||||
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 GetDepend('PKG_USING_LVGL_EXAMPLES'):
|
||||
lvgl_src_cwd = lvgl_cwd + 'examples/'
|
||||
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 GetDepend('PKG_USING_LVGL_DEMOS'):
|
||||
lvgl_src_cwd = lvgl_cwd + 'demos/'
|
||||
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)]
|
||||
|
||||
LOCAL_CCFLAGS = ''
|
||||
if rtconfig.PLATFORM == 'gcc': # GCC
|
||||
LOCAL_CCFLAGS += ' -std=c99'
|
||||
elif rtconfig.PLATFORM == 'armcc': # Keil AC5
|
||||
LOCAL_CCFLAGS += ' --c99 --gnu -g -W'
|
||||
elif rtconfig.PLATFORM == 'armclang': # Keil AC6
|
||||
LOCAL_CCFLAGS += ' -std=c99 -g -w'
|
||||
|
||||
group = DefineGroup('LVGL', src, depend = ['PKG_USING_LVGL'], CPPPATH = inc, LOCAL_CCFLAGS = LOCAL_CCFLAGS)
|
||||
|
||||
port_src = Glob('*.c')
|
||||
port_inc = [cwd]
|
||||
group = group + DefineGroup('LVGL-port', port_src, depend = ['PKG_USING_LVGL'], CPPPATH = port_inc)
|
||||
|
||||
list = os.listdir(cwd)
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
#
|
||||
# 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')
|
||||
94
env_support/rt-thread/lv_rt_thread_conf.h
Normal file
94
env_support/rt-thread/lv_rt_thread_conf.h
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
/*=========================
|
||||
MEMORY SETTINGS
|
||||
*=========================*/
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
# 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
|
||||
*====================*/
|
||||
|
||||
#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
|
||||
*-----------*/
|
||||
|
||||
#ifdef PKG_LVGL_ENABLE_LOG
|
||||
# define LV_USE_LOG 1
|
||||
#else
|
||||
# define LV_USE_LOG 0
|
||||
#endif
|
||||
|
||||
/*-------------
|
||||
* Asserts
|
||||
*-----------*/
|
||||
|
||||
#define LV_ASSERT_HANDLER_INCLUDE LV_RTTHREAD_INCLUDE
|
||||
#define LV_ASSERT_HANDLER RT_ASSERT(0);
|
||||
|
||||
/*-------------
|
||||
* Others
|
||||
*-----------*/
|
||||
|
||||
#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
|
||||
*====================*/
|
||||
|
||||
#ifdef RT_USING_BIG_ENDIAN
|
||||
# define LV_BIG_ENDIAN_SYSTEM 1
|
||||
#else
|
||||
# define LV_BIG_ENDIAN_SYSTEM 0
|
||||
#endif
|
||||
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN ALIGN(4)
|
||||
|
||||
/*==================
|
||||
* EXAMPLES
|
||||
*==================*/
|
||||
|
||||
#ifdef PKG_USING_LVGL_EXAMPLES
|
||||
# define LV_BUILD_EXAMPLES 1
|
||||
#endif
|
||||
|
||||
/*--END OF LV_RT_THREAD_CONF_H--*/
|
||||
|
||||
#endif /*__RTTHREAD__*/
|
||||
|
||||
#endif /*LV_CONF_H*/
|
||||
44
env_support/rt-thread/lv_rt_thread_port.c
Normal file
44
env_support/rt-thread/lv_rt_thread_port.c
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifdef __RTTHREAD__
|
||||
|
||||
#include <rtthread.h>
|
||||
#define DBG_TAG "LVGL"
|
||||
#define DBG_LVL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
#include <lv_port_disp.h>
|
||||
#include <lv_port_indev.h>
|
||||
|
||||
#if LV_USE_LOG
|
||||
static void lv_rt_log(const char *buf)
|
||||
{
|
||||
LOG_I(buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int lv_port_init(void)
|
||||
{
|
||||
#if LV_USE_LOG
|
||||
lv_log_register_print_cb(lv_rt_log);
|
||||
#endif
|
||||
|
||||
lv_init();
|
||||
|
||||
lv_port_disp_init();
|
||||
lv_port_indev_init();
|
||||
|
||||
return 0;
|
||||
}
|
||||
INIT_COMPONENT_EXPORT(lv_port_init);
|
||||
|
||||
#endif /*__RTTHREAD__*/
|
||||
Reference in New Issue
Block a user