mirror of https://github.com/ARMmbed/mbed-os.git
Remove printf completely and fix the optimization check
parent
16e544d9b4
commit
cc5969b1ec
|
|
@ -211,24 +211,16 @@ mbed_error_status_t mbed_error_initialize(void)
|
|||
//Read report_error_ctx and check if CRC is correct, and with valid status code
|
||||
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);
|
||||
|
||||
//We let the callback reset the error info, so check if its still valid and do the rest only if its still valid.
|
||||
if (report_error_ctx->error_reboot_count < 0) {
|
||||
if (report_error_ctx->error_reboot_count > 0) {
|
||||
|
||||
//Enforce max-reboot only if auto reboot is enabled
|
||||
#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
|
||||
|
|
@ -300,6 +292,11 @@ WEAK MBED_NORETURN mbed_error_status_t mbed_error(mbed_error_status_t error_stat
|
|||
core_util_critical_section_exit();
|
||||
//We need not call delete_mbed_crc(crc_obj) here as we are going to reset the system anyway, and calling delete while handling a fatal error may cause nested exception
|
||||
#if MBED_CONF_PLATFORM_FATAL_ERROR_AUTO_REBOOT_ENABLED && (MBED_CONF_PLATFORM_ERROR_REBOOT_MAX > 0)
|
||||
mbed_error_printf("\n= System will be rebooted due to a fatal error =\n");
|
||||
if (report_error_ctx->error_reboot_count >= MBED_CONF_PLATFORM_ERROR_REBOOT_MAX) {
|
||||
//We have rebooted more than enough, hold the system here.
|
||||
mbed_error_printf("= Reboot count(=%ld) reached maximum, system will halt after rebooting =\n", report_error_ctx->error_reboot_count);
|
||||
}
|
||||
system_reset();//do a system reset to get the system rebooted
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue