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.

TMS570LC4357: Cache Memory modes and MPU

Part Number: TMS570LC4357
Other Parts Discussed in Thread: TMS570LS3137

================================================================================

This question is split from "TMS570LC4357: Execution Time is huge when compared to TMS570LS3137"

Link: e2e.ti.com/.../730319

================================================================================

Gobind,

These questions are no longer related to the original post and title. Please start a new thread for questions / topics unrelated to the original post.

See my comments below:

1. I did not enable MPU, which means the memory attributes are the default ones and whole of Flash and RAM are in Write-Back, Write-Allocate (WBWA)mode. (Is this assumption correct?) The execution time for some set of instructions was 734ns. When I enabled MPU and I think i configured it Write-Through (WT) mode. The execution time for the same set of instructions was 610ns. Is it expected behavior? If yes, why WT mode is faster than WBWA mode?

>> Please share your code configuring the MPU, as well as the instructions that you are executing. How do you measure the execution time?

2. In CCS Expressions window, when the code is running with Cache Enabled, the values in Expression window are all zeros. As soon as the execution is PAUSED, the actual values are seen. Is there a way to parallel see these values in the Expression window when Cache is enabled? When Cache is disabled, the values are fine.

>> The debugger memory window does use the processor to refresh the contents. This requires the processor to stop executing code, switch to a debug state (refer to ARM architecture reference manual for debug state details), and perform reads from the memory locations being displayed. There is a way on TMS570 MCUs to display memory locations without using or halting the processor. This requires you to map the debugger memory window to be refreshed by the DAP (Debug Access Port) in stead of the processor.

3. Another question is, Is it not possible to execute code from RAM when Cache memory is enabled? I tried that, but I am facing problems. I see some exceptions getting raised or sometimes control remains in the function that is running from RAM and never comes out.

>> How do you set up your code to execute from RAM? What exceptions do you get?

Regards,
Sunil

  • Answers below:

    1. MPU init file is attached.0333.MPU_init.txt

    The instruction that i executed was like:

    //Start Code

    Toggle GPIO low

    UINT32 = UINT32 + UINT32;

    UINT32 = UINT32 + UINT32;

    ..... 18 times

    Toggle GPIO high

    //End Code

    GPIO was used to measure the time (as above)

    2. Debugger shows the values when Cache is not enabled. When cache is enabled, it shows only zeroes. My question is, is there any special setting that we have to do for Cache Enabled to view the run time values in the Debugger?

    3. I used the #pragma code to run the function from RAM:

    pragma CODE_SECTION(FunctionName,"APPRAMFUNC")

    I do not get some exception, but the control never comes out of the function running from RAM. But as soon as i disable cache, everything works perfectly fine. So my question is only with respect to cache enable, otherwise it is fine.

  • Gobind,

    For #1, can you explicitly configure the RAM as write-back and then as write-through and do the measurement again? Your execution time may be getting affected by the attributes of another memory (flash).

    #2. The debugger makes accesses to the RAM via the DAP port with the CPU in debug state. This requires the CPU to be halted to read the memory contents. Is the CPU code execution halted when you read the memory locations using the debugger?

    #3. How do you copy the code section to RAM and then call the function?

    Regards,
    Sunil