Dozingfiretruck b966aa4f63 add:;linux添加luat_timer_us_delay 2 年之前
..
include df78d74b53 add:linux添加lcd lvgl编译 2 年之前
lib b6dd3baef6 fix: *重要*, 解决timer释放错误 3 年之前
port b966aa4f63 add:;linux添加luat_timer_us_delay 2 年之前
src 601b7450bc fix: bsp/linux的sys可用了,sys.wait正常 3 年之前
README.md 2488fa3c13 add:linux编译添加常见问题 4 年之前
main.lua 0e705d7ed3 update: 更新bsp/linux,能出现窗口了 4 年之前
xmake.lua ad3470dcbf fix: 编译参数少了pthread 2 年之前

README.md

LuatOS@Linux

  • 底层rtos FreeRTOSv202012.00
  • 编译工具cmake/make/gcc
  • 文件系统,posix原生文件系统,以工作目录为基点
  • 默认luavm和rtos内存分配均为 1MByte

简易编译说明

cd bsp/linux
mkdir build
cd build
cmake ..
make

编译完成后, 会在build目录生成 luatos

简单用法

./luatos
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()

常见问题

1:执行cmake ..时报错:

-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at CMakeLists.txt:14 (project):
  No CMAKE_CXX_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!
See also "/data/home/lqy/code/LuatOS/bsp/linux/build/CMakeFiles/CMakeOutput.log".
See also "/data/home/lqy/code/LuatOS/bsp/linux/build/CMakeFiles/CMakeError.log".

答:未安装g++,执行sudo apt-get install g++

2:执行make时报错:

[ 99%] Building C object CMakeFiles/luatos.dir/src/lua.c.o
/data/home/lqy/code/LuatOS/bsp/linux/src/lua.c:82:10: fatal error: readline/readline.h: 没有那个文件或目录
 #include <readline/readline.h>
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/luatos.dir/build.make:76:CMakeFiles/luatos.dir/src/lua.c.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:265:CMakeFiles/luatos.dir/all] 错误 2
make: *** [Makefile:130:all] 错误 2

答:缺少libreadline-dev依赖包,造成找不到readline.h,执行sudo aptitude install libreadline-dev