RAM function not going into RAM?
I’m trying to program the dual-bank flash of the STM32L082 microcontroller, and in order to have decent flash write speed, I need to program in half-page increments. I’m trying to use the half-page program function in HAL.
When I use it, I get a run-time error in the flash program status register FLASH_SR saying that the programming was interrupted by a fetch (bit 17, FWWERR). This is the error that could be explained if the half-page program function is not running from SRAM. When I step through the code with a debugger, I see that the program counter is 0x0800e190, which is in the middle of bank 1 of flash, which makes me think that the HAL “__RAM_FUNC HAL_FLASHEx_HalfPageProgram(uint32_t Address, uint32_t* pBuffer)” isn’t actually getting compiled into RAM. Is there something special I need to do to force the function into RAM?
I searched around a bit and found someone who recommended I change the option in the flash_ramfunc.c file to have “position indpendent code”. I checked that box but I’m still getting program counters in the bank 1 flash range, but now I get about a dozen PC halted console messages for every step.
Anyone have a suggestion for what I need to do to get a function to live in RAM?
Thanks in advance