I want to copy code from ROM to RAM and run it in MKL05z32. my software is cw10.6.
please help me!
You can easily copy it using memcpy.
Take a look at this code snippet:
void romFunction (void)
//Do your stuff
void main (void)
memcpy (ramSpace,romFunction,1000); //Don't care if you copy more code than needed. After function return, no code will be executed
void (*ramFunction)(void)=(void (*)(void))ramSpace;
I suggest you check this document
Relocating Code and Data Using the CW GCC Linker File for Kinetis
it includes how to copy code from ROM to RAM
this answer is for you. if it helps, please click on "Correct Answer " button. thanks!
I think wang baode means copy. Not link the code in RAM space.
Retrieving data ...