Appiko
app_error.c
1 
19 #include "app_error.h"
20 #include "nrf.h"
21 
22 
23 #ifdef DEBUG
24 
25 #include "log.h"
26 #include "stdnoreturn.h"
27 
28 noreturn void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name)
29 {
30  // This call can be used for ONLY debug purposes during application development.
31  log_printf("Error of 0x%X at %d in %s\n", error_code, line_num, p_file_name);
32 
33  // On error, the system can only recover with a reset.
34  NVIC_SystemReset();
35  for(;;);
36 }
37 
38 noreturn void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)
39 {
40  // This call can be used for ONLY debug purposes during application development.
41  log_printf("Error of 0x%X ID at 0x%X PC with 0x%X info\n", id, pc, info);
42 
43  // On error, the system can only recover with a reset.
44  NVIC_SystemReset();
45  for(;;);
46 }
47 
48 #else
49 
50 void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name)
51 {
52 
53 }
54 
55 void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)
56 {
57 
58 }
59 
60 #endif /* DEBUG flag as compiler flag */
void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)
Callback to be invoked in case of fault i.e. unrecoverable errors occurring within the application or...
Definition: app_error.c:55
void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t *p_file_name)
Function called when an error occurs. If DEBUG flag is present the error information is printed on lo...
Definition: app_error.c:50