Teensy 3 startup code vector table mapped to 0 always

In the Teensy 3 code currently, specifically file mk20dx128.c , there is a line

Code:
SCB_VTOR = 0;	// use vector table in flash

this is causing problems when it is used with a bootloader I wrote, because "user app" has its own vector table, my bootloader sets SCB_VTOR to the new location before launching the "user app", but the "user app" is also written with Teensy 3's startup code and thus the above line of code breaks the "user app" as it reverts the change that my bootloader made.

I think a better way of writing that line would be

Code:
SCB_VTOR = (uint32_t)(&gVectors[0]); // set vector table, supports bootloaders

Which will set the correct vector table location while respecting the actual placement as defined by the linker script.
 
Back
Top