CI instability: FATAL error: warn stream not initialized for 6039
also some refactoring fix #798
This commit is contained in:
parent
ce37530844
commit
36a8cf8ad4
|
@ -181,8 +181,13 @@ void onUnlockHook(void) {
|
||||||
|
|
||||||
#endif /* EFI_CLOCK_LOCKS */
|
#endif /* EFI_CLOCK_LOCKS */
|
||||||
|
|
||||||
|
/**
|
||||||
void initErrorHandling(void) {
|
* This method should be invoked really early in firmware initialization cycle.
|
||||||
|
*
|
||||||
|
* Implementation can only do trivial things like changing memory state. No hardware or OS access allowed
|
||||||
|
* within this method.
|
||||||
|
*/
|
||||||
|
void initErrorHandlingDataStructures(void) {
|
||||||
#if EFI_SIMULATOR || EFI_PROD_CODE
|
#if EFI_SIMULATOR || EFI_PROD_CODE
|
||||||
msObjectInit(&warningStream, (uint8_t *) warningBuffer, WARNING_BUFFER_SIZE, 0);
|
msObjectInit(&warningStream, (uint8_t *) warningBuffer, WARNING_BUFFER_SIZE, 0);
|
||||||
msObjectInit(&firmwareErrorMessageStream, errorMessageBuffer, sizeof(errorMessageBuffer), 0);
|
msObjectInit(&firmwareErrorMessageStream, errorMessageBuffer, sizeof(errorMessageBuffer), 0);
|
||||||
|
|
|
@ -38,7 +38,7 @@ EXTERNC void firmwareError(obd_code_e code, const char *fmt, ...);
|
||||||
// todo: rename to getFatalErrorMessage
|
// todo: rename to getFatalErrorMessage
|
||||||
char *getFirmwareError(void);
|
char *getFirmwareError(void);
|
||||||
|
|
||||||
void initErrorHandling(void);
|
void initErrorHandlingDataStructures(void);
|
||||||
// todo: rename to getWarningMessage?
|
// todo: rename to getWarningMessage?
|
||||||
char *getWarning(void);
|
char *getWarning(void);
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
EXTERN_ENGINE;
|
EXTERN_ENGINE;
|
||||||
|
|
||||||
void baseHardwareInit(void) {
|
void baseMCUInit(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void _unhandled_exception(void) {
|
void _unhandled_exception(void) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ BOR_Result_t BOR_Set(BOR_Level_t BORValue);
|
||||||
#define SPI_CR1_24BIT_MODE 0
|
#define SPI_CR1_24BIT_MODE 0
|
||||||
#define SPI_CR2_24BIT_MODE 0
|
#define SPI_CR2_24BIT_MODE 0
|
||||||
|
|
||||||
void baseHardwareInit(void);
|
void baseMCUInit(void);
|
||||||
void turnOnSpi(spi_device_e device);
|
void turnOnSpi(spi_device_e device);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -22,7 +22,7 @@ typedef enum {
|
||||||
BOR_Level_t BOR_Get(void);
|
BOR_Level_t BOR_Get(void);
|
||||||
BOR_Result_t BOR_Set(BOR_Level_t BORValue);
|
BOR_Result_t BOR_Set(BOR_Level_t BORValue);
|
||||||
|
|
||||||
void baseHardwareInit(void);
|
void baseMCUInit(void);
|
||||||
void turnOnSpi(spi_device_e device);
|
void turnOnSpi(spi_device_e device);
|
||||||
void jump_to_bootloader();
|
void jump_to_bootloader();
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
#define EFI_CAN_RX_AF 9
|
#define EFI_CAN_RX_AF 9
|
||||||
#define EFI_CAN_TX_AF 9
|
#define EFI_CAN_TX_AF 9
|
||||||
|
|
||||||
#define baseHardwareInit() {}
|
#define baseMCUInit() {}
|
||||||
|
|
||||||
#endif /* MPU_UTIL_H_ */
|
#endif /* MPU_UTIL_H_ */
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
#define baseHardwareInit() {}
|
#define baseMCUInit() {}
|
||||||
|
|
||||||
void initSpiCs(SPIConfig *spiConfig, brain_pin_e csPin);
|
void initSpiCs(SPIConfig *spiConfig, brain_pin_e csPin);
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ EXTERNC int getRemainingStack(thread_t *otp) {
|
||||||
|
|
||||||
#endif /* GNU / IAR */
|
#endif /* GNU / IAR */
|
||||||
|
|
||||||
void baseHardwareInit(void) {
|
void baseMCUInit(void) {
|
||||||
// looks like this holds a random value on start? Let's set a nice clean zero
|
// looks like this holds a random value on start? Let's set a nice clean zero
|
||||||
DWT->CYCCNT = 0;
|
DWT->CYCCNT = 0;
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ EXTERNC int getRemainingStack(thread_t *otp) {
|
||||||
|
|
||||||
#endif /* GNU / IAR */
|
#endif /* GNU / IAR */
|
||||||
|
|
||||||
void baseHardwareInit(void) {
|
void baseMCUInit(void) {
|
||||||
// looks like this holds a random value on start? Let's set a nice clean zero
|
// looks like this holds a random value on start? Let's set a nice clean zero
|
||||||
DWT->CYCCNT = 0;
|
DWT->CYCCNT = 0;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,10 @@ int main(void) {
|
||||||
halInit();
|
halInit();
|
||||||
chSysInit();
|
chSysInit();
|
||||||
|
|
||||||
baseHardwareInit();
|
/**
|
||||||
|
* most basic MCU initialization - no configuration access, no external hardware access
|
||||||
|
*/
|
||||||
|
baseMCUInit();
|
||||||
|
|
||||||
runRusEfi();
|
runRusEfi();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -162,11 +162,11 @@ static void scheduleReboot(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void runRusEfi(void) {
|
void runRusEfi(void) {
|
||||||
|
initErrorHandlingDataStructures();
|
||||||
efiAssertVoid(CUSTOM_RM_STACK_1, getCurrentRemainingStack() > 512, "init s");
|
efiAssertVoid(CUSTOM_RM_STACK_1, getCurrentRemainingStack() > 512, "init s");
|
||||||
assertEngineReference();
|
assertEngineReference();
|
||||||
engine->setConfig(config);
|
engine->setConfig(config);
|
||||||
initIntermediateLoggingBuffer();
|
initIntermediateLoggingBuffer();
|
||||||
initErrorHandling();
|
|
||||||
addConsoleAction(CMD_REBOOT, scheduleReboot);
|
addConsoleAction(CMD_REBOOT, scheduleReboot);
|
||||||
addConsoleAction(CMD_REBOOT_DFU, jump_to_bootloader);
|
addConsoleAction(CMD_REBOOT_DFU, jump_to_bootloader);
|
||||||
|
|
||||||
|
|
|
@ -92,12 +92,12 @@ static void runChprintfTest() {
|
||||||
|
|
||||||
void rusEfiFunctionalTest(void) {
|
void rusEfiFunctionalTest(void) {
|
||||||
printToConsole("Running rusEfi simulator version:");
|
printToConsole("Running rusEfi simulator version:");
|
||||||
|
initErrorHandlingDataStructures();
|
||||||
static char versionBuffer[20];
|
static char versionBuffer[20];
|
||||||
itoa10(versionBuffer, (int)getRusEfiVersion());
|
itoa10(versionBuffer, (int)getRusEfiVersion());
|
||||||
printToConsole(versionBuffer);
|
printToConsole(versionBuffer);
|
||||||
|
|
||||||
initIntermediateLoggingBuffer();
|
initIntermediateLoggingBuffer();
|
||||||
initErrorHandling();
|
|
||||||
|
|
||||||
engine->setConfig(config);
|
engine->setConfig(config);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue