diff --git a/cpu/stm32f0/include/cpu-conf.h b/cpu/stm32f0/include/cpu-conf.h index a0d7a4cde1b8b0fc6af835c2a0afd8c7a38db281..57ee512fe232ce2a18efc341f72a6107cc8e14cf 100644 --- a/cpu/stm32f0/include/cpu-conf.h +++ b/cpu/stm32f0/include/cpu-conf.h @@ -63,6 +63,15 @@ extern "C" { */ #define CPUID_ID_LEN (12) +/** + * @brief Definition of different panic modes + */ +typedef enum { + HARD_FAULT, /**< hard fault */ + NMI_HANDLER, /**< non maskable interrupt */ + DUMMY_HANDLER /**< dummy interrupt handler */ +} panic_t; + #ifdef __cplusplus } #endif diff --git a/cpu/stm32f0/startup.c b/cpu/stm32f0/startup.c index d1fa47bf920e10988704d0ff3b5d4b4ada923455..ebc44aa954d35648708032c824d64689a331ed5f 100644 --- a/cpu/stm32f0/startup.c +++ b/cpu/stm32f0/startup.c @@ -19,7 +19,8 @@ */ #include <stdint.h> -#include "board.h" + +#include "crash.h" /** * memory markers as defined in the linker script @@ -79,42 +80,17 @@ void reset_handler(void) */ void dummy_handler(void) { - while (1) {asm ("nop");} + core_panic(DUMMY_HANDLER, "DUMMY HANDLER"); } void isr_nmi(void) { - while (1) {asm ("nop");} -} - -void isr_mem_manage(void) -{ - while (1) {asm ("nop");} -} - -void isr_debug_mon(void) -{ - while (1) {asm ("nop");} + core_panic(NMI_HANDLER, "NMI HANDLER"); } void isr_hard_fault(void) { - while (1) { - for (int i = 0; i < 250000; i++) { - asm ("nop"); - } - LED_RED_TOGGLE; - } -} - -void isr_bus_fault(void) -{ - while (1) {asm ("nop");} -} - -void isr_usage_fault(void) -{ - while (1) {asm ("nop");} + core_panic(HARD_FAULT, "HARD FAULT"); } /* Cortex-M specific interrupt vectors */