From 7ea020c30c5da9f809f5ef0b7876369325f27eb8 Mon Sep 17 00:00:00 2001 From: Andrey G Date: Sat, 1 Jul 2023 18:47:42 +0300 Subject: [PATCH] Last Boot Error: show register names (#5364) --- firmware/controllers/core/error_handling.cpp | 21 ++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/firmware/controllers/core/error_handling.cpp b/firmware/controllers/core/error_handling.cpp index 1d3a8b96d9..d3fbd92308 100644 --- a/firmware/controllers/core/error_handling.cpp +++ b/firmware/controllers/core/error_handling.cpp @@ -39,10 +39,23 @@ void checkLastBootError() { 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); - for (size_t i = 0; i < sizeof(port_extctx) / sizeof(uintptr_t); i++) { - efiPrintf("Fault ctx %d: %x", i, data[i]); + auto ctx = &sramState->FaultCtx; + efiPrintf("r0 0x%x", ctx->r0); + efiPrintf("r1 0x%x", ctx->r1); + efiPrintf("r2 0x%x", ctx->r2); + efiPrintf("r3 0x%x", ctx->r3); + efiPrintf("r12 0x%x", ctx->r12); + efiPrintf("lr (thread) 0x%x", ctx->lr_thd); + efiPrintf("pc 0x%x", ctx->pc); + efiPrintf("xpsr 0x%x", ctx->xpsr); + + /* FPU registers - not very usefull for debug */ + if (0) { + // Print rest the context as a sequence of uintptr + uintptr_t* data = reinterpret_cast(&sramState->FaultCtx); + for (size_t i = 8; i < sizeof(port_extctx) / sizeof(uintptr_t); i++) { + efiPrintf("Fault ctx %d: %x", i, data[i]); + } } break;