use static buffer for lua heap, enable on f429 (#2619)

* static buffer for lua

* enable lua for 429
This commit is contained in:
Matthew Kennedy 2021-05-04 00:03:17 -05:00 committed by GitHub
parent d6fc3f9a01
commit a62b7bedb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -44,8 +44,6 @@
#define SC_BUFFER_SIZE 4000
#endif
#define EFI_LUA FALSE
/**
* if you have a 60-2 trigger, or if you just want better performance, you
* probably want EFI_ENABLE_ASSERTS to be FALSE. Also you would probably want to FALSE
@ -264,9 +262,14 @@
#define EFI_CONSOLE_USB_DEVICE SDU1
// F42x has more memory, so we can use compressed USB MSD image (requires 32k of memory)
// F42x has more memory, so we can:
// - use compressed USB MSD image (requires 32k of memory)
// - use Lua interpreter (requires ~20k of memory)
#ifdef EFI_IS_F42x
#define EFI_USE_COMPRESSED_INI_MSD
#define EFI_USE_COMPRESSED_INI_MSD
#define EFI_LUA TRUE
#else
#define EFI_LUA FALSE
#endif
#ifndef EFI_ENGINE_SNIFFER

View File

@ -191,9 +191,10 @@ struct LuaThread : ThreadController<4096> {
void ThreadTask() override;
};
static char luaHeap[LUA_HEAP_SIZE];
void LuaThread::ThreadTask() {
void* buf = malloc(LUA_HEAP_SIZE);
chHeapObjectInit(&heap, buf, LUA_HEAP_SIZE);
chHeapObjectInit(&heap, &luaHeap, sizeof(luaHeap));
auto ls = setupLuaState();