Hi
I just noticed that the ImageVectorTable[] as used in the Teensy project doesn't match with that used by NXP.
__attribute__ ((section(".ivt"), used))
const uint32_t ImageVectorTable[8] = {
0x432000D1, // header
(uint32_t)&ResetHandler,// program entry
0, // reserved
0, // dcd
(uint32_t)BootData, // abs address of boot data
(uint32_t)ImageVectorTable, // self
(uint32_t)hab_csf, // command sequence file
0 // reserved
};
where ResetHandler is the address of the routine void ResetHandler(void).
NXP does it differently:
__attribute__ ((section(".ivt"), used))
const uint32_t ImageVectorTable[8] = {
0x412000D1, // header
(uint32_t)__Vectors,// program entry
0, // reserved
0, // dcd
(uint32_t)BootData, // abs address of boot data
(uint32_t)ImageVectorTable, // self
(uint32_t)hab_csf, // command sequence file
0 // reserved
};
where
void (* const g_pfnVectors[])(void) = {
// Core Level - CM7
&_vStackTop, // The initial stack pointer
ResetISR, // The reset handler
...
and
ResetISR is the reset handler equivalent to void ResetHandler(void).
This means that when the ROM LOADER jumps to the reset handler it first sets the stack pointer with the first entry and the second entry is used as the entry point.
How does it work with the Teensy method which doesn't conform to this, and how is the stack pointer set in the Teensy 4 project?
Regards
Mark
I just noticed that the ImageVectorTable[] as used in the Teensy project doesn't match with that used by NXP.
__attribute__ ((section(".ivt"), used))
const uint32_t ImageVectorTable[8] = {
0x432000D1, // header
(uint32_t)&ResetHandler,// program entry
0, // reserved
0, // dcd
(uint32_t)BootData, // abs address of boot data
(uint32_t)ImageVectorTable, // self
(uint32_t)hab_csf, // command sequence file
0 // reserved
};
where ResetHandler is the address of the routine void ResetHandler(void).
NXP does it differently:
__attribute__ ((section(".ivt"), used))
const uint32_t ImageVectorTable[8] = {
0x412000D1, // header
(uint32_t)__Vectors,// program entry
0, // reserved
0, // dcd
(uint32_t)BootData, // abs address of boot data
(uint32_t)ImageVectorTable, // self
(uint32_t)hab_csf, // command sequence file
0 // reserved
};
where
void (* const g_pfnVectors[])(void) = {
// Core Level - CM7
&_vStackTop, // The initial stack pointer
ResetISR, // The reset handler
...
and
ResetISR is the reset handler equivalent to void ResetHandler(void).
This means that when the ROM LOADER jumps to the reset handler it first sets the stack pointer with the first entry and the second entry is used as the entry point.
How does it work with the Teensy method which doesn't conform to this, and how is the stack pointer set in the Teensy 4 project?
Regards
Mark