فهرست منبع

remove: 移除bsp/linux,因为luatos-soc-pc已经完全替代该bsp,用法兼容且更强大

Wendal Chen 2 سال پیش
والد
کامیت
ddb2da152c

+ 9 - 0
bsp/README.md

@@ -7,3 +7,12 @@
 一些已经停止支持的bsp, 也会移除
 
 更多bsp, 请查阅 https://gitee.com/openLuat
+
+## BSP 不完整列表
+
+* [Air101/Air103/Air601](https://gitee.com/openLuat/luatos-soc-air101)
+* [Air105](https://gitee.com/openLuat/luatos-soc-air105)
+* [ESP32系列](https://gitee.com/openLuat/luatos-soc-idf5)
+* [EC61x系列](https://gitee.com/openLuat/luatos-soc-2022)
+* [EC7xx系列](https://gitee.com/openLuat/luatos-soc-2023)
+* [PC类及模拟器](https://gitee.com/openLuat/luatos-soc-pc)

+ 0 - 55
bsp/linux/README.md

@@ -1,55 +0,0 @@
-
-# LuatOS@Linux
-
-* 编译工具xmake
-* 文件系统,posix原生文件系统,以工作目录为基点
-* 默认luavm和rtos内存分配均为 1MByte
-
-## 简易编译说明
-
-1. 先安装xmake
-
-```shell
-curl -fsSL https://xmake.io/shget.text | bash
-```
-
-2. 安装必要的库
-
-```shell
-apt install -y libssl1.1-dev llvm clang libreadline-dev libsdl2-dev
-```
-
-3. 执行编译,要进入本bsp的目录
-
-```shell
-xmake -y --root
-```
-
-编译完成后, 会在build目录生成 `luatos`
-
-## 简单用法
-
-```sh
-./luatos
-```
-
-```lua
-local sys = require "sys"
-
-log.info("sys", "from win32")
-
-sys.taskInit(function ()
-    while true do
-        log.info("hi", os.date())
-        log.info("sys", rtos.meminfo("sys"))
-        log.info("lua", rtos.meminfo("lua"))
-        sys.wait(1000)
-    end
-end)
-
-sys.run()
-```
-
-## 常见问题
-
-TODO

+ 0 - 162
bsp/linux/include/FreeRTOSConfig.h

@@ -1,162 +0,0 @@
-/*
- * FreeRTOS V202012.00
- * Copyright (C) 2020 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- * the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * http://www.FreeRTOS.org
- * http://aws.amazon.com/freertos
- *
- * 1 tab == 4 spaces!
- */
-#ifndef FREERTOS_CONFIG_H
-#define FREERTOS_CONFIG_H
-
-/*-----------------------------------------------------------
- * Application specific definitions.
- *
- * These definitions should be adjusted for your particular hardware and
- * application requirements.
- *
- * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
- * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.  See
- * http://www.freertos.org/a00110.html
- *----------------------------------------------------------*/
-
-#define configUSE_PREEMPTION					1
-#define configUSE_PORT_OPTIMISED_TASK_SELECTION	0
-#define configUSE_IDLE_HOOK						1
-#define configUSE_TICK_HOOK						1
-#define configUSE_DAEMON_TASK_STARTUP_HOOK		1
-#define configTICK_RATE_HZ						( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */
-#define configMINIMAL_STACK_SIZE				( ( unsigned short ) 70 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */
-#define configTOTAL_HEAP_SIZE					( ( size_t ) ( 512 * 1024 ) )
-#define configMAX_TASK_NAME_LEN					( 12 )
-#define configUSE_TRACE_FACILITY				1
-#define configUSE_16_BIT_TICKS					0
-#define configIDLE_SHOULD_YIELD					1
-#define configUSE_MUTEXES						1
-#define configCHECK_FOR_STACK_OVERFLOW			0
-#define configUSE_RECURSIVE_MUTEXES				1
-#define configQUEUE_REGISTRY_SIZE				20
-#define configUSE_APPLICATION_TASK_TAG			1
-#define configUSE_COUNTING_SEMAPHORES			1
-#define configUSE_ALTERNATIVE_API				0
-#define configUSE_QUEUE_SETS					1
-#define configUSE_TASK_NOTIFICATIONS			1
-#define configSUPPORT_STATIC_ALLOCATION			1
-
-/* Software timer related configuration options.  The maximum possible task
-priority is configMAX_PRIORITIES - 1.  The priority of the timer task is
-deliberately set higher to ensure it is correctly capped back to
-configMAX_PRIORITIES - 1. */
-#define configUSE_TIMERS						1
-#define configTIMER_TASK_PRIORITY				( configMAX_PRIORITIES - 1 )
-#define configTIMER_QUEUE_LENGTH				20
-#define configTIMER_TASK_STACK_DEPTH			( configMINIMAL_STACK_SIZE * 2 )
-
-#define configMAX_PRIORITIES					( 7 )
-
-/* Run time stats gathering configuration options. */
-unsigned long ulGetRunTimeCounterValue( void ); /* Prototype of function that returns run time counter. */
-void vConfigureTimerForRunTimeStats( void );	/* Prototype of function that initialises the run time counter. */
-#define configGENERATE_RUN_TIME_STATS			0
-#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats()
-#define portGET_RUN_TIME_COUNTER_VALUE() ulGetRunTimeCounterValue()
-
-/* Co-routine related configuration options. */
-#define configUSE_CO_ROUTINES 					0
-#define configMAX_CO_ROUTINE_PRIORITIES			( 2 )
-
-/* This demo can use of one or more example stats formatting functions.  These
-format the raw data provided by the uxTaskGetSystemState() function in to human
-readable ASCII form.  See the notes in the implementation of vTaskList() within
-FreeRTOS/Source/tasks.c for limitations. */
-#define configUSE_STATS_FORMATTING_FUNCTIONS	0
-
-/* Enables the test whereby a stack larger than the total heap size is
-requested. */
-#define configSTACK_DEPTH_TYPE uint32_t
-
-/* Set the following definitions to 1 to include the API function, or zero
-to exclude the API function.  In most cases the linker will remove unused
-functions anyway. */
-#define INCLUDE_vTaskPrioritySet				1
-#define INCLUDE_uxTaskPriorityGet				1
-#define INCLUDE_vTaskDelete						1
-#define INCLUDE_vTaskCleanUpResources			0
-#define INCLUDE_vTaskSuspend					1
-#define INCLUDE_vTaskDelayUntil					1
-#define INCLUDE_vTaskDelay						1
-#define INCLUDE_uxTaskGetStackHighWaterMark		1
-#define INCLUDE_uxTaskGetStackHighWaterMark2	1
-#define INCLUDE_xTaskGetSchedulerState			1
-#define INCLUDE_xTimerGetTimerDaemonTaskHandle	1
-#define INCLUDE_xTaskGetIdleTaskHandle			1
-#define INCLUDE_xTaskGetHandle					1
-#define INCLUDE_eTaskGetState					1
-#define INCLUDE_xSemaphoreGetMutexHolder		1
-#define INCLUDE_xTimerPendFunctionCall			1
-#define INCLUDE_xTaskAbortDelay					1
-
-#define projCOVERAGE_TEST                       0
-
-#define configINCLUDE_MESSAGE_BUFFER_AMP_DEMO	0
-#if ( configINCLUDE_MESSAGE_BUFFER_AMP_DEMO == 1 )
-	extern void vGenerateCoreBInterrupt( void * xUpdatedMessageBuffer );
-	#define sbSEND_COMPLETED( pxStreamBuffer ) vGenerateCoreBInterrupt( pxStreamBuffer )
-#endif /* configINCLUDE_MESSAGE_BUFFER_AMP_DEMO */
-
-extern void vAssertCalled( unsigned long ulLine, const char * const pcFileName );
-
-/* projCOVERAGE_TEST should be defined on the command line so this file can be
-used with multiple project configurations.  If it is
- */
-#ifndef projCOVERAGE_TEST
-	#error projCOVERAGE_TEST should be defined to 1 or 0 on the command line.
-#endif
-
-#if( projCOVERAGE_TEST == 1 )
-	/* Insert NOPs in empty decision paths to ensure both true and false paths
-	are being tested. */
-	#define mtCOVERAGE_TEST_MARKER() __asm volatile( "NOP" )
-
-	/* Ensure the tick count overflows during the coverage test. */
-	#define configINITIAL_TICK_COUNT 0xffffd800UL
-
-	/* Allows tests of trying to allocate more than the heap has free. */
-	#define configUSE_MALLOC_FAILED_HOOK			0
-
-	/* To test builds that remove the static qualifier for debug builds. */
-	#define portREMOVE_STATIC_QUALIFIER
-#else
-	/* It is a good idea to define configASSERT() while developing.  configASSERT()
-	uses the same semantics as the standard C assert() macro.  Don't define
-	configASSERT() when performing code coverage tests though, as it is not
-	intended to asserts() to fail, some some code is intended not to run if no
-	errors are present. */
-	#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __LINE__, __FILE__ )
-
-	#define configUSE_MALLOC_FAILED_HOOK			1
-
-	/* Include the FreeRTOS+Trace FreeRTOS trace macro definitions. */
-	// #include "trcRecorder.h"
-#endif
-
-
-#endif /* FREERTOS_CONFIG_H */

+ 0 - 87
bsp/linux/include/luat_conf_bsp.h

@@ -1,87 +0,0 @@
-
-#ifndef LUAT_CONF_BSP
-#define LUAT_CONF_BSP
-
-
-#define LUA_USE_LINUX 1
-
-#define LUAT_BSP_VERSION "V0001"
-// #define LUAT_USE_CMDLINE_ARGS 1
-#define LUAT_CONF_LAUX_BUFFSIZE 1024
-
-#define LUAT_RET int
-#define LUAT_RT_RET_TYPE	void
-#define LUAT_RT_CB_PARAM void *param
-#define LUAT_RTOS_API_NOTOK 1
-// Linux 下默认64bit得了, 32bit的编译器太难找
-#define LUAT_CONF_VM_64bit
-
-#define LUAT_USE_FS_VFS 1
-#define LUAT_USE_VFS_INLINE_LIB 1
-
-#define LUAT_USE_CRYPTO 1
-#define LUAT_COMPILER_NOWEAK
-
-#define LUAT_USE_SM 1
-
-#define LUAT_USE_LCD
-#define LUAT_LCD_COLOR_DEPTH 16
-#define LUAT_USE_TJPGD
-
-#define LV_COLOR_16_SWAP 1
-#define LV_COLOR_DEPTH 16
-
-
-// #define LUAT_USE_LVGL 1
-#define LUAT_USE_LVGL_SDL2 1
-#define LUAT_USE_LCD_SDL2 1
-#define LUAT_USE_LCD_CUSTOM_DRAW 1
-
-#define LV_TICK_CUSTOM     1
-#define LV_TICK_CUSTOM_INCLUDE "stdio.h"
-#define LV_TICK_CUSTOM_SYS_TIME_EXPR (get_timestamp())     /*Expression evaluating to current systime in ms*/
-
-#define LV_FONT_OPPOSANS_M_8
-#define LV_FONT_OPPOSANS_M_10
-#define LV_FONT_OPPOSANS_M_12
-#define LV_FONT_OPPOSANS_M_14
-#define LV_FONT_OPPOSANS_M_16
-#define LV_FONT_OPPOSANS_M_18
-#define LV_FONT_OPPOSANS_M_20
-#define LV_FONT_OPPOSANS_M_22
-
-#define LUAT_USE_LVGL_ARC       1   //圆弧 无依赖
-#define LUAT_USE_LVGL_BAR       1   //进度条 无依赖
-#define LUAT_USE_LVGL_BTN       1   //按钮 依赖容器CONT
-#define LUAT_USE_LVGL_BTNMATRIX 1   //按钮矩阵 无依赖
-#define LUAT_USE_LVGL_CALENDAR  1   //日历 无依赖
-#define LUAT_USE_LVGL_CANVAS    1   //画布 依赖图片IMG
-#define LUAT_USE_LVGL_CHECKBOX  1   //复选框 依赖按钮BTN 标签LABEL
-#define LUAT_USE_LVGL_CHART     1   //图表 无依赖
-#define LUAT_USE_LVGL_CONT      1   //容器 无依赖
-#define LUAT_USE_LVGL_CPICKER   1   //颜色选择器 无依赖
-#define LUAT_USE_LVGL_DROPDOWN  1   //下拉列表 依赖页面PAGE 标签LABEL
-#define LUAT_USE_LVGL_GAUGE     1   //仪表 依赖进度条BAR 仪表(弧形刻度)LINEMETER
-#define LUAT_USE_LVGL_IMG       1   //图片 依赖标签LABEL
-#define LUAT_USE_LVGL_IMGBTN    1   //图片按钮 依赖按钮BTN
-#define LUAT_USE_LVGL_KEYBOARD  1   //键盘 依赖图片按钮IMGBTN
-#define LUAT_USE_LVGL_LABEL     1   //标签 无依赖
-#define LUAT_USE_LVGL_LED       1   //LED 无依赖
-#define LUAT_USE_LVGL_LINE      1   //线 无依赖
-#define LUAT_USE_LVGL_LIST      1   //列表 依赖页面PAGE 按钮BTN 标签LABEL
-#define LUAT_USE_LVGL_LINEMETER 1   //仪表(弧形刻度) 无依赖
-#define LUAT_USE_LVGL_OBJMASK   1   //对象蒙版 无依赖
-#define LUAT_USE_LVGL_MSGBOX    1   //消息框 依赖图片按钮IMGBTN 标签LABEL
-#define LUAT_USE_LVGL_PAGE      1   //页面 依赖容器CONT
-#define LUAT_USE_LVGL_SPINNER   1   //旋转器 依赖圆弧ARC 动画ANIM
-#define LUAT_USE_LVGL_ROLLER    1   //滚筒 无依赖
-#define LUAT_USE_LVGL_SLIDER    1   //滑杆 依赖进度条BAR
-#define LUAT_USE_LVGL_SPINBOX   1   //数字调整框 无依赖
-#define LUAT_USE_LVGL_SWITCH    1   //开关 依赖滑杆SLIDER
-#define LUAT_USE_LVGL_TEXTAREA  1   //文本框 依赖标签LABEL 页面PAGE
-#define LUAT_USE_LVGL_TABLE     1   //表格 依赖标签LABEL
-#define LUAT_USE_LVGL_TABVIEW   1   //页签 依赖页面PAGE 图片按钮IMGBTN
-#define LUAT_USE_LVGL_TILEVIEW  1   //平铺视图 依赖页面PAGE
-#define LUAT_USE_LVGL_WIN       1   //窗口 依赖容器CONT 按钮BTN 标签LABEL 图片IMG 页面PAGE
-
-#endif

+ 0 - 20
bsp/linux/main.lua

@@ -1,20 +0,0 @@
-
-
-local sys = require "sys"
-
-log.info("sys", "from linux")
-
-sys.taskInit(function ()
-    sys.wait(1000)
-
-    --lvgl.init()
-    local scr = lvgl.obj_create()
-    local btn = lvgl.btn_create(scr)
-    local label = lvgl.label_create(btn)
-    lvgl.label_set_text("hi")
-
-    lvgl.load(scr)
-end)
-
-sys.run()
-

+ 0 - 135
bsp/linux/port/luat_base_linux.c

@@ -1,135 +0,0 @@
-#include "luat_base.h"
-#include "luat_msgbus.h"
-#include "luat_fs.h"
-#include "luat_timer.h"
-#include <stdlib.h>
-
-#ifdef LUAT_USE_LVGL
-#include "lvgl.h"
-void luat_lv_fs_init(void);
-void lv_bmp_init(void);
-void lv_png_init(void);
-void lv_split_jpeg_init(void);
-#endif
-
-LUAMOD_API int luaopen_win32( lua_State *L );
-int luaopen_lfs(lua_State * L);
-int luaopen_rs232_core(lua_State * L);
-
-static const luaL_Reg loadedlibs[] = {
-  {"_G", luaopen_base}, // _G
-  {LUA_LOADLIBNAME, luaopen_package}, // require
-  {LUA_COLIBNAME, luaopen_coroutine}, // coroutine协程库
-  {LUA_TABLIBNAME, luaopen_table},    // table库,操作table类型的数据结构
-  {LUA_IOLIBNAME, luaopen_io},        // io库,操作文件
-  {LUA_OSLIBNAME, luaopen_os},        // os库,已精简
-  {LUA_STRLIBNAME, luaopen_string},   // string库,字符串操作
-  {LUA_MATHLIBNAME, luaopen_math},    // math 数值计算
-//  {LUA_UTF8LIBNAME, luaopen_utf8},
-  {LUA_DBLIBNAME, luaopen_debug},     // debug库,已精简
-#if defined(LUA_COMPAT_BITLIB)
-  {LUA_BITLIBNAME, luaopen_bit32},    // 不太可能启用
-#endif
-  {"rtos", luaopen_rtos},             // rtos底层库, 核心功能是队列和定时器
-  {"log", luaopen_log},               // 日志库
-  {"timer", luaopen_timer},           // 延时库
-  {"pack", luaopen_pack},             // pack.pack/pack.unpack
-  {"json", luaopen_cjson},             // json
-  {"zbuff", luaopen_zbuff},            // 
-  {"crypto", luaopen_crypto},
-//   {"fatfs", luaopen_fatfs},
-//   {"sfd",   luaopen_sfd},
-//   {"lfs2",   luaopen_lfs2},
-//   {"gpio",   luaopen_gpio},
-  {"spi",   luaopen_spi},
-  {"rsa", luaopen_rsa},
-#ifdef __XMAKE_BUILD__
-  {"protobuf", luaopen_protobuf},
-  {"iotauth", luaopen_iotauth},
-#endif
-#ifdef LUAT_USE_LCD
-  {"lcd",    luaopen_lcd},
-#endif
-#ifdef LUAT_USE_LVGL
-  {"lvgl",   luaopen_lvgl},
-  {"lcd",    luaopen_lcd},
-#endif
-  {NULL, NULL}
-};
-
-// 按不同的rtconfig加载不同的库函数
-void luat_openlibs(lua_State *L) {
-    // 初始化队列服务
-    luat_msgbus_init();
-    //print_list_mem("done>luat_msgbus_init");
-    // 加载系统库
-    const luaL_Reg *lib;
-    /* "require" functions from 'loadedlibs' and set results to global table */
-    for (lib = loadedlibs; lib->func; lib++) {
-        luaL_requiref(L, lib->name, lib->func, 1);
-        lua_pop(L, 1);  /* remove lib */
-    }
-}
-
-void luat_os_reboot(int code) {
-    exit(code);
-}
-
-const char* luat_os_bsp(void) {
-    return "linux";
-}
-
-extern const struct luat_vfs_filesystem vfs_fs_posix;
-extern const struct luat_vfs_filesystem vfs_fs_luadb;
-
-extern const char* luat_luadb_mock;
-
-int luat_fs_init(void) {
-	#ifdef LUAT_USE_FS_VFS
-	// vfs进行必要的初始化
-	luat_vfs_init(NULL);
-	// 注册vfs for posix 实现
-	luat_vfs_reg(&vfs_fs_posix);
-	luat_vfs_reg(&vfs_fs_luadb);
-
-	luat_fs_conf_t conf = {
-		.busname = "",
-		.type = "posix",
-		.filesystem = "posix",
-		.mount_point = "", // window环境下, 需要支持任意路径的读取,不能强制要求必须是/
-	};
-	luat_fs_mount(&conf);
-	#ifdef LUAT_USE_VFS_INLINE_LIB
-	luat_fs_conf_t conf2 = {
-		.busname = (char*)luat_luadb_mock,
-		.type = "luadb",
-		.filesystem = "luadb",
-		.mount_point = "/luadb/",
-	};
-	luat_fs_mount(&conf2);
-	#endif
-	#endif
-
-	#ifdef LUAT_USE_LVGL
-	luat_lv_fs_init();
-	lv_bmp_init();
-	lv_png_init();
-	lv_split_jpeg_init();
-	#endif
-	return 0;
-}
-
-void vConfigureTimerForRunTimeStats( void ) {}
-
-/** 设备进入待机模式 */
-void luat_os_standy(int timeout) {
-    return; // nop
-}
-
-void luat_ota_reboot(int timeout_ms) {
-  if (timeout_ms > 0)
-    luat_timer_mdelay(timeout_ms);
-  exit(0);
-}
-
-

+ 0 - 19
bsp/linux/port/luat_crypto_linux.c

@@ -1,19 +0,0 @@
-
-#include "luat_base.h"
-#include "luat_crypto.h"
-#define LUAT_LOG_TAG "crypto"
-#include "luat_log.h"
-#include <stdlib.h>
-#include <time.h>
-
-int luat_crypto_trng(char* buff, size_t len) {
-    srand(time(NULL));
-    for (size_t i = 0; i < len; i++)
-    {
-        buff[i] = (char) rand();
-        if (buff[i] == 0) {
-            buff[i] = i;
-        }
-    }
-    return 0;
-}

+ 0 - 68
bsp/linux/port/luat_gpio_linux.c

@@ -1,68 +0,0 @@
-#include "luat_base.h"
-#include "luat_gpio.h"
-#include "luat_msgbus.h"
-
-// 模拟GPIO在win32下的实现
-
-int l_gpio_handler(lua_State *L, void* ptr) ;
-
-#define LUAT_WIN32_GPIO_COUNT (32)
-
-typedef struct gpio_state {
-    luat_gpio_t gpio;
-    uint8_t open;
-    uint8_t state;
-}gpio_state_t;
-
-gpio_state_t win32gpios[LUAT_WIN32_GPIO_COUNT] = {0};
-
-int luat_gpio_setup(luat_gpio_t* gpio) {
-    if (gpio->pin < 0 || gpio->pin >= LUAT_WIN32_GPIO_COUNT) {
-        return -1;
-    }
-    memcpy(&win32gpios[gpio->pin], gpio, sizeof(luat_gpio_t));
-    win32gpios[gpio->pin].open = 1;
-    if (gpio->mode == Luat_GPIO_OUTPUT) {
-        win32gpios[gpio->pin].state = gpio->irq;
-    }
-    else {
-        win32gpios[gpio->pin].state = 0;
-    }
-    return 0;
-}
-
-int luat_gpio_set(int pin, int level) {
-    if (pin < 0 || pin >= LUAT_WIN32_GPIO_COUNT) {
-        return -1;
-    }
-    if (win32gpios[pin].open == 0) {
-        return -1;
-    }
-    
-    if (win32gpios[pin].state != level) {
-        win32gpios[pin].state = level;
-        rtos_msg_t msg = {0};
-        msg.ptr = NULL;
-        msg.arg1 = pin;
-        msg.arg2 = level;
-        msg.handler = l_gpio_handler;
-        luat_msgbus_put(&msg, 0);
-    };
-    return 0;
-}
-
-int luat_gpio_get(int pin) {
-    if (pin < 0 || pin >= LUAT_WIN32_GPIO_COUNT) {
-        return 0;
-    }
-    if (win32gpios[pin].open == 0) {
-        return 0;
-    }
-    return win32gpios[pin].state;
-}
-void luat_gpio_close(int pin) {
-    if (pin < 0 || pin >= LUAT_WIN32_GPIO_COUNT) {
-        return;
-    }
-    win32gpios[pin].open = 0;
-}

+ 0 - 76
bsp/linux/port/luat_log_linux.c

@@ -1,76 +0,0 @@
-
-#include "luat_base.h"
-#include "luat_log.h"
-#include "luat_uart.h"
-#include "luat_malloc.h"
-#include "printf.h"
-
-#include <stdio.h>
-
-static uint8_t luat_log_uart_port = 0;
-static uint8_t luat_log_level_cur = LUAT_LOG_DEBUG;
-
-void luat_log_set_uart_port(int port) {
-    luat_log_uart_port = port;
-}
-
-void luat_print(const char* _str) {
-    luat_nprint((char*)_str, strlen(_str));
-}
-
-void luat_nprint(char *s, size_t l) {
-    printf("%.*s", (int)l, s);
-}
-
-void luat_log_set_level(int level) {
-    luat_log_level_cur = level;
-}
-int luat_log_get_level() {
-    return luat_log_level_cur;
-}
-#define LOGLOG_SIZE 1024
-void luat_log_log(int level, const char* tag, const char* _fmt, ...) {
-    if (luat_log_level_cur > level) return;
-    char buff[LOGLOG_SIZE] = {0};
-    char *tmp = (char *)buff;
-    switch (level)
-        {
-        case LUAT_LOG_DEBUG:
-            buff[0] = 'D';
-            break;
-        case LUAT_LOG_INFO:
-            buff[0] = 'I';
-            break;
-        case LUAT_LOG_WARN:
-            buff[0] = 'W';
-            break;
-        case LUAT_LOG_ERROR:
-            buff[0] = 'E';
-            break;
-        default:
-            buff[0] = '?';
-            break;
-        }
-    buff[1] = '/';
-    tmp += 2;
-    memcpy(tmp, tag, strlen(tag));
-    buff[2+strlen(tag)] = ' ';
-    tmp += strlen(tag) + 1;
-
-    va_list args;
-    va_start(args, _fmt);
-    size_t len = vsnprintf_(tmp, LOGLOG_SIZE, _fmt, args);
-    va_end(args);
-    if (len > 0) {
-        len = strlen(buff);
-        // if (len > LOGLOG_SIZE - 2)
-        //     len = LOGLOG_SIZE - 2;
-        // buff[len] = '\r';
-        // buff[len+1] = '\n';
-        // luat_nprint(buff, len+2);
-        if (len > LOGLOG_SIZE - 1)
-            len = LOGLOG_SIZE - 1;
-        buff[len] = '\n';
-        luat_nprint(buff, len+1);
-    }
-}

+ 0 - 92
bsp/linux/port/luat_malloc_linux.c

@@ -1,92 +0,0 @@
-
-// 这个文件包含 系统heap和lua heap的默认实现
-
-
-#include <stdlib.h>
-#include <string.h>//add for memset
-#include "bget.h"
-#include "luat_malloc.h"
-
-#define LUAT_LOG_TAG "vmheap"
-#include "luat_log.h"
-
-//------------------------------------------------
-//  管理系统内存
-
-void* luat_heap_malloc(size_t len) {
-    return malloc(len);
-}
-
-void luat_heap_free(void* ptr) {
-    free(ptr);
-}
-
-void* luat_heap_realloc(void* ptr, size_t len) {
-    return realloc(ptr, len);
-}
-
-void* luat_heap_calloc(size_t count, size_t _size) {
-    void *ptr = luat_heap_malloc(count * _size);
-    if (ptr) {
-        memset(ptr, 0, _size);
-    }
-    return ptr;
-}
-//------------------------------------------------
-
-//------------------------------------------------
-// ---------- 管理 LuaVM所使用的内存----------------
-void* luat_heap_alloc(void *ud, void *ptr, size_t osize, size_t nsize) {
-    if (0) {
-        if (ptr) {
-            if (nsize) {
-                // 缩放内存块
-                LLOGD("realloc %p from %d to %d", ptr, osize, nsize);
-            }
-            else {
-                // 释放内存块
-                LLOGD("free %p ", ptr);
-                brel(ptr);
-                return NULL;
-            }
-        }
-        else {
-            // 申请内存块
-            ptr = bget(nsize);
-            LLOGD("malloc %p type=%d size=%d", ptr, osize, nsize);
-            return ptr;
-        }
-    }
-
-    if (nsize)
-    {
-    	void* ptmp = bgetr(ptr, nsize);
-    	if(ptmp == NULL && osize >= nsize)
-    	{
-    		return ptr;
-    	}
-        return ptmp;
-    }
-    brel(ptr);
-    return NULL;
-}
-
-void luat_meminfo_luavm(size_t *total, size_t *used, size_t *max_used) {
-	long curalloc, totfree, maxfree;
-	unsigned long nget, nrel;
-	bstats(&curalloc, &totfree, &maxfree, &nget, &nrel);
-	*used = curalloc;
-	*max_used = bstatsmaxget();
-    *total = curalloc + totfree;
-}
-
-// #include "FreeRTOS.h"
-// #include "task.h"
-
-void luat_meminfo_sys(size_t *total, size_t *used, size_t *max_used) {
-	*used = 0;
-	*max_used = 0;
-    *total = 0;
-}
-
-//-----------------------------------------------------------------------------

+ 0 - 7
bsp/linux/port/luat_mcu_linux.c

@@ -1,7 +0,0 @@
-#include "luat_base.h"
-#include "luat_mcu.h"
-// #include "task.h"
-
-long luat_mcu_ticks(void) {
-    return clock()*1000;
-}

+ 0 - 68
bsp/linux/port/luat_msgbus_linux.c

@@ -1,68 +0,0 @@
-
-#include "luat_msgbus.h"
-#include "luat_malloc.h"
-
-#define LUAT_LOG_TAG "msgbus"
-#include "luat_log.h"
-
-typedef struct sysp_msgbus {
-    uint32_t vaild;
-    rtos_msg_t msg;
-    void* next;
-}sysp_msgbus_t;
-
-#define MSGBUS_SIZE (128)
-
-static int msgbus_w_pos = 0;
-static int msgbus_r_pos = 0;
-static sysp_msgbus_t *msg_head;
-
-void luat_msgbus_init(void) {
-    msg_head = luat_heap_malloc(sizeof(sysp_msgbus_t));
-    msg_head->vaild = 0;
-}
-uint32_t luat_msgbus_put(rtos_msg_t* msg, size_t timeout) {
-    sysp_msgbus_t *tmp = luat_heap_malloc(sizeof(sysp_msgbus_t));
-    if (tmp == NULL) {
-        LLOGD("out of memory when malloc msgbus mss");
-        return 1;
-    }
-    tmp->vaild = 0;
-
-    //LLOGD("luat_msgbus_put GoGo\n");
-
-    sysp_msgbus_t* t = msg_head;
-    while (1) {
-        if (t->vaild == 0) {
-            //LLOGD("luat_msgbus_put t->vaild\n");
-            memcpy(&t->msg, msg, sizeof(rtos_msg_t));
-            t->vaild = 1;
-            t->next = tmp;
-            return 0;
-        }
-        else {
-            t = t->next;
-        }
-    }
-    return 0;
-}
-
-uint32_t luat_msgbus_get(rtos_msg_t* msg, size_t timeout) {
-    //LLOGD("CALL luat_msgbus_get\n");
-    sysp_msgbus_t* t = msg_head;
-    if (t->vaild) {
-        memcpy(msg, &t->msg, sizeof(rtos_msg_t));
-        msg_head = t->next;
-        luat_heap_free(t);
-        return 0;
-    }
-    return 1;
-}
-
-uint32_t luat_msgbus_freesize(void) {
-    return 1;
-}
-
-uint8_t luat_msgbus_is_empty(void){
-  return 1;
-}

+ 0 - 49
bsp/linux/port/luat_spi_device.c

@@ -1,49 +0,0 @@
-#include "luat_base.h"
-#include "luat_gpio.h"
-#include "luat_spi.h"
-
-#define LUAT_SPI_CS_SELECT 0
-#define LUAT_SPI_CS_CLEAR  1
-
-
-// luat_spi_device_t* 在lua层看到的是一个userdata
-int luat_spi_device_setup(luat_spi_device_t* spi_dev) {
-    luat_spi_bus_setup(spi_dev);
-    luat_gpio_mode(spi_dev->spi_config.cs, Luat_GPIO_OUTPUT, Luat_GPIO_DEFAULT, Luat_GPIO_HIGH); // CS
-    return 0;
-}
-
-//关闭SPI设备,成功返回0
-int luat_spi_device_close(luat_spi_device_t* spi_dev) {
-    return luat_spi_close(spi_dev->bus_id);
-}
-
-//收发SPI数据,返回接收字节数
-int luat_spi_device_transfer(luat_spi_device_t* spi_dev, const char* send_buf, size_t send_length, char* recv_buf, size_t recv_length) {
-    luat_spi_device_config(spi_dev);
-    luat_gpio_set(spi_dev->spi_config.cs, LUAT_SPI_CS_SELECT);
-    int ret = luat_spi_transfer(spi_dev->bus_id, send_buf, send_length, recv_buf, recv_length);
-    // int ret = luat_spi_send(spi_dev->bus_id, send_buf, send_length);
-    // ret = luat_spi_recv(spi_dev->bus_id, recv_buf, recv_length);
-    luat_gpio_set(spi_dev->spi_config.cs, LUAT_SPI_CS_CLEAR);
-    return ret;
-}
-
-//收SPI数据,返回接收字节数
-int luat_spi_device_recv(luat_spi_device_t* spi_dev, char* recv_buf, size_t length) {
-    luat_spi_device_config(spi_dev);
-    luat_gpio_set(spi_dev->spi_config.cs, LUAT_SPI_CS_SELECT);
-    int ret = luat_spi_recv(spi_dev->bus_id, recv_buf, length);
-    luat_gpio_set(spi_dev->spi_config.cs, LUAT_SPI_CS_CLEAR);
-    return ret;
-}
-
-//发SPI数据,返回发送字节数
-int luat_spi_device_send(luat_spi_device_t* spi_dev, const char* send_buf, size_t length) {
-    luat_spi_device_config(spi_dev);
-    luat_gpio_set(spi_dev->spi_config.cs, LUAT_SPI_CS_SELECT);
-    int ret = luat_spi_send(spi_dev->bus_id, send_buf, length);
-    luat_gpio_set(spi_dev->spi_config.cs, LUAT_SPI_CS_CLEAR);
-    return ret;
-}
-

+ 0 - 77
bsp/linux/port/luat_spi_linux.c

@@ -1,77 +0,0 @@
-
-#include "luat_base.h"
-#include "luat_gpio.h"
-#include "luat_msgbus.h"
-#include "luat_spi.h"
-
-// 模拟SPI在linux下的实现
-// TODO 当需要返回数据时, 调用lua方法获取需要返回的数据
-
-#define LUAT_LINUX_SPI_COUNT (3)
-
-typedef struct linuxspi {
-    luat_spi_t spi;
-    uint8_t open;
-}linuxspi_t;
-
-linuxspi_t linuxspis[LUAT_LINUX_SPI_COUNT] = {0};
-
-int luat_spi_device_config(luat_spi_device_t* spi_dev){
-    return 0;
-}
-
-int luat_spi_bus_setup(luat_spi_device_t* spi_dev){
-    int bus_id = spi_dev->bus_id;
-    if (bus_id < 0 || bus_id >= LUAT_LINUX_SPI_COUNT) {
-        return -1;
-    }
-    memcpy(&linuxspis[bus_id].spi, &(spi_dev->spi_config), sizeof(luat_spi_t));
-    linuxspis[bus_id].open = 1;
-    return 0;
-}
-
-int luat_spi_setup(luat_spi_t* spi) {
-    if (spi->id < 0 || spi->id >= LUAT_LINUX_SPI_COUNT) {
-        return -1;
-    }
-    memcpy(&linuxspis[spi->id].spi, spi, sizeof(luat_spi_t));
-    linuxspis[spi->id].open = 1;
-    return 0;
-}
-//关闭SPI,成功返回0
-int luat_spi_close(int spi_id) {
-    if (spi_id < 0 || spi_id >= LUAT_LINUX_SPI_COUNT) {
-        return -1;
-    }
-    linuxspis[spi_id].open = 0;
-    return 0;
-}
-//收发SPI数据,返回接收字节数
-int luat_spi_transfer(int spi_id, const char* send_buf, size_t send_length, char* recv_buf, size_t recv_length) {
-    if (spi_id < 0 || spi_id >= LUAT_LINUX_SPI_COUNT) {
-        return -1;
-    }
-    if (linuxspis[spi_id].open == 0)
-        return -1;
-    memset(recv_buf, 0, recv_length);
-    return recv_length;
-}
-//收SPI数据,返回接收字节数
-int luat_spi_recv(int spi_id, char* recv_buf, size_t length) {
-    if (spi_id < 0 || spi_id >= LUAT_LINUX_SPI_COUNT) {
-        return -1;
-    }
-    if (linuxspis[spi_id].open == 0)
-        return -1;
-    memset(recv_buf, 0, length);
-    return length;
-}
-//发SPI数据,返回发送字节数
-int luat_spi_send(int spi_id, const char* send_buf, size_t length) {
-    if (spi_id < 0 || spi_id >= LUAT_LINUX_SPI_COUNT) {
-        return -1;
-    }
-    if (linuxspis[spi_id].open == 0)
-        return -1;
-    return length;
-}

+ 0 - 137
bsp/linux/port/luat_timer_linux.c

@@ -1,137 +0,0 @@
-#define _POSIX_C_SOURCE 199309L
-#include "luat_base.h"
-#include "luat_malloc.h"
-#include "luat_timer.h"
-#include "luat_msgbus.h"
-#include <pthread.h>
-
-
-#define LUAT_LOG_TAG "timer"
-#include "luat_log.h"
-
-#include <time.h>
-#include <math.h>
-#include <unistd.h>
-
-#define TIMER_COUNT 128
-typedef struct sysp_timer {
-    luat_timer_t* timer;
-    uint32_t starttime;
-    uint32_t nexttime;
-} sysp_timer_t;
-static sysp_timer_t timers[TIMER_COUNT] = {0};
-
-// 获取当前时间
-uint32_t get_timestamp(void) {
-    struct timespec _t = {0};
-    clock_gettime(CLOCK_REALTIME, &_t);
-    uint32_t timenow = _t.tv_sec*1000 + lround(_t.tv_nsec/1e6);
-    //printf("time now > %u\n", timenow);
-    return timenow;
-}
-
-void luat_timer_check(void) {
-    //LLOGD("timer callback");
-    uint32_t timenow = get_timestamp();
-    rtos_msg_t msg;
-    for (size_t i = 0; i < TIMER_COUNT; i++)
-    {
-        if (timers[i].timer == NULL) continue;
-        //LLOGD("%d %d\n", timers[i].nexttime, timenow);
-        if (timers[i].nexttime < timenow) {
-            luat_timer_t *timer = timers[i].timer;
-            msg.handler = timer->func;
-            msg.ptr = NULL;
-            msg.arg1 = timer->id;
-            msg.arg2 = 0;
-            luat_msgbus_put(&msg, 0);
-            if (timer->repeat) {
-                timers[i].nexttime += timer->timeout;
-            }
-            else {
-                timers[i].nexttime = 0;
-            }
-        }
-    }
-    //LLOGD("end of luat_timer_check\n");
-}
-
-static int nextTimerSlot() {
-    for (size_t i = 0; i < TIMER_COUNT; i++)
-    {
-        if (timers[i].timer == NULL) {
-            return i;
-        }
-    }
-    return -1;
-}
-
-int luat_timer_start(luat_timer_t* timer) {
-    // int os_timer;
-    int timerIndex;
-    //LLOGD(">>luat_timer_start timeout=%ld", timer->timeout);
-    timerIndex = nextTimerSlot();
-    //LLOGD("timer id=%ld", timerIndex);
-    if (timerIndex < 0) {
-        return 1; // too many timer!!
-    }
-    // os_timer = timerIndex;
-    //LLOGD("timer id=%ld, osTimerNew=%p", timerIndex, os_timer);
-    timers[timerIndex].timer = timer;
-    timers[timerIndex].starttime = get_timestamp();
-    timers[timerIndex].nexttime = timers[timerIndex].starttime + timer->timeout;
-    
-    //timer->os_timer = os_timer;
-    return 0;
-}
-
-int luat_timer_stop(luat_timer_t* timer) {
-    if (!timer)
-        return 1;
-    for (size_t i = 0; i < TIMER_COUNT; i++)
-    {
-        if (timers[i].timer == timer) {
-            timers[i].timer = NULL;
-            break;
-        }
-    }
-    return 0;
-};
-
-luat_timer_t* luat_timer_get(size_t timer_id) {
-    for (size_t i = 0; i < TIMER_COUNT; i++)
-    {
-        if (timers[i].timer && timers[i].timer->id == timer_id) {
-            return timers[i].timer;
-        }
-    }
-    return NULL;
-}
-
-
-int luat_timer_mdelay(size_t ms) {
-    if (ms > 0)
-        usleep(ms*1000);
-    return 0;
-}
-
-void luat_timer_us_delay(size_t us) {
-    if (us)
-        usleep(us);
-}
-
-static pthread_mutex_t mp;
-static pthread_cond_t cv;
-
-void *timer_thread_start(void *args) {
-    // printf("timer thread started\r\n");
-    struct timespec to = {0};
-    pthread_mutex_lock(&mp);
-    to.tv_sec = 0;
-    to.tv_nsec = 100;
-    while (1) {
-        pthread_cond_timedwait(&cv, &mp, &to);
-        luat_timer_check();
-    }
-    return NULL;
-}

+ 0 - 619
bsp/linux/src/lua.c

@@ -1,619 +0,0 @@
-/*
-** $Id: lua.c,v 1.230.1.1 2017/04/19 17:29:57 roberto Exp $
-** Lua stand-alone interpreter
-** See Copyright Notice in lua.h
-*/
-
-#define lua_c
-
-#include "lprefix.h"
-
-
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "lua.h"
-
-#include "lauxlib.h"
-#include "lualib.h"
-
-LUALIB_API void luat_openlibs (lua_State *L);
-
-// disable readline
-#if defined(LUA_USE_READLINE)
-// #undef LUA_USE_READLINE
-#endif
-
-#if !defined(LUA_PROMPT)
-#define LUA_PROMPT		"> "
-#define LUA_PROMPT2		">> "
-#endif
-
-#if !defined(LUA_PROGNAME)
-#define LUA_PROGNAME		"lua"
-#endif
-
-#if !defined(LUA_MAXINPUT)
-#define LUA_MAXINPUT		512
-#endif
-
-#if !defined(LUA_INIT_VAR)
-#define LUA_INIT_VAR		"LUA_INIT"
-#endif
-
-#define LUA_INITVARVERSION	LUA_INIT_VAR LUA_VERSUFFIX
-
-
-/*
-** lua_stdin_is_tty detects whether the standard input is a 'tty' (that
-** is, whether we're running lua interactively).
-*/
-#if !defined(lua_stdin_is_tty)	/* { */
-
-#if defined(LUA_USE_POSIX)	/* { */
-
-#include <unistd.h>
-#define lua_stdin_is_tty()	isatty(0)
-
-#elif defined(LUA_USE_WINDOWS)	/* }{ */
-
-#include <io.h>
-#include <windows.h>
-
-#define lua_stdin_is_tty()	_isatty(_fileno(stdin))
-
-#else				/* }{ */
-
-/* ISO C definition */
-#define lua_stdin_is_tty()	1  /* assume stdin is a tty */
-
-#endif				/* } */
-
-#endif				/* } */
-
-
-/*
-** lua_readline defines how to show a prompt and then read a line from
-** the standard input.
-** lua_saveline defines how to "save" a read line in a "history".
-** lua_freeline defines how to free a line read by lua_readline.
-*/
-#if !defined(lua_readline)	/* { */
-
-#if defined(LUA_USE_READLINE)	/* { */
-
-#include <readline/readline.h>
-#include <readline/history.h>
-#define lua_readline(L,b,p)	((void)L, ((b)=readline(p)) != NULL)
-#define lua_saveline(L,line)	((void)L, add_history(line))
-#define lua_freeline(L,b)	((void)L, free(b))
-
-#else				/* }{ */
-
-#define lua_readline(L,b,p) \
-        ((void)L, fputs(p, stdout), fflush(stdout),  /* show prompt */ \
-        fgets(b, LUA_MAXINPUT, stdin) != NULL)  /* get line */
-#define lua_saveline(L,line)	{ (void)L; (void)line; }
-#define lua_freeline(L,b)	{ (void)L; (void)b; }
-
-#endif				/* } */
-
-#endif				/* } */
-
-
-
-
-static lua_State *globalL = NULL;
-
-static const char *progname = LUA_PROGNAME;
-
-
-/*
-** Hook set by signal function to stop the interpreter.
-*/
-static void lstop (lua_State *L, lua_Debug *ar) {
-  (void)ar;  /* unused arg. */
-  lua_sethook(L, NULL, 0, 0);  /* reset hook */
-  luaL_error(L, "interrupted!");
-}
-
-
-/*
-** Function to be called at a C signal. Because a C signal cannot
-** just change a Lua state (as there is no proper synchronization),
-** this function only sets a hook that, when called, will stop the
-** interpreter.
-*/
-static void laction (int i) {
-  signal(i, SIG_DFL); /* if another SIGINT happens, terminate process */
-  lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1);
-}
-
-
-static void print_usage (const char *badoption) {
-  lua_writestringerror("%s: ", progname);
-  if (badoption[1] == 'e' || badoption[1] == 'l')
-    lua_writestringerror("'%s' needs argument\n", badoption);
-  else
-    lua_writestringerror("unrecognized option '%s'\n", badoption);
-  lua_writestringerror(
-  "usage: %s [options] [script [args]]\n"
-  "Available options are:\n"
-  "  -e stat  execute string 'stat'\n"
-  "  -i       enter interactive mode after executing 'script'\n"
-  "  -l name  require library 'name' into global 'name'\n"
-  "  -v       show version information\n"
-  "  -E       ignore environment variables\n"
-  "  --       stop handling options\n"
-  "  -        stop handling options and execute stdin\n"
-  ,
-  progname);
-}
-
-
-/*
-** Prints an error message, adding the program name in front of it
-** (if present)
-*/
-static void l_message (const char *pname, const char *msg) {
-  if (pname) lua_writestringerror("%s: ", pname);
-  lua_writestringerror("%s\n", msg);
-}
-
-
-/*
-** Check whether 'status' is not OK and, if so, prints the error
-** message on the top of the stack. It assumes that the error object
-** is a string, as it was either generated by Lua or by 'msghandler'.
-*/
-static int report (lua_State *L, int status) {
-  if (status != LUA_OK) {
-    const char *msg = lua_tostring(L, -1);
-    l_message(progname, msg);
-    lua_pop(L, 1);  /* remove message */
-  }
-  return status;
-}
-
-
-/*
-** Message handler used to run all chunks
-*/
-static int msghandler (lua_State *L) {
-  const char *msg = lua_tostring(L, 1);
-  if (msg == NULL) {  /* is error object not a string? */
-    if (luaL_callmeta(L, 1, "__tostring") &&  /* does it have a metamethod */
-        lua_type(L, -1) == LUA_TSTRING)  /* that produces a string? */
-      return 1;  /* that is the message */
-    else
-      msg = lua_pushfstring(L, "(error object is a %s value)",
-                               luaL_typename(L, 1));
-  }
-  luaL_traceback(L, L, msg, 1);  /* append a standard traceback */
-  return 1;  /* return the traceback */
-}
-
-
-/*
-** Interface to 'lua_pcall', which sets appropriate message function
-** and C-signal handler. Used to run all chunks.
-*/
-static int docall (lua_State *L, int narg, int nres) {
-  int status;
-  int base = lua_gettop(L) - narg;  /* function index */
-  lua_pushcfunction(L, msghandler);  /* push message handler */
-  lua_insert(L, base);  /* put it under function and args */
-  globalL = L;  /* to be available to 'laction' */
-  signal(SIGINT, laction);  /* set C-signal handler */
-  status = lua_pcall(L, narg, nres, base);
-  signal(SIGINT, SIG_DFL); /* reset C-signal handler */
-  lua_remove(L, base);  /* remove message handler from the stack */
-  return status;
-}
-
-
-static void print_version (void) {
-  lua_writestring(LUA_COPYRIGHT, strlen(LUA_COPYRIGHT));
-  lua_writeline();
-  lua_writestring("Enhance by LuatOS. call os.exit() for quit", strlen("Enhance by LuatOS. call os.exit() for quit"));
-  lua_writeline();
-}
-
-
-/*
-** Create the 'arg' table, which stores all arguments from the
-** command line ('argv'). It should be aligned so that, at index 0,
-** it has 'argv[script]', which is the script name. The arguments
-** to the script (everything after 'script') go to positive indices;
-** other arguments (before the script name) go to negative indices.
-** If there is no script name, assume interpreter's name as base.
-*/
-static void createargtable (lua_State *L, char **argv, int argc, int script) {
-  int i, narg;
-  if (script == argc) script = 0;  /* no script name? */
-  narg = argc - (script + 1);  /* number of positive indices */
-  lua_createtable(L, narg, script + 1);
-  for (i = 0; i < argc; i++) {
-    lua_pushstring(L, argv[i]);
-    lua_rawseti(L, -2, i - script);
-  }
-  lua_setglobal(L, "arg");
-}
-
-
-static int dochunk (lua_State *L, int status) {
-  if (status == LUA_OK) status = docall(L, 0, 0);
-  return report(L, status);
-}
-
-
-static int dofile (lua_State *L, const char *name) {
-  return dochunk(L, luaL_loadfile(L, name));
-}
-
-
-static int dostring (lua_State *L, const char *s, const char *name) {
-  return dochunk(L, luaL_loadbuffer(L, s, strlen(s), name));
-}
-
-
-/*
-** Calls 'require(name)' and stores the result in a global variable
-** with the given name.
-*/
-static int dolibrary (lua_State *L, const char *name) {
-  int status;
-  lua_getglobal(L, "require");
-  lua_pushstring(L, name);
-  status = docall(L, 1, 1);  /* call 'require(name)' */
-  if (status == LUA_OK)
-    lua_setglobal(L, name);  /* global[name] = require return */
-  return report(L, status);
-}
-
-
-/*
-** Returns the string to be used as a prompt by the interpreter.
-*/
-static const char *get_prompt (lua_State *L, int firstline) {
-  const char *p;
-  lua_getglobal(L, firstline ? "_PROMPT" : "_PROMPT2");
-  p = lua_tostring(L, -1);
-  if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2);
-  return p;
-}
-
-/* mark in error messages for incomplete statements */
-#define EOFMARK		"<eof>"
-#define marklen		(sizeof(EOFMARK)/sizeof(char) - 1)
-
-
-/*
-** Check whether 'status' signals a syntax error and the error
-** message at the top of the stack ends with the above mark for
-** incomplete statements.
-*/
-static int incomplete (lua_State *L, int status) {
-  if (status == LUA_ERRSYNTAX) {
-    size_t lmsg;
-    const char *msg = lua_tolstring(L, -1, &lmsg);
-    if (lmsg >= marklen && strcmp(msg + lmsg - marklen, EOFMARK) == 0) {
-      lua_pop(L, 1);
-      return 1;
-    }
-  }
-  return 0;  /* else... */
-}
-
-
-/*
-** Prompt the user, read a line, and push it into the Lua stack.
-*/
-static int pushline (lua_State *L, int firstline) {
-  char buffer[LUA_MAXINPUT];
-  char *b = buffer;
-  size_t l;
-  const char *prmt = get_prompt(L, firstline);
-  int readstatus = lua_readline(L, b, prmt);
-  if (readstatus == 0)
-    return 0;  /* no input (prompt will be popped by caller) */
-  lua_pop(L, 1);  /* remove prompt */
-  l = strlen(b);
-  if (l > 0 && b[l-1] == '\n')  /* line ends with newline? */
-    b[--l] = '\0';  /* remove it */
-  if (firstline && b[0] == '=')  /* for compatibility with 5.2, ... */
-    lua_pushfstring(L, "return %s", b + 1);  /* change '=' to 'return' */
-  else
-    lua_pushlstring(L, b, l);
-  lua_freeline(L, b);
-  return 1;
-}
-
-
-/*
-** Try to compile line on the stack as 'return <line>;'; on return, stack
-** has either compiled chunk or original line (if compilation failed).
-*/
-static int addreturn (lua_State *L) {
-  const char *line = lua_tostring(L, -1);  /* original line */
-  const char *retline = lua_pushfstring(L, "return %s;", line);
-  int status = luaL_loadbuffer(L, retline, strlen(retline), "=stdin");
-  if (status == LUA_OK) {
-    lua_remove(L, -2);  /* remove modified line */
-    if (line[0] != '\0')  /* non empty? */
-      lua_saveline(L, line);  /* keep history */
-  }
-  else
-    lua_pop(L, 2);  /* pop result from 'luaL_loadbuffer' and modified line */
-  return status;
-}
-
-
-/*
-** Read multiple lines until a complete Lua statement
-*/
-static int multiline (lua_State *L) {
-  for (;;) {  /* repeat until gets a complete statement */
-    size_t len;
-    const char *line = lua_tolstring(L, 1, &len);  /* get what it has */
-    int status = luaL_loadbuffer(L, line, len, "=stdin");  /* try it */
-    if (!incomplete(L, status) || !pushline(L, 0)) {
-      lua_saveline(L, line);  /* keep history */
-      return status;  /* cannot or should not try to add continuation line */
-    }
-    lua_pushliteral(L, "\n");  /* add newline... */
-    lua_insert(L, -2);  /* ...between the two lines */
-    lua_concat(L, 3);  /* join them */
-  }
-}
-
-
-/*
-** Read a line and try to load (compile) it first as an expression (by
-** adding "return " in front of it) and second as a statement. Return
-** the final status of load/call with the resulting function (if any)
-** in the top of the stack.
-*/
-static int loadline (lua_State *L) {
-  int status;
-  lua_settop(L, 0);
-  if (!pushline(L, 1))
-    return -1;  /* no input */
-  if ((status = addreturn(L)) != LUA_OK)  /* 'return ...' did not work? */
-    status = multiline(L);  /* try as command, maybe with continuation lines */
-  lua_remove(L, 1);  /* remove line from the stack */
-  lua_assert(lua_gettop(L) == 1);
-  return status;
-}
-
-
-/*
-** Prints (calling the Lua 'print' function) any values on the stack
-*/
-static void l_print (lua_State *L) {
-  int n = lua_gettop(L);
-  if (n > 0) {  /* any result to be printed? */
-    luaL_checkstack(L, LUA_MINSTACK, "too many results to print");
-    lua_getglobal(L, "print");
-    lua_insert(L, 1);
-    if (lua_pcall(L, n, 0, 0) != LUA_OK)
-      l_message(progname, lua_pushfstring(L, "error calling 'print' (%s)",
-                                             lua_tostring(L, -1)));
-  }
-}
-
-
-/*
-** Do the REPL: repeatedly read (load) a line, evaluate (call) it, and
-** print any results.
-*/
-static void doREPL (lua_State *L) {
-  int status;
-  const char *oldprogname = progname;
-  progname = NULL;  /* no 'progname' on errors in interactive mode */
-  while ((status = loadline(L)) != -1) {
-    if (status == LUA_OK)
-      status = docall(L, 0, LUA_MULTRET);
-    if (status == LUA_OK) l_print(L);
-    else report(L, status);
-  }
-  lua_settop(L, 0);  /* clear stack */
-  lua_writeline();
-  progname = oldprogname;
-}
-
-
-/*
-** Push on the stack the contents of table 'arg' from 1 to #arg
-*/
-static int pushargs (lua_State *L) {
-  int i, n;
-  if (lua_getglobal(L, "arg") != LUA_TTABLE)
-    luaL_error(L, "'arg' is not a table");
-  n = (int)luaL_len(L, -1);
-  luaL_checkstack(L, n + 3, "too many arguments to script");
-  for (i = 1; i <= n; i++)
-    lua_rawgeti(L, -i, i);
-  lua_remove(L, -i);  /* remove table from the stack */
-  return n;
-}
-
-
-static int handle_script (lua_State *L, char **argv) {
-  int status;
-  const char *fname = argv[0];
-  if (strcmp(fname, "-") == 0 && strcmp(argv[-1], "--") != 0)
-    fname = NULL;  /* stdin */
-  status = luaL_loadfile(L, fname);
-  if (status == LUA_OK) {
-    int n = pushargs(L);  /* push arguments to script */
-    status = docall(L, n, LUA_MULTRET);
-  }
-  return report(L, status);
-}
-
-
-
-/* bits of various argument indicators in 'args' */
-#define has_error	1	/* bad option */
-#define has_i		2	/* -i */
-#define has_v		4	/* -v */
-#define has_e		8	/* -e */
-#define has_E		16	/* -E */
-
-/*
-** Traverses all arguments from 'argv', returning a mask with those
-** needed before running any Lua code (or an error code if it finds
-** any invalid argument). 'first' returns the first not-handled argument
-** (either the script name or a bad argument in case of error).
-*/
-static int collectargs (char **argv, int *first) {
-  int args = 0;
-  int i;
-  for (i = 1; argv[i] != NULL; i++) {
-    *first = i;
-    if (argv[i][0] != '-')  /* not an option? */
-        return args;  /* stop handling options */
-    switch (argv[i][1]) {  /* else check option */
-      case '-':  /* '--' */
-        if (argv[i][2] != '\0')  /* extra characters after '--'? */
-          return has_error;  /* invalid option */
-        *first = i + 1;
-        return args;
-      case '\0':  /* '-' */
-        return args;  /* script "name" is '-' */
-      case 'E':
-        if (argv[i][2] != '\0')  /* extra characters after 1st? */
-          return has_error;  /* invalid option */
-        args |= has_E;
-        break;
-      case 'i':
-        args |= has_i;  /* (-i implies -v) *//* FALLTHROUGH */
-      case 'v':
-        if (argv[i][2] != '\0')  /* extra characters after 1st? */
-          return has_error;  /* invalid option */
-        args |= has_v;
-        break;
-      case 'e':
-        args |= has_e;  /* FALLTHROUGH */
-      case 'l':  /* both options need an argument */
-        if (argv[i][2] == '\0') {  /* no concatenated argument? */
-          i++;  /* try next 'argv' */
-          if (argv[i] == NULL || argv[i][0] == '-')
-            return has_error;  /* no next argument or it is another option */
-        }
-        break;
-      default:  /* invalid option */
-        return has_error;
-    }
-  }
-  *first = i;  /* no script name */
-  return args;
-}
-
-
-/*
-** Processes options 'e' and 'l', which involve running Lua code.
-** Returns 0 if some code raises an error.
-*/
-static int runargs (lua_State *L, char **argv, int n) {
-  int i;
-  for (i = 1; i < n; i++) {
-    int option = argv[i][1];
-    lua_assert(argv[i][0] == '-');  /* already checked */
-    if (option == 'e' || option == 'l') {
-      int status;
-      const char *extra = argv[i] + 2;  /* both options need an argument */
-      if (*extra == '\0') extra = argv[++i];
-      lua_assert(extra != NULL);
-      status = (option == 'e')
-               ? dostring(L, extra, "=(command line)")
-               : dolibrary(L, extra);
-      if (status != LUA_OK) return 0;
-    }
-  }
-  return 1;
-}
-
-
-
-static int handle_luainit (lua_State *L) {
-  const char *name = "=" LUA_INITVARVERSION;
-  const char *init = getenv(name + 1);
-  if (init == NULL) {
-    name = "=" LUA_INIT_VAR;
-    init = getenv(name + 1);  /* try alternative name */
-  }
-  if (init == NULL) return LUA_OK;
-  else if (init[0] == '@')
-    return dofile(L, init+1);
-  else
-    return dostring(L, init, name);
-}
-
-
-/*
-** Main body of stand-alone interpreter (to be called in protected mode).
-** Reads the options and handles them all.
-*/
-static int pmain (lua_State *L) {
-  int argc = (int)lua_tointeger(L, 1);
-  char **argv = (char **)lua_touserdata(L, 2);
-  int script;
-  int args = collectargs(argv, &script);
-  luaL_checkversion(L);  /* check that interpreter has correct version */
-  if (argv[0] && argv[0][0]) progname = argv[0];
-  if (args == has_error) {  /* bad arg? */
-    print_usage(argv[script]);  /* 'script' has index of bad arg. */
-    return 0;
-  }
-  if (args & has_v)  /* option '-v'? */
-    print_version();
-  if (args & has_E) {  /* option '-E'? */
-    lua_pushboolean(L, 1);  /* signal for libraries to ignore env. vars. */
-    lua_setfield(L, LUA_REGISTRYINDEX, "LUA_NOENV");
-  }
-  luat_openlibs(L);  /* open standard libraries */
-  createargtable(L, argv, argc, script);  /* create table 'arg' */
-  if (!(args & has_E)) {  /* no option '-E'? */
-    if (handle_luainit(L) != LUA_OK)  /* run LUA_INIT */
-      return 0;  /* error running LUA_INIT */
-  }
-  if (!runargs(L, argv, script))  /* execute arguments -e and -l */
-    return 0;  /* something failed */
-  if (script < argc &&  /* execute main script (if there is one) */
-      handle_script(L, argv + script) != LUA_OK)
-    return 0;
-  if (args & has_i)  /* -i option? */
-    doREPL(L);  /* do read-eval-print loop */
-  else if (script == argc && !(args & (has_e | has_v))) {  /* no arguments? */
-    if (lua_stdin_is_tty()) {  /* running in interactive mode? */
-      print_version();
-      doREPL(L);  /* do read-eval-print loop */
-    }
-    else dofile(L, NULL);  /* executes stdin as a file */
-  }
-  lua_pushboolean(L, 1);  /* signal no errors */
-  return 1;
-}
-
-void* luat_heap_alloc(void *ud, void *ptr, size_t osize, size_t nsize);
-
-int lua_main (int argc, char **argv) {
-  int status, result;
-  lua_State *L = lua_newstate(luat_heap_alloc, NULL);;  /* create state */
-  if (L == NULL) {
-    l_message(argv[0], "cannot create state: not enough memory");
-    return EXIT_FAILURE;
-  }
-  lua_pushcfunction(L, &pmain);  /* to call 'pmain' in protected mode */
-  lua_pushinteger(L, argc);  /* 1st argument */
-  lua_pushlightuserdata(L, argv); /* 2nd argument */
-  status = lua_pcall(L, 2, 1, 0);  /* do the call */
-  result = lua_toboolean(L, -1);  /* get result */
-  report(L, status);
-  lua_close(L);
-  return (result && status == LUA_OK) ? EXIT_SUCCESS : EXIT_FAILURE;
-}

+ 0 - 105
bsp/linux/src/main.c

@@ -1,105 +0,0 @@
-
-#include <stdio.h>
-
-#include "luat_base.h"
-#include "luat_malloc.h"
-#include "luat_msgbus.h"
-#include "luat_fs.h"
-#include <stdlib.h>
-#include <pthread.h>
-
-#include "bget.h"
-
-// #include "FreeRTOS.h"
-// #include "task.h"
-
-#define LUAT_HEAP_SIZE (1024*1024)
-uint8_t luavm_heap[LUAT_HEAP_SIZE] = {0};
-void *timer_thread_start(void *);
-
-// void luat_log_init_win32(void);
-
-
-int cmdline_argc;
-char** cmdline_argv;
-
-int lua_main (int argc, char **argv);
-
-static void _luat_main(void* args) {
-    //luat_main();
-    luat_fs_init();
-    lua_main(cmdline_argc, cmdline_argv);
-    exit(0);
-}
-
-#ifdef LUAT_USE_LVGL
-
-#include "lvgl.h"
-#include "exts/lv_drivers/gtkdrv/gtkdrv.h"
-static int luat_lvg_handler(lua_State* L, void* ptr) {
-    lv_task_handler();
-    return 0;
-}
-
-static void _lvgl_handler(void* args) {
-    rtos_msg_t msg = {0};
-    msg.handler = luat_lvg_handler;
-    while (1) {
-        luat_msgbus_put(&msg, 0);
-        vTaskDelay(5);
-    };
-}
-#endif
-
-
-// boot
-int main(int argc, char** argv) {
-    cmdline_argc = argc;
-    cmdline_argv = argv;
-    
-    bpool(luavm_heap, LUAT_HEAP_SIZE);
-
-    // luat_log_init_win32();
-
-#ifdef LUAT_USE_LVGL
-    lv_init();
-    void lvgl_linux_init(void);
-    lvgl_linux_init();
-    xTaskCreate( _lvgl_handler, "lvgl", 1024*2, NULL, 23, NULL );
-#endif
-
-    pthread_t t;
-    pthread_create(&t, NULL, &timer_thread_start, NULL);
-
-    // xTaskCreate( _luat_main, "luatos", 1024*16, NULL, 21, NULL );
-    // vTaskStartScheduler();
-    _luat_main(NULL);
-    return 0;
-}
-
-#ifdef LUAT_USE_LVGL
-void lvgl_linux_init(void) {
-    gtkdrv_init();
-    static lv_disp_buf_t disp_buf1;
-    static lv_color_t buf1_1[LV_HOR_RES_MAX * LV_VER_RES_MAX];
-    lv_disp_buf_init(&disp_buf1, buf1_1, NULL, LV_HOR_RES_MAX * LV_VER_RES_MAX);
-
-    /*Create a display*/
-    lv_disp_drv_t disp_drv;
-    lv_disp_drv_init(&disp_drv);
-    disp_drv.buffer = &disp_buf1;
-    disp_drv.flush_cb = gtkdrv_flush_cb;
-
-    lv_disp_drv_register(&disp_drv);
-
-//   lv_indev_drv_t indev_drv_mouse;
-//   lv_indev_drv_init(&indev_drv_mouse);
-//   indev_drv_mouse.type = LV_INDEV_TYPE_POINTER;
-
-//   lv_indev_drv_t indev_drv_kb;
-//   lv_indev_drv_init(&indev_drv_kb);
-//   indev_drv_kb.type = LV_INDEV_TYPE_KEYPAD;
-//   indev_drv_kb.read_cb = lv_keyboard_read_cb;
-//   lv_indev_drv_register(&indev_drv_kb);
-}
-#endif

+ 0 - 216
bsp/linux/xmake.lua

@@ -1,216 +0,0 @@
-set_project("LuatOS-BSP")
-set_xmakever("2.6.3")
-
-set_version("0.0.3", {build = "%Y%m%d%H%M"})
-add_rules("mode.debug", "mode.release")
-
--- 这里用llvm和clang了,尝试一下
-add_requires("llvm")
-set_toolchains("@llvm")
-
-local luatos = "../../"
-
--- set warning all as error
-set_warnings("allextra")
-set_optimize("fastest")
--- set language: c11
-set_languages("c11", "cxx11")
-
-add_defines("__LUATOS__", "__XMAKE_BUILD__")
-add_cflags("-ffunction-sections","-fdata-sections", "-Wl,--gc-sections","-D_POSIX_C_SOURCE=199309L")
-add_ldflags("-ffunction-sections","-fdata-sections", "-Wl,--gc-sections", "-lreadline","-lm","-pthread")
-
-add_requires("libsdl2")
-add_packages("libsdl2")
-
-target("luatos")
-    -- set kind
-    set_kind("binary")
-    set_targetdir("$(buildir)/out")
-    -- add deps
-    add_files("src/*.c",{public = true})
-    add_files("port/*.c",{public = true})
-    add_includedirs("include",{public = true})
-    -- printf
-    add_includedirs(luatos.."components/printf",{public = true})
-    add_files(luatos.."components/printf/*.c")
-    add_files(luatos.."lua/src/*.c")
-    add_files(luatos.."luat/modules/*.c")
-    add_files(luatos.."luat/vfs/*.c")
-    add_files(luatos.."components/common/*.c")
-    -- add_files(luatos.."components/lcd/*.c")
-    -- add_files(luatos.."components/sfd/*.c")
-    -- add_files(luatos.."components/sfud/*.c")
-    -- add_files(luatos.."components/statem/*.c")
-    -- add_files(luatos.."components/nr_micro_shell/*.c")
-    -- add_files(luatos.."components/eink/*.c")
-    -- add_files(luatos.."components/epaper/*.c")
-    -- add_files(luatos.."components/iconv/*.c")
-    add_files(luatos.."components/lfs/*.c")
-    add_files(luatos.."components/lua-cjson/*.c")
-    -- add_files(luatos.."components/minmea/*.c")
-    -- add_files(luatos.."components/u8g2/*.c")
-    -- add_files(luatos.."components/fatfs/*.c")
-    add_files(luatos.."luat/weak/*.c")
-    -- add_files(luatos.."components/coremark/*.c")
-    add_files(luatos.."components/cjson/*.c")
-    
-    add_includedirs(luatos.."lua/include",{public = true})
-    add_includedirs(luatos.."luat/include",{public = true})
-    add_includedirs(luatos.."components/common",{public = true})
-    add_includedirs(luatos.."components/lcd",{public = true})
-    add_includedirs(luatos.."components/sfud",{public = true})
-    add_includedirs(luatos.."components/statem",{public = true})
-    add_includedirs(luatos.."components/coremark",{public = true})
-    add_includedirs(luatos.."components/cjson",{public = true})
-    
-    add_includedirs(luatos.."components/eink")
-    add_includedirs(luatos.."components/epaper")
-    add_includedirs(luatos.."components/iconv")
-    add_includedirs(luatos.."components/lfs")
-    add_includedirs(luatos.."components/lua-cjson")
-    add_includedirs(luatos.."components/minmea")
-    add_includedirs(luatos.."components/u8g2")
-    add_includedirs(luatos.."components/fatfs")
-
-    -- -- gtfont
-    -- add_includedirs(luatos.."components/gtfont",{public = true})
-    -- add_files(luatos.."components/gtfont/*.c")
-
-    -- add_files(luatos.."components/i2c-tools/*.c")
-    -- add_includedirs(luatos.."components/i2c-tools")
-    
-    -- add_files(luatos.."components/flashdb/src/*.c")
-    -- add_files(luatos.."components/fal/src/*.c")
-    -- add_includedirs(luatos.."components/flashdb/inc",{public = true})
-    -- add_includedirs(luatos.."components/fal/inc",{public = true})
-
-    add_files(luatos.."components/mbedtls/library/*.c")
-    add_includedirs(luatos.."components/mbedtls/include")
-
-    -- add_files(luatos.."components/zlib/*.c")
-    -- add_includedirs(luatos.."components/zlib")
-
-    -- add_files(luatos.."components/mlx90640-library/*.c")
-    -- add_includedirs(luatos.."components/mlx90640-library")
-
-    -- add_files(luatos.."components/camera/*.c")
-    -- add_includedirs(luatos.."components/camera")
-
-    -- add_files(luatos.."components/soft_keyboard/*.c")
-    -- add_includedirs(luatos.."components/soft_keyboard")
-
-    -- add_files(luatos.."components/multimedia/*.c")
-    -- add_includedirs(luatos.."components/multimedia")
-
-    -- add_files(luatos.."components/io_queue/*.c")
-    -- add_includedirs(luatos.."components/io_queue")
-
-    -- add_files(luatos.."components/tjpgd/*.c")
-    -- add_includedirs(luatos.."components/tjpgd")
-
-    -- -- shell & cmux
-    -- add_includedirs(luatos.."components/shell",{public = true})
-    -- add_includedirs(luatos.."components/cmux",{public = true})
-    -- add_files(luatos.."components/shell/*.c")
-    -- add_files(luatos.."components/cmux/*.c")
-
-    -- -- ymodem
-    -- add_includedirs(luatos.."components/ymodem",{public = true})
-    -- add_files(luatos.."components/ymodem/*.c")
-
-    -- -- usbapp
-    -- add_includedirs(luatos.."components/usbapp",{public = true})
-    -- add_files(luatos.."components/usbapp/*.c")
-    -- -- network
-    -- add_includedirs(luatos.."components/ethernet/common",{public = true})
-    -- add_includedirs(luatos.."components/ethernet/w5500",{public = true})
-    -- add_includedirs(luatos.."components/network/adapter",{public = true})
-    -- add_files(luatos.."components/ethernet/**.c")
-    -- add_files(luatos.."components/network/adapter/*.c")
-
-    -- -- mqtt
-    -- add_includedirs(luatos.."components/network/libemqtt",{public = true})
-    -- add_files(luatos.."components/network/libemqtt/*.c")
-
-    -- -- sntp
-    -- add_includedirs(luatos.."components/network/libsntp",{public = true})
-    -- add_files(luatos.."components/network/libsntp/*.c")
-
-    -- -- http_parser
-    -- add_includedirs(luatos.."components/network/http_parser",{public = true})
-    -- add_files(luatos.."components/network/http_parser/*.c")
-    
-    -- -- libftp
-    -- add_includedirs(luatos.."components/network/libftp",{public = true})
-    -- add_files(luatos.."components/network/libftp/*.c")
-    
-    -- -- websocket
-    -- add_includedirs(luatos.."components/network/websocket",{public = true})
-    -- add_files(luatos.."components/network/websocket/*.c")
-
-    
-    -- -- http
-    -- add_includedirs(luatos.."components/network/libhttp",{public = true})
-    -- -- add_files(luatos.."components/network/libhttp/luat_lib_http.c")
-    -- add_files(luatos.."components/network/libhttp/*.c")
-
-    -- iotauth
-    add_files(luatos.."components/iotauth/luat_lib_iotauth.c")
-
-    -- qrcode
-    add_includedirs(luatos.."components/qrcode",{public = true})
-    add_files(luatos.."components/qrcode/*.c")
-
-    -- -- lora
-    -- add_includedirs(luatos.."components/lora",{public = true})
-    -- add_files(luatos.."components/lora/**.c")
-
-    -- -- fonts
-    -- add_includedirs(luatos.."components/luatfonts",{public = true})
-    -- add_files(luatos.."components/luatfonts/**.c")
-
-    -- crypto
-    add_files(luatos.."components/crypto/**.c")
-
-    -- protobuf
-    add_includedirs(luatos.."components/serialization/protobuf")
-    add_files(luatos.."components/serialization/protobuf/*.c")
-    
-    -- rsa
-    add_includedirs(luatos.."components/rsa/inc")
-    add_files(luatos.."components/rsa/**.c")
-
-    -- -- 添加fskv
-    -- add_includedirs(luatos.."components/fskv")
-    -- add_files(luatos.."components/fskv/*.c")
-
-    -- sdl2
-    add_includedirs(luatos.."components/ui/sdl2")
-    add_files(luatos.."components/ui/sdl2/*.c")
-
-    -- u8g2
-    add_includedirs(luatos.."components/u8g2")
-    add_files(luatos.."components/u8g2/*.c")
-
-    -- lcd
-    add_includedirs(luatos.."components/lcd")
-    add_files(luatos.."components/lcd/*.c")
-    
-    -- lvgl
-    add_includedirs(luatos.."components/lvgl")
-    add_includedirs(luatos.."components/lvgl/binding")
-    add_includedirs(luatos.."components/lvgl/gen")
-    add_includedirs(luatos.."components/lvgl/src")
-    add_includedirs(luatos.."components/lvgl/font")
-    add_includedirs(luatos.."components/lvgl/src/lv_font")
-
-    add_files(luatos.."components/lvgl/**.c")
-    -- 默认不编译lv的demos, 节省大量的编译时间
-    remove_files(luatos.."components/lvgl/lv_demos/**.c")
-
-    -- tjpgd
-    add_files(luatos.."components/tjpgd/*.c")
-    add_includedirs(luatos.."components/tjpgd")
-
-target_end()