gcc for ARM - move code and stack
I am working on a project for an ARM Cortex-M3 (SiLabs) SOC. I need to
move the stack and code away from the bottom of flash to make room for a
"boot loader". The boot loader starts at address 0 to come up when the
core comes out of reset. Its function is to validate the main image,
loaded at a higher address and possibly replace that main image with a new
one.
Therefore, the boot loader would have its vector table at 0, followed by
its code. At a higher, fixed address, say 8KB, would be the main image,
starting with its vector table.
I have found this page which describes the Vector Table Offset Register
which the boot loader can use (with interrupts masked, obviously) to point
the hardware to the new vector table.
My question is how to get the "main" image linked so that it will work
when written to flash, starting not at zero. I'm not familiar with ARM
assembly but I assume the code is not position independent.
I'm using SiLabs's Precision32 IDE which uses gcc for the toolchain. I've
found how to add linker flags. My question is what gcc flag(s) will
provide the change to the base of the vector table and code.
Thank you.
No comments:
Post a Comment