app_error_weak.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* Copyright (c) 2016 Nordic Semiconductor. All Rights Reserved.
  2. *
  3. * The information contained herein is property of Nordic Semiconductor ASA.
  4. * Terms and conditions of usage are described in detail in NORDIC
  5. * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
  6. *
  7. * Licensees are granted free, non-transferable use of the information. NO
  8. * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
  9. * the file.
  10. *
  11. */
  12. #include "app_error.h"
  13. #ifdef DEBUG
  14. #include "bsp.h"
  15. #endif
  16. /*lint -save -e14 */
  17. /**
  18. * Function is implemented as weak so that it can be overwritten by custom application error handler
  19. * when needed.
  20. */
  21. __WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)
  22. {
  23. // On assert, the system can only recover with a reset.
  24. #ifndef DEBUG
  25. //NRF_LOG_PRINTF("System reset\r\n");
  26. NVIC_SystemReset();
  27. #else
  28. #ifdef BSP_DEFINES_ONLY
  29. LEDS_ON(LEDS_MASK);
  30. #else
  31. //UNUSED_VARIABLE(bsp_indication_set(BSP_INDICATE_FATAL_ERROR));
  32. //This call can be used for debug purposes during application development.
  33. // @note CAUTION: Activating this code will write the stack to flash on an error.
  34. // This function should NOT be used in a final product.
  35. // It is intended STRICTLY for development/debugging purposes.
  36. // The flash write will happen EVEN if the radio is active, thus interrupting
  37. // any communication.
  38. // Use with care. Uncomment the line below to use.
  39. //ble_debug_assert_handler(error_code, line_num, p_file_name);
  40. #endif // BSP_DEFINES_ONLY
  41. app_error_save_and_stop(id, pc, info);
  42. #endif // DEBUG
  43. }
  44. /*lint -restore */