I am using an STM32F439VGTx, which hasflash starting at 0x08000000, length 0x00100000and CCM RAM starting at 0x10000000, length 0x00010000and normal RAM starting at 0x20000000, length 0x00030000I want some of my code and constant data to be in flash,and some code to be executed out of RAM. How can Itell the compiler to compile some functions or modulesto execute in RAM, but place the compiled code in flashso I can copy it to RAM for execution? For example,I might have a function called RamFunc(), which I would likeplaced in RAM at some address, (say 0x20000800 or maybe 0x100000800),but I need the image of it in flash at a known address, say 0x08001000,and a known length so I can copy it to RAM for execution.I have tried many variations of settings in a .sct file, and also triedvarious versions using a Debug_RAM.ini file, as in the CMSIS-RTOS Blinky (MCBSTM32E)example. Nothing has worked for me.Any help would be greatly appreciated.
I suspect you're trying too hard.I'm pretty sure you don't have to do the copying from flash to RAM yourself. The linker and startup code should be quite capable of doing that for you, once you've set up the specific code section and linker script correctly. As a benefit of that, you also won't have to insist on fixed addresses, either, because the start-up machinery gets all the information it needs for that job from the linker, already. All you have to do is let the tools do their job.
I have not found any way to do it, either with the startup code automatically copying it or manually. I'm happy to let the tools do the job, but I don't know how. I am hoping someone here does. Also, my main goal to to understand clearly how to use the tools to do what I want to facilitate a custom boot loader.
You don't need to execute out of SRAM to burn flash, you just need to execute from a different block. That's my (limited) understanding anyway.
You can locate memory in Flash if you still want to. For instance:
const APPINFOBLK_T AppInfoBlock __attribute__ ((at(FLASH_AIB))) = // Compiler v5
: