MCP5777C - executing from RAM

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MCP5777C - executing from RAM

1,984 Views
robertfromcummi
Contributor II

Is it possible to run program from RAM instead of Flash? Would it speed up execution? How much? Is there any good example for MCP5777C?

Labels (1)
4 Replies

1,419 Views
martin_kovar
NXP Employee
NXP Employee

Hi Robert,

I will try to summarize your question. At first, it is not so simple. It is not true that code executed from RAM will be always faster than code executed from FLASH. There is so many factors which determines, how fast will be the code executed. Also please realize, there is a pipelining, which consists of 10 stages and it is not possible to affect the execution speed of all stages.

1) Flash memory contains mini-cache memory. If there is mini-cache hit (code is placed in mini-cache) the execution is faster then from RAM. If there is mini-cache miss, execution from RAM could be faster. Read some information about flash wait states mentioned in reference manual and data sheet.

2) This micro has data and instruction cache memory. If cache is enabled, instructions and data are cached, and there is no difference if data were placed in flash or in RAM before. About cache, look at the e200z7 core reference manual.

3) Also XBAR traffic greatly affect the speed of the execution. If there is many masters which access the XBAR, throughput decreases and it has big impact to performance. It is necessary to remember DMA which affects performance too.

So if you want to increase performance, please look at all of the topics mentioned above. You can use reference manual, data sheet and also e200z7 core reference manual and also there is great document about e200 cores.

e200 Core Training relevant to MPC55xx and MPC56xx device family

If you want to copy parts of code from flash to RAM (some function for example), please look at the following example

Example MPC5748G PretendedNetworkingCAN S32DS

If you have any other question, please feel free to write me back.

Regards,

Martin

1,419 Views
robertfromcummi
Contributor II

Martin and Stan,

Thank you very much for information. This is very useful information and helps a lot.

I can do all that I need on S32DS platform and the question is rather about execution time of the code for 2 cases. One case is with code in flash memory and another one is with code in RAM.

By execution time I mean the time that processor needs to execute code. Because English is not my first language I will try to describe it just in case I am using wrong words. First case is when I do not do anything in linker and link code by default settings. Second case is with creating section that is copied from flash to RAM after reset and later it is called from RAM. And it is about "functions" ...not just data.

It is possible that there is no difference in execution time for these 2 cases. I just look for a way to speed up the execution of the code on MPC5777C.

I am trying to do experiments with it to check it on my hardware. The problem is that I do not know what I should expect out of this "optimization". I expect that execution from RAM would be much faster.

I do not have much experience with this processor and it is possible that I do something wrong with moving code from flash to RAM ...or I do not move the right part of the code. For example if I do any operations on "float" numbers, I would need to move relevant library function too. In this case I would need to extract the function from library and put the code in RAM too. I do not know how I could do it.

I assumed that execution from RAM should be faster than execution from flash. Is it wrong assumption?

Once again thank you very much for helping with it.

Best regards

Robert Dziuba

0 Kudos

1,419 Views
stanish
NXP Employee
NXP Employee

Hi Robert,

RAM target will be available in  S32DS for Power v1.1 (should be released by the end of this month).

Not sure what you mean by execution but the debugger startup time will be definitely faster (no operations like flash mass erase is required). It also depends on the debug probe you have.

Hope it helps.

Stan

1,419 Views
martin_kovar
NXP Employee
NXP Employee

Hi Robert,

S32DS does not support RAM target. It could be possible to modify linker file and other settings, but unfortunately for MPC5777C do not have any example, moreover this "feature" is no officially supported.

Regards,

Martin