Browse Source

【主线待合】支持了common_cfg后可以通过该方式实现mcu与其他平台lua的差异;无需再使用强符号锚点,此外请关注一下elog是不是也可以这么改

master
Lizongdi 1 week ago
parent
commit
5da0486c67
  1. 6
      bspMCU/l_stm32.c
  2. 10
      library/common/include/common.h
  3. 11
      lua/lua.c

6
bspMCU/l_stm32.c

@ -1,10 +1,4 @@
#include "common.h" #include "common.h"
void Rd_lstm32EnableStrong(void)
{
// 用于强符号覆盖的锚点
}
#ifdef USE_LUA_ST #ifdef USE_LUA_ST
#include <unistd.h> #include <unistd.h>
#include "lua_base.h" #include "lua_base.h"

10
library/common/include/common.h

@ -164,9 +164,6 @@ extern void Rd_ThreadEnableStrong(void);
#ifdef BUILD_PLATFORM_WIN32 #ifdef BUILD_PLATFORM_WIN32
extern void Rd_Win32EnableStrong(void); extern void Rd_Win32EnableStrong(void);
#endif #endif
#ifdef BUILD_BSPMCU
extern void Rd_lstm32EnableStrong(void);
#endif
#ifdef BUILD_LOG #ifdef BUILD_LOG
#define INIT_LOG_PART() do { Rd_ElogEnableStrong(); } while(0) #define INIT_LOG_PART() do { Rd_ElogEnableStrong(); } while(0)
@ -186,12 +183,6 @@ extern void Rd_lstm32EnableStrong(void);
#define INIT_WIN32_PART() do {} while(0) #define INIT_WIN32_PART() do {} while(0)
#endif #endif
#ifdef BUILD_BSPMCU
#define INIT_BSPMCU_PART() do { Rd_lstm32EnableStrong(); } while(0)
#else
#define INIT_BSPMCU_PART() do {} while(0)
#endif
#define RD_INIT() \ #define RD_INIT() \
do { \ do { \
INIT_LOG_PART(); \ INIT_LOG_PART(); \
@ -199,7 +190,6 @@ extern void Rd_lstm32EnableStrong(void);
Rd_MemPoolInit_Auto(); \ Rd_MemPoolInit_Auto(); \
INIT_LINUX_PART(); \ INIT_LINUX_PART(); \
INIT_WIN32_PART(); \ INIT_WIN32_PART(); \
INIT_BSPMCU_PART(); \
} while(0) } while(0)
#endif /* end of include guard: COMMON_H */ #endif /* end of include guard: COMMON_H */

11
lua/lua.c

@ -395,12 +395,7 @@ static char *readline(const char *_pcPrompt, char *_pcBuffer, int _iSize, int _i
return NULL; return NULL;
} }
WEAK int luaopen_stm32(lua_State *L) extern int luaopen_stm32(lua_State *L);
{
lua_newtable(L);
lua_setglobal(L, "st");
return 1;
}
int lua_init(lua_output _lua_print) int lua_init(lua_output _lua_print)
{ {
@ -445,9 +440,9 @@ int lua_init(lua_output _lua_print)
return RD_FAILURE; return RD_FAILURE;
} }
luaL_openlibs(L); luaL_openlibs(L);
#ifdef USE_LUA_ST
luaopen_stm32(L); luaopen_stm32(L);
#endif
lua_print("Lua REPL V5.4\nType 'exit' or Ctrl+D to quit.\n\n"); lua_print("Lua REPL V5.4\nType 'exit' or Ctrl+D to quit.\n\n");
lua_print("%s", incomplete ? CONT_PROMPT : PROMPT); lua_print("%s", incomplete ? CONT_PROMPT : PROMPT);
return 0; return 0;

Loading…
Cancel
Save