Lua on f407, try again (#2725)

* lua on f4

* move perf trace to efifeatures

* check that it's defined

* cypress and kinetis

* it would help to define the correct thing

* disable buffer if not used

* we can work with 2k

* turn off ramdisk on mre qc

* wow strncpy is useless for truncated strings

* turn off for bootloader

* lto bootloader

* memory

* memory
This commit is contained in:
Matthew Kennedy 2021-05-20 13:05:18 -07:00 committed by GitHub
parent b398d03f5f
commit 20cef63d32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 29 additions and 25 deletions

View File

@ -14,7 +14,7 @@ endif
# disable some modules to shrink bootloader binary # disable some modules to shrink bootloader binary
DDEFS += -DEFI_BOOTLOADER DDEFS += -DEFI_BOOTLOADER
DDEFS += -DHAL_USE_EXT=FALSE -DHAL_USE_ICU=FALSE -DHAL_USE_PWM=FALSE -DHAL_USE_RTC=FALSE DDEFS += -DHAL_USE_EXT=FALSE -DHAL_USE_ICU=FALSE -DHAL_USE_PWM=FALSE -DHAL_USE_RTC=FALSE -DEF_LUA=FALSE
#disable ChibiOS flsah driver and prevent header from include #disable ChibiOS flsah driver and prevent header from include
DDEFS += -DHAL_USE_FLASH=FALSE DDEFS += -DHAL_USE_FLASH=FALSE
@ -62,7 +62,7 @@ endif
# Enable this if you want link time optimizations (LTO) # Enable this if you want link time optimizations (LTO)
ifeq ($(USE_LTO),) ifeq ($(USE_LTO),)
USE_LTO = no USE_LTO = yes
endif endif
# If enabled, this option allows to compile the application in THUMB mode. # If enabled, this option allows to compile the application in THUMB mode.

View File

@ -740,10 +740,6 @@
/* Port-specific settings (override port settings defaulted in chcore.h). */ /* Port-specific settings (override port settings defaulted in chcore.h). */
/*===========================================================================*/ /*===========================================================================*/
#undef ENABLE_PERF_TRACE
#define ENABLE_PERF_TRACE FALSE
#define TRACE_BUFFER_LENGTH 1
#endif /* CHCONF_H */ #endif /* CHCONF_H */
/** @} */ /** @} */

View File

@ -377,6 +377,7 @@
#define EFI_UART_ECHO_TEST_MODE FALSE #define EFI_UART_ECHO_TEST_MODE FALSE
#define EXTREME_TERM_LOGGING FALSE #define EXTREME_TERM_LOGGING FALSE
#define EFI_PRINTF_FUEL_DETAILS FALSE #define EFI_PRINTF_FUEL_DETAILS FALSE
#define ENABLE_PERF_TRACE FALSE
#define RAM_UNUSED_SIZE 1 #define RAM_UNUSED_SIZE 1
#define CCM_UNUSED_SIZE 1 #define CCM_UNUSED_SIZE 1

View File

@ -741,10 +741,6 @@
/* Port-specific settings (override port settings defaulted in chcore.h). */ /* Port-specific settings (override port settings defaulted in chcore.h). */
/*===========================================================================*/ /*===========================================================================*/
#undef ENABLE_PERF_TRACE
#define ENABLE_PERF_TRACE FALSE
#define TRACE_BUFFER_LENGTH 1
#endif /* CHCONF_H */ #endif /* CHCONF_H */
/** @} */ /** @} */

View File

@ -343,6 +343,7 @@
#define EFI_UART_ECHO_TEST_MODE FALSE #define EFI_UART_ECHO_TEST_MODE FALSE
#define EXTREME_TERM_LOGGING FALSE #define EXTREME_TERM_LOGGING FALSE
#define EFI_PRINTF_FUEL_DETAILS FALSE #define EFI_PRINTF_FUEL_DETAILS FALSE
#define ENABLE_PERF_TRACE FALSE
#define RAM_UNUSED_SIZE 1 #define RAM_UNUSED_SIZE 1
#define CCM_UNUSED_SIZE 1 #define CCM_UNUSED_SIZE 1

View File

@ -2,7 +2,7 @@
export PROJECT_BOARD=microrusefi export PROJECT_BOARD=microrusefi
export PROJECT_CPU=ARCH_STM32F4 export PROJECT_CPU=ARCH_STM32F4
export EXTRA_PARAMS="-DHW_CHECK_MODE=TRUE -DANALOG_HW_CHECK_MODE=TRUE -DHW_CHECK_ALAWAYS_STIMULATE=TRUE -DSHORT_BOARD_NAME=mre_f4" export EXTRA_PARAMS="-DHW_CHECK_MODE=TRUE -DANALOG_HW_CHECK_MODE=TRUE -DHW_CHECK_ALAWAYS_STIMULATE=TRUE -DSHORT_BOARD_NAME=mre_f4 -DRAMDISK_INVALID"
export DEFAULT_ENGINE_TYPE=-DDEFAULT_ENGINE_TYPE=MRE_BOARD_NEW_TEST export DEFAULT_ENGINE_TYPE=-DDEFAULT_ENGINE_TYPE=MRE_BOARD_NEW_TEST

View File

@ -264,12 +264,17 @@
// F42x has more memory, so we can: // F42x has more memory, so we can:
// - use compressed USB MSD image (requires 32k of memory) // - use compressed USB MSD image (requires 32k of memory)
// - use Lua interpreter (requires ~20k of memory) // - use perf trace (requires ~16k of memory)
#ifdef EFI_IS_F42x #ifdef EFI_IS_F42x
#define EFI_USE_COMPRESSED_INI_MSD #define EFI_USE_COMPRESSED_INI_MSD
#define EFI_LUA TRUE #define ENABLE_PERF_TRACE TRUE
#else #else
#define EFI_LUA FALSE // small memory F40x can't fit perf trace
#define ENABLE_PERF_TRACE FALSE
#endif
#ifndef EFI_LUA
#define EFI_LUA TRUE
#endif #endif
#ifndef EFI_ENGINE_SNIFFER #ifndef EFI_ENGINE_SNIFFER

View File

@ -53,5 +53,5 @@
#define EFI_USE_COMPRESSED_INI_MSD #define EFI_USE_COMPRESSED_INI_MSD
#undef EFI_LUA #undef ENABLE_PERF_TRACE
#define EFI_LUA TRUE #define ENABLE_PERF_TRACE TRUE

View File

@ -32,5 +32,5 @@
// H7 has dual bank, so flash on its own (low priority) thread so as to not block any other operations // H7 has dual bank, so flash on its own (low priority) thread so as to not block any other operations
#define EFI_FLASH_WRITE_THREAD TRUE #define EFI_FLASH_WRITE_THREAD TRUE
#undef EFI_LUA #undef ENABLE_PERF_TRACE
#define EFI_LUA TRUE #define ENABLE_PERF_TRACE TRUE

View File

@ -702,7 +702,7 @@ void initEngineContoller(DECLARE_ENGINE_PARAMETER_SUFFIX) {
* UNUSED_SIZE constants. * UNUSED_SIZE constants.
*/ */
#ifndef RAM_UNUSED_SIZE #ifndef RAM_UNUSED_SIZE
#define RAM_UNUSED_SIZE 5900 #define RAM_UNUSED_SIZE 1800
#endif #endif
#ifndef CCM_UNUSED_SIZE #ifndef CCM_UNUSED_SIZE
#define CCM_UNUSED_SIZE 300 #define CCM_UNUSED_SIZE 300

View File

@ -276,7 +276,8 @@ void startLua() {
return; return;
} }
strncpy(interactiveCmd, str, sizeof(interactiveCmd)); strncpy(interactiveCmd, str, sizeof(interactiveCmd) - 1);
interactiveCmd[sizeof(interactiveCmd) - 1] = '\0';
interactivePending = true; interactivePending = true;
}); });

