prep for lua (#2589)

* thread priority

* build

* makefile prep

* call startup

* s
This commit is contained in:
Matthew Kennedy 2021-04-27 04:57:08 -07:00 committed by GitHub
parent 8f06e1c0c6
commit addf97ee08
7 changed files with 55 additions and 5 deletions

View File

@ -365,7 +365,7 @@ UINCDIR =
ULIBDIR =
# List all user libraries here
ULIBS = -lm
ULIBS = -lm --specs=nano.specs
#
# End of user defines

View File

@ -4,6 +4,7 @@ include $(PROJECT_DIR)/controllers/math/math.mk
include $(PROJECT_DIR)/controllers/trigger/trigger.mk
include $(PROJECT_DIR)/controllers/sensors/sensors.mk
include $(PROJECT_DIR)/controllers/system/system.mk
include $(PROJECT_DIR)/controllers/lua/lua.mk
#include $(PROJECT_DIR)/controllers/gauges/gauges.mk
CONTROLLERS_DIR=$(PROJECT_DIR)/controllers

View File

@ -0,0 +1,36 @@
LUA_DIR=$(CONTROLLERS_DIR)/lua
LUA_EXT=$(PROJECT_DIR)/ext/lua
# ALLCPPSRC += $(LUA_DIR)/lua.cpp
ALLINC += $(LUA_DIR) # $(LUA_EXT)/src $(LUA_EXT)/etc
# ALLCSRC += $(LUA_EXT)/src/lapi.c \
# $(LUA_EXT)/src/lcode.c \
# $(LUA_EXT)/src/ldebug.c \
# $(LUA_EXT)/src/ldo.c \
# $(LUA_EXT)/src/ldump.c \
# $(LUA_EXT)/src/lfunc.c \
# $(LUA_EXT)/src/lgc.c \
# $(LUA_EXT)/src/llex.c \
# $(LUA_EXT)/src/lmem.c \
# $(LUA_EXT)/src/lobject.c \
# $(LUA_EXT)/src/lopcodes.c \
# $(LUA_EXT)/src/lparser.c \
# $(LUA_EXT)/src/lstate.c \
# $(LUA_EXT)/src/lstring.c \
# $(LUA_EXT)/src/ltable.c \
# $(LUA_EXT)/src/ltm.c \
# $(LUA_EXT)/src/lundump.c \
# $(LUA_EXT)/src/lvm.c \
# $(LUA_EXT)/src/lzio.c \
# $(LUA_EXT)/src/lrotable.c \
# $(LUA_EXT)/src/lauxlib.c \
# $(LUA_EXT)/src/lbaselib.c \
# $(LUA_EXT)/src/ldblib.c \
# $(LUA_EXT)/src/lmathlib.c \
# $(LUA_EXT)/src/loslib.c \
# $(LUA_EXT)/src/ltablib.c \
# $(LUA_EXT)/src/lstrlib.c \
# $(LUA_EXT)/src/loadlib.c \
# $(LUA_EXT)/src/linit.c \
# $(LUA_EXT)/src/bit.c \
# $(LUA_EXT)/src/modp_numtoa.c \

View File

@ -0,0 +1,5 @@
// This file is not named lua.h as it would collide with firmware/ext/lua/src/lua.h
#pragma once
void startLua();

View File

@ -39,7 +39,10 @@
#define PRIO_HIP9011 (NORMALPRIO - 10)
// These are intentionally low priority so they can't get in the way of anything else
#define PRIO_FLASH_WRITE LOWPRIO
#define PRIO_FLASH_WRITE LOWPRIO + 20
// USB mass storage
#define MSD_THD_PRIO LOWPRIO
#define MSD_THD_PRIO LOWPRIO + 20
// Lua interpreter must be lowest priority, as the user's code may get stuck in an infinite loop
#define PRIO_LUA LOWPRIO + 10

View File

@ -364,7 +364,7 @@
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE FALSE
#define CH_CFG_USE_MEMCORE TRUE
#endif
/**
@ -393,7 +393,7 @@
* @note Mutexes are recommended.
*/
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP FALSE
#define CH_CFG_USE_HEAP TRUE
#endif
/**

View File

@ -127,6 +127,7 @@
#include "mmc_card.h"
#include "mass_storage_init.h"
#include "trigger_emulator_algo.h"
#include "rusefi_lua.h"
#if EFI_HD44780_LCD
#include "lcd_HD44780.h"
@ -228,6 +229,10 @@ void runRusEfi(void) {
enableTriggerStimulator();
#endif // HW_CHECK_ALWAYS_STIMULATE
#if EFI_LUA
startLua();
#endif // EFI_LUA
// Config could be completely bogus - don't start anything else!
if (validateConfig()) {
initStatusLoop();