I want my code to start executing from a certain address in my RAM, let's say 0x80005000. What I'm basically trying to achieve is fetching a code file from SD Card using SPI into the RAM and then executing it from the RAM itself during run-time.
I'm trying to compile my code to start executing from 0x80005000 but I do not know how to do this. I've read a bit on Position Independent Code but not able to understand it. Could anyone tell me how to do it properly?
Thanks in Advance!
To do this during runtime you simply have to make sure that a few points are met:
Once you have the binary, just install it to the RAM with a simple for loop or a
memcpycall. And finally, you can start it as simply as calling a function like this from the main FLASH application:EDIT:
To answer your comment regarding the linker script, you might want to go to ST website / github repository for handing on a RAM linker script that is adapted to your target MCU. That linker script basically tells the linker to put code and data symbols into memory at the specified RAM region with
>RAM AT> FLASH. ST also usually provide both FLASH and RAM linker scripts within their sample projects.