From 9c9f6f300946281b1eec7e5e9afab906f39b8253 Mon Sep 17 00:00:00 2001 From: rusefi Date: Wed, 14 Jun 2023 18:40:03 -0400 Subject: [PATCH] backup RAM error code integration with TS #5325 --- firmware/config/engines/hyundai.cpp | 1 + firmware/controllers/core/error_handling.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/firmware/config/engines/hyundai.cpp b/firmware/config/engines/hyundai.cpp index b9a48a10de..a1940f476a 100644 --- a/firmware/config/engines/hyundai.cpp +++ b/firmware/config/engines/hyundai.cpp @@ -50,6 +50,7 @@ void setHyundaiPb() { engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS; engineConfiguration->hpfpCamLobes = 4; + engineConfiguration->rethrowHardFault = true; engineConfiguration->highPressureFuel.v1 = 0.5; /* volts */; engineConfiguration->highPressureFuel.value1 = 0; diff --git a/firmware/controllers/core/error_handling.cpp b/firmware/controllers/core/error_handling.cpp index c77b26e02b..81806cd3ea 100644 --- a/firmware/controllers/core/error_handling.cpp +++ b/firmware/controllers/core/error_handling.cpp @@ -34,6 +34,9 @@ void checkLastBootError() { break; case ErrorCookie::HardFault: { efiPrintf("Last boot had hard fault type: %x addr: %x CSFR: %x", sramState->FaultType, sramState->FaultAddress, sramState->Csfr); + if (engineConfiguration->rethrowHardFault) { + firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Last boot had hard fault type: %x addr: %x CSFR: %x", sramState->FaultType, sramState->FaultAddress, sramState->Csfr); + } // Print out the context as a sequence of uintptr uintptr_t* data = reinterpret_cast(&sramState->FaultCtx);