1 /*
2 * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * This file provides a simple version of _esp_error_check_failed which is used on Linux target.
7 * For chip targets, esp_system component provides an implementation which uses esp_rom_printf and
8 * takes the possibility of the cache being disabled into account.
9 */
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include "esp_err.h"
13 #include "sdkconfig.h"
14
_esp_error_check_failed(esp_err_t rc,const char * file,int line,const char * function,const char * expression)15 void _esp_error_check_failed(esp_err_t rc, const char *file, int line, const char *function, const char *expression)
16 {
17 printf("ESP_ERROR_CHECK failed: esp_err_t 0x%x", rc);
18 #ifdef CONFIG_ESP_ERR_TO_NAME_LOOKUP
19 printf(" (%s)", esp_err_to_name(rc));
20 #endif //CONFIG_ESP_ERR_TO_NAME_LOOKUP
21 printf(" at %p\n", __builtin_return_address(0));
22 printf("file: \"%s\" line %d\nfunc: %s\nexpression: %s\n", file, line, function, expression);
23 abort();
24 }
25