per-MCU lua size (#3339)

* per-MCU lua size

* simulator happy
This commit is contained in:
Matthew Kennedy 2021-10-09 06:02:30 -07:00 committed by GitHub
parent 4d8c71196f
commit 0419e3489a
4 changed files with 24 additions and 2 deletions

View File

@ -267,9 +267,15 @@
#ifdef EFI_IS_F42x
#define EFI_USE_COMPRESSED_INI_MSD
#define ENABLE_PERF_TRACE TRUE
#define LUA_USER_HEAP 20000
#define LUA_SYSTEM_HEAP 20000
#else
// small memory F40x can't fit perf trace
#define ENABLE_PERF_TRACE FALSE
#define LUA_USER_HEAP 12000
#define LUA_SYSTEM_HEAP 12000
#endif
#ifndef EFI_LUA

View File

@ -57,3 +57,8 @@
// F7 may have dual bank, so flash on its own (low priority) thread so as to not block any other operations
#define EFI_FLASH_WRITE_THREAD TRUE
#undef LUA_USER_HEAP
#define LUA_USER_HEAP 100000
#undef LUA_SYSTEM_HEAP
#define LUA_SYSTEM_HEAP 100000

View File

@ -47,3 +47,8 @@
#undef HAL_VSS_USE_PAL
#define HAL_VSS_USE_PAL TRUE
#undef LUA_USER_HEAP
#define LUA_USER_HEAP 100000
#undef LUA_SYSTEM_HEAP
#define LUA_SYSTEM_HEAP 100000

View File

@ -13,11 +13,11 @@
#if EFI_PROD_CODE || EFI_SIMULATOR
#ifndef LUA_USER_HEAP
#define LUA_USER_HEAP 12000
#define LUA_USER_HEAP 1
#endif // LUA_USER_HEAP
#ifndef LUA_SYSTEM_HEAP
#define LUA_SYSTEM_HEAP 15000
#define LUA_SYSTEM_HEAP 1
#endif // LUA_SYSTEM_HEAP
static char luaUserHeap[LUA_USER_HEAP];
@ -211,6 +211,7 @@ static LuaHandle systemLua;
const char* getSystemLuaScript();
void initSystemLua() {
#if LUA_SYSTEM_HEAP > 1
efiAssertVoid(OBD_PCM_Processor_Fault, !systemLua, "system lua already init");
Timer startTimer;
@ -231,6 +232,7 @@ void initSystemLua() {
#if !EFI_UNIT_TEST
efiPrintf("System Lua loaded in %.2f ms using %d bytes", startTime * 1'000, heaps[1].used());
#endif
#endif
}
#if !EFI_UNIT_TEST
@ -359,9 +361,12 @@ void LuaThread::ThreadTask() {
}
}
#if LUA_USER_HEAP > 1
static LuaThread luaThread;
#endif
void startLua() {
#if LUA_USER_HEAP > 1
luaThread.Start();
addConsoleActionS("lua", [](const char* str){
@ -387,6 +392,7 @@ void startLua() {
efiPrintf("Lua memory heap %d: %d / %d bytes = %.1f%%", i, memoryUsed, heapSize, pct);
}
});
#endif
}
#else // not EFI_UNIT_TEST