View File

@ -12,11 +12,20 @@
#include "efitime.h" #include "efitime.h"
#include "os_util.h" #include "os_util.h"
#ifndef ENABLE_PERF_TRACE
#error ENABLE_PERF_TRACE must be defined!
#endif
#ifndef TRACE_BUFFER_LENGTH #ifndef TRACE_BUFFER_LENGTH
#define TRACE_BUFFER_LENGTH 2048 #define TRACE_BUFFER_LENGTH 2048
#endif /* TRACE_BUFFER_LENGTH */ #endif /* TRACE_BUFFER_LENGTH */
// Disable the buffer if we're not enabled at all
#if !ENABLE_PERF_TRACE
#undef TRACE_BUFFER_LENGTH
#define TRACE_BUFFER_LENGTH 1
#endif
enum class EPhase : char enum class EPhase : char
{ {
Start, Start,

View File

@ -16,11 +16,6 @@
#define CHPRINTF_USE_FLOAT TRUE #define CHPRINTF_USE_FLOAT TRUE
#if !defined(ENABLE_PERF_TRACE) || defined(__DOXYGEN__)
// looks like this value could not be defined in efifeatures.h - please define either externally or just change the value here
#define ENABLE_PERF_TRACE TRUE
#endif /* ENABLE_PERF_TRACE */
#if !defined(_FROM_ASM_) #if !defined(_FROM_ASM_)
#include "obd_error_codes.h" #include "obd_error_codes.h"
#endif /* _FROM_ASM_ */ #endif /* _FROM_ASM_ */