Wendal Chen 4 лет назад
Родитель
Сommit
32a39b5b4a
3 измененных файлов с 15 добавлено и 2 удалено
  1. 3 2
      bsp/win32/CMakeLists.txt
  2. 11 0
      bsp/win32/module_test/012vmx.lua
  3. 1 0
      bsp/win32/port/luat_base_win32.c

+ 3 - 2
bsp/win32/CMakeLists.txt

@@ -60,6 +60,7 @@ add_library(luat ${TOPROOT}/luat/modules/luat_main.c
                  ${TOPROOT}/luat/modules/luat_lib_mqttcore.c
                  ${TOPROOT}/luat/modules/luat_lib_libcoap.c
                  ${TOPROOT}/luat/modules/luat_lib_crypto.c
+                 ${TOPROOT}/luat/modules/luat_lib_vmx.c
                  ${TOPROOT}/components/sfd/luat_lib_sfd.c
                  ${TOPROOT}/components/sfd/luat_sfd_mem.c
                  ${TOPROOT}/components/sfd/luat_sfd_w25q.c
@@ -116,10 +117,10 @@ add_subdirectory(${TOPROOT}/components/lvgl lvgl.out)
 #-----------------------
 
 
+
 # 指定生成目标
 add_executable(luatos src/main_win32.c src/lua.c)
-target_link_libraries(luat freertos10 winmm fatfs lvgl
-)
+target_link_libraries(luat freertos10 winmm fatfs lvgl lua)
 target_link_libraries(luatos freertos10 lua luatos_msys luat winmm cjson
                       mbedtls fatfs lvgl 
                       )

+ 11 - 0
bsp/win32/module_test/012vmx.lua

@@ -0,0 +1,11 @@
+--加载sys库
+-- _G.sys = require("sys")
+
+log.info("vmx", "create ...")
+vm = vmx.create()
+
+vmx.exec(vm, "log.info('inside', 'vmx')")
+
+log.info("vmx", "all done")
+
+os.exit(0)

+ 1 - 0
bsp/win32/port/luat_base_win32.c

@@ -44,6 +44,7 @@ static const luaL_Reg loadedlibs[] = {
   {"sfd",   luaopen_sfd},
   {"lfs2",   luaopen_lfs2},
   {"gpio",   luaopen_gpio},
+  {"vmx",    luaopen_vmx},
 #ifdef LUAT_USE_LUF
   {"luf",    luaopen_luf},
 #endif