I want to program MPC5554 so that the code finally runs from the internal SRAM i.e. program the flash with the application code and at run time this code runs from the internal SRAM, how to do this.
Any help would be highly appreciated.
Thanks in advance.
dranne
Hello Dranne,
There is 2 things that need to happen.
1. When the code is compiled the compiler needs to know that this is what you intended to do. Otherwise it will operate relative to the flash address when it does a branch etc rather than the ram that you have moved it to.
2. You need to copy over the code in your flash boot code and point the PC to it once it is all copied.
This is a valid thing that you want to do. I am using the Greenhills compiler and it provides an example to do what you ask. I have also done this before in Windriver and I remember that they also described how to do this in their documentation.
Regards,
Dayve
In which of the files, will I have to make these changes.
Regards
dranne
Hey Dranne,
Have a look in the Codewarrior forum, there are some questions about this topic.
Here is a thread that will help you out.
https://community.freescale.com/thread/66070
Regards,
Dayve
Thanks Dayve, I'll get back to you on this with more questions.
Hi Davye
I used the sample code in the reference link you emailed.
But when I call the function in main it gives link error
'Link error: Relocation(10) of symbol 'MyFunc' in 'main.o'
is out of range. ...
Link failed.
What to do of this? I am using Code Warrior IDE version 5.9.0. Any help would be highly appreciated.
Regards
dranne
Hello dranne,
This link error is caused by the fact the code in RAM is out of range of PC relative addressing that is used by default.
Therefore I'd suggest you to explicitly specify that far absolute addressing should be used by pragma: e.g.:
#pragma push
#pragma section code_type ".my_RAM_code" ".my_RAM_code" data_mode=far_abs code_mode=far_abs
void myfunc1(void)
{
...
}
#pragma pop
I hope it will help.
Stanish
Hi
Yes it helped, thanks will ask more on this.
Regards
dranne
Hi Dayve, Can you please tell me how to do it in Freescale codewarrior. Any sample code may help me a lot.
Thanks in advance
Regards
dranne