The Startup File startup_<device>.s (deprecated) contains:
- The reset handler which is executed after CPU reset and typically calls the SystemInit function.
- The setup values for the Main Stack Pointer (MSP).
- Exception vectors of the Cortex-M Processor with weak functions that implement default routines.
- Interrupt vectors that are device specific with weak functions that implement default routines.
The file exists for each supported toolchain and is the only tool-chain specific CMSIS file.
To adapt the file to a new device only the interrupt vector table needs to be extended with the device-specific interrupt handlers. The naming convention for the interrupt handler names are <interrupt_name>_IRQHandler. This table needs to be consistent with IRQn_Type that defines all the IRQ numbers for each interrupt.
Example:
The following example shows the extension of the interrupt vector table for the LPC1100 device family.
; External Interrupts
DCD WAKEUP0_IRQHandler ; 16+ 0: Wakeup PIO0.0
DCD WAKEUP1_IRQHandler ; 16+ 1: Wakeup PIO0.1
DCD WAKEUP2_IRQHandler ; 16+ 2: Wakeup PIO0.2
: :
: :
DCD EINT1_IRQHandler ; 16+30: PIO INT1
DCD EINT0_IRQHandler ; 16+31: PIO INT0
:
:
EXPORT WAKEUP0_IRQHandler [WEAK]
EXPORT WAKEUP1_IRQHandler [WEAK]
EXPORT WAKEUP2_IRQHandler [WEAK]
: :
: :
EXPORT EINT1_IRQHandler [WEAK]
EXPORT EINT0_IRQHandler [WEAK]
WAKEUP0_IRQHandler
WAKEUP1_IRQHandler
WAKEUP1_IRQHandler
:
:
EINT1_IRQHandler
EINT0_IRQHandler
B .
startup_Device.S Template File
An Arm Compiler V6 assembler startup_Device.S Template File for an Armv8-M processor like Cortex-M33 is shown below. The files for other compiler vendors differ slightly in the syntax, but not in the overall structure.