|
45 | 45 | } \
|
46 | 46 | }
|
47 | 47 |
|
| 48 | +#ifndef NDEBUG |
| 49 | +#define ERROR_REPORT(ctx, error_msg) print_error_report(ctx, error_msg) |
| 50 | +#else |
| 51 | +#define ERROR_REPORT(ctx, error_msg) ((void) 0) |
| 52 | +#endif |
48 | 53 |
|
49 | 54 | static uint8_t error_in_progress = 0;
|
50 | 55 | static int error_count = 0;
|
@@ -78,7 +83,7 @@ WEAK void error(const char *format, ...)
|
78 | 83 |
|
79 | 84 | //Call handle_error/print_error_report permanently setting error_in_progress flag
|
80 | 85 | handle_error(MBED_ERROR_UNKNOWN, 0, NULL, 0);
|
81 |
| - print_error_report(&last_error_ctx, "Fatal Run-time error"); |
| 86 | + ERROR_REPORT(&last_error_ctx, "Fatal Run-time error"); |
82 | 87 | error_in_progress = 1;
|
83 | 88 |
|
84 | 89 | #ifndef NDEBUG
|
@@ -200,7 +205,7 @@ WEAK mbed_error_status_t mbed_error(mbed_error_status_t error_status, const char
|
200 | 205 | }
|
201 | 206 |
|
202 | 207 | //On fatal errors print the error context/report
|
203 |
| - print_error_report(&last_error_ctx, error_msg); |
| 208 | + ERROR_REPORT(&last_error_ctx, error_msg); |
204 | 209 | mbed_halt_system();
|
205 | 210 |
|
206 | 211 | return MBED_ERROR_FAILED_OPERATION;
|
@@ -302,6 +307,7 @@ static void print_threads_info(osRtxThread_t *threads)
|
302 | 307 | }
|
303 | 308 | #endif
|
304 | 309 |
|
| 310 | +#ifndef NDEBUG |
305 | 311 | static void print_error_report(mbed_error_ctx *ctx, const char *error_msg)
|
306 | 312 | {
|
307 | 313 | uint32_t error_code = MBED_GET_ERROR_CODE(ctx->error_status);
|
@@ -386,6 +392,7 @@ static void print_error_report(mbed_error_ctx *ctx, const char *error_msg)
|
386 | 392 |
|
387 | 393 | mbed_error_printf("\n-- MbedOS Error Info --\n");
|
388 | 394 | }
|
| 395 | +#endif //ifndef NDEBUG |
389 | 396 |
|
390 | 397 | #if MBED_CONF_PLATFORM_ERROR_HIST_ENABLED
|
391 | 398 | //Retrieve the error context from error log at the specified index
|
|
0 commit comments