From 7b40c58d7985c1011a216c9fb00224a5c8353517 Mon Sep 17 00:00:00 2001 From: Andrey Date: Mon, 10 Jun 2024 21:22:56 -0400 Subject: [PATCH] compile-time enforcement of printf strings only:uaefi --- .../actuators/electronic_throttle.cpp | 2 +- firmware/controllers/core/error_handling.cpp | 20 +++++++++---------- firmware/controllers/settings.cpp | 5 +++-- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/firmware/controllers/actuators/electronic_throttle.cpp b/firmware/controllers/actuators/electronic_throttle.cpp index 19ffc94cb4..1a32df1279 100644 --- a/firmware/controllers/actuators/electronic_throttle.cpp +++ b/firmware/controllers/actuators/electronic_throttle.cpp @@ -1029,7 +1029,7 @@ void initElectronicThrottle() { efiPrintf("TPS=%.2f", Sensor::getOrZero(SensorType::Tps1)); efiPrintf("ETB1 duty=%.2f", - engine->outputChannels.etb1DutyCycle); + (float)engine->outputChannels.etb1DutyCycle); efiPrintf("ETB freq=%d", engineConfiguration->etbFreq); diff --git a/firmware/controllers/core/error_handling.cpp b/firmware/controllers/core/error_handling.cpp index c151bc109d..6b63c35ced 100644 --- a/firmware/controllers/core/error_handling.cpp +++ b/firmware/controllers/core/error_handling.cpp @@ -41,20 +41,20 @@ void checkLastBootError() { efiPrintf("Last boot had line: %d", sramState->Err.hardLine); efiPrintf("Last boot had check: %d", sramState->Err.check); efiPrintf("Last boot had error: %s", sramState->Err.ErrorString); - efiPrintf("Last boot had hard fault type: %x addr: %x CSFR: %x", sramState->Err.FaultType, sramState->Err.FaultAddress, sramState->Err.Csfr); + efiPrintf("Last boot had hard fault type: %lx addr: %lx CSFR: %lx", sramState->Err.FaultType, sramState->Err.FaultAddress, sramState->Err.Csfr); if (engineConfiguration->rethrowHardFault) { - criticalError("Last boot had hard fault type: %x addr: %x CSFR: %x", sramState->Err.FaultType, sramState->Err.FaultAddress, sramState->Err.Csfr); + criticalError("Last boot had hard fault type: %lx addr: %lx CSFR: %lx", sramState->Err.FaultType, sramState->Err.FaultAddress, sramState->Err.Csfr); } auto ctx = &sramState->Err.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); + efiPrintf("r0 0x%lx", ctx->r0); + efiPrintf("r1 0x%lx", ctx->r1); + efiPrintf("r2 0x%lx", ctx->r2); + efiPrintf("r3 0x%lx", ctx->r3); + efiPrintf("r12 0x%lx", ctx->r12); + efiPrintf("lr (thread) 0x%lx", ctx->lr_thd); + efiPrintf("pc 0x%lx", ctx->pc); + efiPrintf("xpsr 0x%lx", ctx->xpsr); /* FPU registers - not very usefull for debug */ if (0) { diff --git a/firmware/controllers/settings.cpp b/firmware/controllers/settings.cpp index 8d21a01cc0..158b7bc6f6 100644 --- a/firmware/controllers/settings.cpp +++ b/firmware/controllers/settings.cpp @@ -90,8 +90,9 @@ static void printOutputs() { void printConfiguration() { efiPrintf("Template %s/%d trigger %s/%s/%d", getEngine_type_e(engineConfiguration->engineType), - engineConfiguration->engineType, getTrigger_type_e(engineConfiguration->trigger.type), - getEngine_load_mode_e(engineConfiguration->fuelAlgorithm), engineConfiguration->fuelAlgorithm); + (int)engineConfiguration->engineType, + getTrigger_type_e(engineConfiguration->trigger.type), + getEngine_load_mode_e(engineConfiguration->fuelAlgorithm), (int)engineConfiguration->fuelAlgorithm); efiPrintf("configurationVersion=%d", engine->getGlobalConfigurationVersion());