This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F280049: Code runs in ram faster than in flash

Part Number: TMS320F280049
Other Parts Discussed in Thread: C2000WARE

Dear C2000 expert,

I've found that the code runs in ram is faster than in flash, can you please help me know why? And what's risk of runing code in ram? Is there any specific points that I should focused when putting code runs in ram?

My system configuration: CPU MCLK = 100Mhz, RWAIT = 4

  • Jack,

    Flash is a wait-stated memory (RAM is 0 wait-stated).  As you may know from TRM, it takes RWAIT+1 cycles to fetch the code from Flash.  Hence, Flash will be a little slower compared to that of RAM.  However, there is a code prefetch mechanism and data cache in Flash wrapper to help improve fetch performance for linear code.  Did you enable them?  Please use Flash initialization routine provided in C2000Ware - It enables them.  

    You can load the code to Flash and copy it to RAM at run time and execute it from RAM.  Please check C2000Ware examples - they should have both RAM build and Flash build configurations.  If you look at Flash build example, you will notice the .Ti.ramfunc section.  This section is mapped to Flash for load but run address will be a RAM address.  Examples use memcpy() to copy the Flash content to RAM before executing it.  Please take a look at the examples.

    Thanks and regards,
    Vamsi

      

  • Hi Vamsi,

    Thanks for your infomation. After checking my initialization code, I found that I have used the c2000 example code for device initialization, the prefetch mechanism and data cache have been enabled in my code. 

    OK, I thought it won't have any risk of runing the code in RAM if copy the flash contents to ram properly before executing it. I will take c2000ware as reference to design my code. 

    Thanks again.

  • Jack,

    Yes, there should not be any risk.  Please use C2000Ware examples as reference. 

    If you have further questions, please start a new thread.

    Thanks and regards,
    Vamsi