1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #2402 from haukepetersen/add_nrf_crash

cpu/nrf51822: use core_panic in startup code
This commit is contained in:
Thomas Eichinger 2015-02-10 13:35:17 +01:00
commit 7a492f1650
2 changed files with 14 additions and 8 deletions

View File

@ -55,6 +55,15 @@ extern "C" {
*/
#define CPUID_ID_LEN (8)
/**
* @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

View File

@ -19,8 +19,10 @@
*/
#include <stdint.h>
#include "board.h"
#include "cpu.h"
#include "crash.h"
/**
* memory markers as defined in the linker script
@ -86,22 +88,17 @@ void reset_handler(void)
*/
void dummy_handler(void)
{
while (1) {asm ("nop");}
core_panic(DUMMY_HANDLER, "DUMMY ISR HANDLER");
}
void isr_nmi(void)
{
while (1) {asm ("nop");}
core_panic(NMI_HANDLER, "NMI HANDLER");
}
void isr_hard_fault(void)
{
while (1) {
for (int i = 0; i < 500000; i++) {
asm("nop");
}
LED_RED_TOGGLE;
}
core_panic(HARD_FAULT, "HARD FAULT");
}
/* Cortex-M specific interrupt vectors */