diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2013-06-06 15:16:11 +0900 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2013-06-06 15:16:11 +0900 |
commit | bbd9404fa54dc7ec5c783e65feea2f95bee54bf2 (patch) | |
tree | 6bb49d5bb1e2dda3503e677c11651858e37ce0d5 /example-led | |
parent | 0b46ccbae10d5478ca4ad2e188678632d76d2210 (diff) |
fix sys.c
Diffstat (limited to 'example-led')
-rw-r--r-- | example-led/sys.c | 14 | ||||
-rw-r--r-- | example-led/sys.h | 2 |
2 files changed, 10 insertions, 6 deletions
diff --git a/example-led/sys.c b/example-led/sys.c index 59d826b..8bb9ae0 100644 --- a/example-led/sys.c +++ b/example-led/sys.c @@ -540,11 +540,14 @@ nvic_system_reset (void) { SCB->AIRCR = (0x05FA0000 | (SCB->AIRCR & 0x70) | SYSRESETREQ); asm volatile ("dsb"); + for (;;); } static void __attribute__ ((naked)) reset (void) { + extern const unsigned long *FT0, *FT1, *FT2; + asm volatile ("cpsid i\n\t" /* Mask all interrupts. */ "mov.w r0, #0xed00\n\t" /* r0 = SCR */ "movt r0, #0xe000\n\t" @@ -559,13 +562,16 @@ reset (void) "ldr r0, [r1]\n\t" /* Reset handler. */ "bx r0\n" : /* no output */ : /* no input */ : "memory"); + + /* Never reach here. */ + /* Artificial entry to refer FT0, FT1, and FT2. */ + asm volatile ("" + : : "r" (&FT0), "r" (&FT1), "r" (&FT2)); } typedef void (*handler)(void); extern uint8_t __ram_end__; -extern const unsigned long *FT0, *FT1, *FT2; - handler vector[] __attribute__ ((section(".vectors"))) = { (handler)&__ram_end__, reset, @@ -582,9 +588,7 @@ handler vector[] __attribute__ ((section(".vectors"))) = { nvic_system_reset, clock_init, gpio_init, - (handler)&FT0, - (handler)&FT1, - (handler)&FT2, + NULL, }; const uint8_t sys_version[8] __attribute__((section(".sys.version"))) = { diff --git a/example-led/sys.h b/example-led/sys.h index ce0eb1d..25d33f1 100644 --- a/example-led/sys.h +++ b/example-led/sys.h @@ -1,7 +1,7 @@ extern const uint8_t sys_version[8]; typedef void (*handler)(void); -extern handler vector[18]; +extern handler vector[16]; static inline const uint8_t * unique_device_id (void) |