esp_err_check_linux.c 933 B

123456789101112131415161718192021222324
  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. void _esp_error_check_failed(esp_err_t rc, const char *file, int line, const char *function, const char *expression)
  15. {
  16. printf("ESP_ERROR_CHECK failed: esp_err_t 0x%x", rc);
  17. #ifdef CONFIG_ESP_ERR_TO_NAME_LOOKUP
  18. printf(" (%s)", esp_err_to_name(rc));
  19. #endif //CONFIG_ESP_ERR_TO_NAME_LOOKUP
  20. printf(" at %p\n", __builtin_return_address(0));
  21. printf("file: \"%s\" line %d\nfunc: %s\nexpression: %s\n", file, line, function, expression);
  22. abort();
  23. }