vectorlinkercortex-m

How does ARM MCU find my relocated vector table?


I'm using an NXP Kinetis K64 ARM Cortex M4 MCU. I successfully altered the linker configuration file to move my vector table to address 0x8000 (instead of the 0x0000 default). When I tell the CodeWarrior 10.6 debugger to break at the start of the code, it stops at the top of the boot.S file as expected. But it dawned on me, HOW did the MCU/debugger find the code since the flash memory is empty (0xFF) from address 0x0000 to 0x7FFF and the VTOR register shows as 0x0?!

I looked through the datasheets of both the ARM M4 core and the NXP K64, but they don't answer this scenario.


Solution

  • It is probably due to the settings of your Debug Configurations in CodeWarrior. In Debugger tab, if Initialized program counter at is ticked as shown below, the debugger will give Program Counter, at reset, the address of "the top of the boot.S file", which is the Program entry point. The normal sequence of finding the vector table is skipped.

    Your program will not run without the debugger. screenshot

    Further details about the CodeWarrior Debugger can be found here