From a76f2e738041ad3709e3a2f0cb5de6a27640013e Mon Sep 17 00:00:00 2001 From: rusefillc Date: Tue, 14 Jan 2025 08:12:46 -0500 Subject: [PATCH] hellen: please no calls to OS code on possible hardFault paths only:uaefi --- firmware/config/boards/hellen/hellen_common.cpp | 6 ++++++ firmware/config/boards/hellen_meta.h | 1 + firmware/controllers/system/efi_gpio.cpp | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/firmware/config/boards/hellen/hellen_common.cpp b/firmware/config/boards/hellen/hellen_common.cpp index c543e8c8f6..740422bb19 100644 --- a/firmware/config/boards/hellen/hellen_common.cpp +++ b/firmware/config/boards/hellen/hellen_common.cpp @@ -83,6 +83,12 @@ void hellenEnableEn(const char *msg) { void hellenDisableEn(const char *msg) { efiPrintf("Turning board off [%s]", msg); + hellenDisableEnSilently(); +} + +void hellenDisableEnSilently() { + // this function is called from criticalShutdown() that may be called from hardFault handler + // please no call to OS functions! setHellenEnValue(0); } diff --git a/firmware/config/boards/hellen_meta.h b/firmware/config/boards/hellen_meta.h index 3112b7c5ca..f9519bdd8f 100644 --- a/firmware/config/boards/hellen_meta.h +++ b/firmware/config/boards/hellen_meta.h @@ -20,6 +20,7 @@ bool isBoardWithPowerManagement(); bool getHellenBoardEnabled(); void hellenEnableEn(const char *msg = ""); void hellenDisableEn(const char *msg = ""); +void hellenDisableEnSilently(); // this version is called by fatal error handler meaning no OS access void hellenBoardStandBy(); void hellenMegaSdWithAccelerometer(); diff --git a/firmware/controllers/system/efi_gpio.cpp b/firmware/controllers/system/efi_gpio.cpp index 28d6516ca4..5a66085437 100644 --- a/firmware/controllers/system/efi_gpio.cpp +++ b/firmware/controllers/system/efi_gpio.cpp @@ -847,7 +847,7 @@ void turnAllPinsOff() { enginePins.fuelPumpRelay.setValue(false); enginePins.checkEnginePin.setValue(true); // yes this one can go ON #if EFI_PROD_CODE && HW_HELLEN - hellenDisableEn("fatal"); + hellenDisableEnSilently(); #endif } #endif /* EFI_GPIO_HARDWARE */