Hi there,
There any many forum posts on the topic of running functions from RAM rather than FLASH - however I was unable to convert this wealth of information into a solution.
I am using the MSP430F5437A and CCS4.0. My approach was to use the pragma and modified linker file.
#pragma CODE_SECTION(xxx,".FLASHCODE")
and a modified linker file
.FLASHCODE : load = FLASH_MEM, run = RAM_MEM
...
RAM_MEM : origin = 0x1C00, length = 0x0200
RAM : origin = 0x1F00, length = 0x3000
FLASH_MEM :origin = 0x5C00, length = 0x200
FLASH : origin = 0x5F00, length = 0xA000
When I debug the code line-by-line I can see the code correctly jump to the function in RAM. However, it immediately jumps to FLASH and crashes (to clarify the next instruction is not a jump to flash).
I have attempted to fix this by placing multiple NOPs prior to the ram function call and to remove compiler optimizations.
The code is from the MSP430F5x sample codes - "MSP430F543xA Demo - Single-Byte Flash In-System Programming, Copy SegC to SegD) with the modifications outlined above.
Any thoughts or suggestions?