4.55 __vectab_stack_and_reset

__vectab_stack_and_reset is a library section that provides a way for the initial values of sp and pc to be placed in the vector table, starting at address 0 for M-profile processors, such as Cortex-M1 and Cortex-M3 embedded applications.

__vectab_stack_and_reset requires the existence of a main() function in your source code. Without a main() function, if you place the __vectab_stack_and_reset section in a scatter file, an error is generated to the following effect:

Error: L6236E: No section matches selector - no section to be FIRST/LAST

If the normal start-up code is bypassed, that is, if there is intentionally no main() function, you are responsible for setting up the vector table without __vectab_stack_and_reset.

The following segment is part of a scatter file. It includes a minimal vector table illustrating the use of __vectab_stack_and_reset to place the initial sp and pc values at addresses 0x0 and 0x4 in the vector table:

;; Maximum of 256 exceptions (256*4 bytes == 0x400)
VECTORS 0x0 0x400
{
    ; First two entries provided by library
    ; Remaining entries provided by the user in exceptions.c
    * (:gdef:__vectab_stack_and_reset, +FIRST)
    * (exceptions_area)
}
CODE 0x400 FIXED
{ 
    * (+RO)
}
Non-ConfidentialPDF file icon PDF versionARM DUI0475M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.