Other Parts Discussed in Thread: HALCOGEN
Tool/software: Code Composer Studio
Hi,
I'm using GCC to compile the code,I want to run the code from ram instead of flash,how to copy the code from flash to ram with GCC tools?
Thanks.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Code Composer Studio
Hi,
I'm using GCC to compile the code,I want to run the code from ram instead of flash,how to copy the code from flash to ram with GCC tools?
Thanks.
You can use memcpy() function to copy a section from flash to SRAM, then execute the code in this section from SRAM.
1. define a section in linker cmd file
mySection:
{
myCode_ToBeExecute_From_RAM.obj (.text)
} load = FLASH0, run = SRAM, LOAD_START(myCode_LoadStart), RUN_START(myCode_RunStart), SIZE(myCode_Size)
2. copy this section to SRAM in your main() or startup()
extern unsigned int myCode_LoadStart;
extern unsigned int myCode_RunStart;
extern unsigned int myCode_Size;
memcpy(&myCode_RunStart, &myCode_LoadStart, (uint32)&myCode_Size);
Hi QJ Wang,
I'm using GCC compiler to generate the code,and I get the ld file instead of cmd file,how to do in the ld file,can you give me an example code?
Thanks.
Hello,
I don't have a example. You can modify the ld file generated by HALCOGen.
Hi QJ Wang,
I modified the ld file,but I got a syntax error,how to write the code?
Thanks.
.ARM.attributes 0 : { *(.ARM.attributes) } ramfuncs : LOAD = FLASH, RUN = RAM, LOAD_START(__RamfuncsLoadStart), LOAD_SIZE(__RamfuncsLoadSize), RUN_START(__RamfuncsRunStart) }
Hello,
You opened a new thread for the same question. I will close this one.