From c04cd4eefbdd1fdb86d85e4ce73a2c672286413f Mon Sep 17 00:00:00 2001 From: Senthil Ramakrishnan Date: Wed, 19 Dec 2018 20:19:00 -0600 Subject: [PATCH] Disable printf in crash reporting for release builds --- platform/mbed_error.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform/mbed_error.c b/platform/mbed_error.c index 49f4b8a7eb..9c38322773 100644 --- a/platform/mbed_error.c +++ b/platform/mbed_error.c @@ -211,7 +211,9 @@ mbed_error_status_t mbed_error_initialize(void) if ((report_error_ctx->crc_error_ctx == crc_val) && (report_error_ctx->is_error_processed == 0)) { is_reboot_error_valid = true; //Report the error info +#ifndef NDEBUG printf("\n== The system has been rebooted due to a fatal error. ==\n"); +#endif //Call the mbed_error_reboot_callback, this enables applications to do some handling before we do the handling mbed_error_reboot_callback(report_error_ctx); @@ -223,7 +225,9 @@ mbed_error_status_t mbed_error_initialize(void) #if MBED_CONF_PLATFORM_FATAL_ERROR_AUTO_REBOOT_ENABLED if (report_error_ctx->error_reboot_count >= MBED_CONF_PLATFORM_ERROR_REBOOT_MAX) { //We have rebooted more than enough, hold the system here. +#ifndef NDEBUG printf("\n== Reboot count(=%ld) exceeded maximum, system halting ==\n", report_error_ctx->error_reboot_count); +#endif mbed_halt_system(); } #endif