I would like to have the option of relocating my vector table to RAM at runtime, in a library (ie if the code doesn't need to do this, it doesn't, and the RAM isn't allocated or is eliminated by section garbage collection during link.)The actual relcation seems simple enough, but I'm having trouble figuring out how to get the most efficiently allocated chunk of RAM needed, because of the alignment requirements.
Any suggestions?(using the ARM gcc distribution, and mostly interested in Microchip SAMD2x and SAMD5x chips. But more general would be better! The actual goal is to be able to redefine the handlers for those multi-function SERCOM peripherals (and similar), depending on their desired function. I would prefer not to add an additional level of indirection.)
GCC has no "at", but you can set a section for the vector table and use the linker script to place it anywhere you want.That's all you have to do.
I was worried that modifying the linker script or adding --section-start to the link command would interfere with the garbage collection, but it does seem to work fine.
I'm still looking for additional choices, though.
But if the vector table is in RAM you can modify it on depending on the current needs. What is the problem with having those 180 bytes at the beginning. If you are running out of memory already, you should consider a different SoC.
View all questions in Cortex-M / M-Profile forum