Hi all,
I sometimes hear it in the ARM presentations that execution on flash memory consumes much power and execution on RAM is recommended for the low power purpose. I would like to know the reason why accessing to flash memory consumes more power than RAM. Could anyone give me an answer?
Best regards,
Yasuhiko Koumoto.
RAM is normally a few times faster so if you're doing a lot of work you're simply burning cycles doing nothing useful if you're executing from flash. However if most of time the system is asleep and you can afford for it to go a bit slower and you can keep all the work in a small amount of RAM then I'd have thought you'd save by using Flash.
Hi daith,
thank you for the reply but by my poor English ability I cannot understand your statements well. Do you say that Flash execution consumes less power than RAM execution?
Best regards,Yasuhiko Koumoto.
No I'm saying that whether code should be in RAM or Flash depends on how often it is used and how quickly it needs to execute. The RAM will use power all the time. The Flash only needs to be powered up while it is being used. Code executed from Flash will normally be slower and so use more power than if it was in RAM - but code in RAM uses up power even when it isn't being used. So you want as small a RAM as possible but still include any code that is executed very frequently or needs to handle an interrupt quickly. For very low power devices that only wake up occasionally having a very small RAM and all the code in flash is normally a good idea.
thank you very much but I am still unclear. Please give me more details.Your explanation 'Code executed from Flash will normally be slower and so use more power' sounds for me that slow execution consumes more power. Is my understanding correct? According to my impression, the slow execution makes less activity of transisters, and the power consumption for it will be low. What is the true meaning of 'Code executed from Flash will normally be slower and so use more power'?
You're right that if one slowed the clock down the power would be reduced. I was talking about if one ran with the same clock from flash as from RAM. The processor then would use up more power doing the same job. Flash can also use more power of itself if run hard but that normally isn't the main problem.
The trade off can get tricky depending on how fast you want things to go, how often the system goes to sleep, and how much work it does when awake - one can't just give a definitive answer one way or the other. I had a look on the web and here's a recent paper from arXiv on this precise problem that you might find useful
[1406.0403] Optimizing the flash-RAM energy trade-off in deeply embedded systems
thank you. I understood well. You say that the shorter execution time, the lower power consumes at the same clock speed, don't you? However please correct me if my understanding is wrong.
Yes that's right.
Even when flash can be read in a single cycle it uses more power than RAM, I'm not sure why, perhaps because the RAM is usually much smaller. Flash is cheaper and for most things you don't want to keep a big RAM powered up while the processor is asleep. The big saving is if flash can be turned off for a while, e.g. if it doesn't have to be used for clock interrupts whilst sleeping or if doing something expensive like a Fourier transform.