Hello everybody,
I just downloaded Codewarrior V11.0 and making some trial projects I’ve seen that there is the option to choose RAM or FLASH.
I’ve been looking information about this but I couldn’t find anything, so I wonder if someone could help me explaining what is this option for and what is the difference between choosing one or the other.
Thank you and regards.
Solved! Go to Solution.
Hello Egoitz,
Normally, those options represent the target where your code will be loaded by a loader (either RAM or Flash).
RAM target is used in general for fast debugging and when you cannot write or you do not have a flash memory(ROM only). Once your code was loaded in RAM, you need to load the code each time when a reset occurrs (RAM loses its content being a volatile memory).
Flash target on the other side, is used to keep your code for a long time even after a reset will occur.
As a summary, loading your code in RAM and executing it from there is faster than executing it from Flash.
You need to pay attention here, because your code must be linked as position independent or linked in RAM's address space.
For instance, if you wrote a scatter file or a loader file and linked some code to a fixed address, executing from RAM and referencing from Flash will crash.
Hello Egoitz,
Normally, those options represent the target where your code will be loaded by a loader (either RAM or Flash).
RAM target is used in general for fast debugging and when you cannot write or you do not have a flash memory(ROM only). Once your code was loaded in RAM, you need to load the code each time when a reset occurrs (RAM loses its content being a volatile memory).
Flash target on the other side, is used to keep your code for a long time even after a reset will occur.
As a summary, loading your code in RAM and executing it from there is faster than executing it from Flash.
You need to pay attention here, because your code must be linked as position independent or linked in RAM's address space.
For instance, if you wrote a scatter file or a loader file and linked some code to a fixed address, executing from RAM and referencing from Flash will crash.
Hello Briceag Bebe-Cosmin,
Understood!!
Just for try out, I debugged a very simple blinking LED program with both configurations Flash and RAM and it occurred as you say when ressetting.
If I’m not wrong, the Flash memory has a limited amount of write cycles rather smaller than the RAM, so taking this into account, I think that debugging the programs in the RAM until having them finished (or almost) and make the last checks at the Flash would be a good practice that I’m going to adopt, mostly for complex projects where having no code errors from the beginning is not easy job.
It's been a very clarifying and useful answer!
Thank you and regards.