-
Notifications
You must be signed in to change notification settings - Fork 85
Support vector table relocation? #55
Comments
I would say yes; bootloaders should either set VTOR or copy the application vector table to RAM and remap it appropriately (e.g. on thumbv6 without VTOR), before jumping to application code. See for example this article from ARM/Keil. The bootloader has all the information it needs to do this properly, while cortex-m-rt doesn't in general. |
Can this be closed, or is there a use case where cortex-m-rt needs to be involved? |
I vote for closing; this is definitely behaviour the bootloader itself should take care of, and if it doesn't, chip/board support code can also take care of it. Doesn't need any special help from cortex-m-rt AFAIK. |
Okay, closing then. If some use case comes up we can always reopen. |
Hi Jorge and friends,
For various reasons I'm trying to use cortex-m-rt on a stm32l151 with a bootloader at 0x0800_0000.
This means my memory.x looks like this:
so my user code plus the vector table starts at 0x0800_4000.
On startup the bootloader runs first, and once it's done it jumps to the reset handler at *0x0800_4004.
So far this works, and my main (well actually RTFMs init and idle) runs as expected.
However, none of the interrupts work, as the stm32 still uses the bootloader vector table at 0x0800_0000.
To fix that I'm currently running
unsafe { p.core.SCB.vtor.write(0x4000) };
ininit
, after which everything runs just fine again.Would it make sense to handle this vector table relocation in cortex-m-rt or should we consider this a bug of the bootloader?
If we want to fix it in cortex-m-rt, how could the fix look like? We'd need to write the relative offset from start of flash to where the vector table ends up, but as far as I can tell we don't know anymore that the original start of FLASH was at 0x8000_0000.
The text was updated successfully, but these errors were encountered: