mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-09 12:35:28 +00:00
esp32: Add macro to check a condition without abort
Closes https://github.com/espressif/esp-idf/issues/2325
This commit is contained in:
@@ -663,9 +663,9 @@ void esp_clear_watchpoint(int no)
|
||||
}
|
||||
}
|
||||
|
||||
void _esp_error_check_failed(esp_err_t rc, const char *file, int line, const char *function, const char *expression)
|
||||
static void esp_error_check_failed_print(const char *msg, esp_err_t rc, const char *file, int line, const char *function, const char *expression)
|
||||
{
|
||||
ets_printf("ESP_ERROR_CHECK failed: esp_err_t 0x%x", rc);
|
||||
ets_printf("%s failed: esp_err_t 0x%x", msg, rc);
|
||||
#ifdef CONFIG_ESP_ERR_TO_NAME_LOOKUP
|
||||
ets_printf(" (%s)", esp_err_to_name(rc));
|
||||
#endif //CONFIG_ESP_ERR_TO_NAME_LOOKUP
|
||||
@@ -673,5 +673,15 @@ void _esp_error_check_failed(esp_err_t rc, const char *file, int line, const cha
|
||||
if (spi_flash_cache_enabled()) { // strings may be in flash cache
|
||||
ets_printf("file: \"%s\" line %d\nfunc: %s\nexpression: %s\n", file, line, function, expression);
|
||||
}
|
||||
}
|
||||
|
||||
void _esp_error_check_failed_without_abort(esp_err_t rc, const char *file, int line, const char *function, const char *expression)
|
||||
{
|
||||
esp_error_check_failed_print("ESP_ERROR_CHECK_WITHOUT_ABORT", rc, file, line, function, expression);
|
||||
}
|
||||
|
||||
void _esp_error_check_failed(esp_err_t rc, const char *file, int line, const char *function, const char *expression)
|
||||
{
|
||||
esp_error_check_failed_print("ESP_ERROR_CHECK", rc, file, line, function, expression);
|
||||
invoke_abort();
|
||||
}
|
||||
|
Reference in New Issue
Block a user