diff options
Diffstat (limited to '1_hello_world/startup.c')
-rw-r--r-- | 1_hello_world/startup.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/1_hello_world/startup.c b/1_hello_world/startup.c index 3b3c017..06ca39e 100644 --- a/1_hello_world/startup.c +++ b/1_hello_world/startup.c @@ -22,9 +22,11 @@ struct smd_header { char country_codes[16]; }; -extern void __start(void); -static void HSYNC_handler(void); -static void VSYNC_handler(void); +extern int main(void); +static __attribute__((interrupt)) void __start(void); +static __attribute__((interrupt)) void HSYNC_handler(void); +static __attribute__((interrupt)) void VSYNC_handler(void); +static __attribute__((interrupt)) void CPUException_handler(void); extern unsigned __stacktop; @@ -32,13 +34,13 @@ __attribute__((section(".stack"), used)) unsigned *__stack_init = &__stacktop; __attribute__((section(".vectors"), used)) ptr_func_t __isr_vectors[] = { __start, - __start, - __start, - __start, - __start, - __start, - __start, - __start, + CPUException_handler, + CPUException_handler, + CPUException_handler, + CPUException_handler, + CPUException_handler, + CPUException_handler, + CPUException_handler, __start, __start, __start, @@ -118,5 +120,13 @@ __attribute__((section(".smd_header"), used)) struct smd_header __smd_header = { .country_codes = " E ", }; -void HSYNC_handler(void) {} -void VSYNC_handler(void) {} +static void __start(void) +{ + main(); +} +static void HSYNC_handler(void) {} +static void VSYNC_handler(void) {} +static void CPUException_handler(void) +{ + asm inline volatile (" stop #2700"); +} |