Startup code

In order to boot a workable system, we need to define the interrupt vector, and associate pointers to defined functions. A typical startup code file for our reference platform places the interrupt vector in a dedicated section, using the GCC attribute section. As the section will be put at the beginning of the image, we must define our interrupt vector starting with the reserved space for the initial stack pointer, followed by the system exception handlers.

The zeros correspond to the positions of the reserved/unused slots:

__attribute__ ((section(".isr_vector")))void (* const IV[])(void) ={    (void (*)(void))(END_STACK),    isr_reset,    isr_nmi,    isr_hard_fault,    isr_mem_fault,    isr_bus_fault,    isr_usage_fault,    0, 0, 0, 0,    isr_svc, isr_dbgmon, ...

Get Embedded Systems Architecture now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.