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.

TMS320F28034: No Time Savings when running iq math lib functions from RAM

Part Number: TMS320F28034

I am running iqmath fuctions from ram.  

My cmd file has when running from ram

IQmath: LOAD = FLASHA_F,PAGE = 0
RUN = P_DRAML0,PAGE = 0
LOAD_START(_IQfuncsLoadStart),
LOAD_END(_IQfuncsLoadEnd),
RUN_START(_IQfuncsRunStart)

main.c has

memCopy((uint16_t *) &IQfuncsLoadStart, (uint16_t *) &IQfuncsLoadEnd, (uint16_t *) &IQfuncsRunStart);

My cmd file has this when running from flash.

 IQmath              : > FLASHA_F     PAGE = 0            /* Math Code */

I am not noticing any time savings when I run from ram versus running from flash.  The _IQ16div is 62 clocks according to the the www.ti.com/.../sprc990.pdf reference.  Our processor speed is 60MHz.  It's taking 3 us when running from flash or ram.  There seems to be now time saving.    Could you please suggest a reason?

I have verified in code composer using the disassembly  wind that the address of the _IQ16div funtion is in ram when I compile it for ram and is in flash when I compile for flash. 

  • check the map file and verify if the functions are going under correct sections.. you may even want to set a breakpoint and verify you are running from RAM. YOU should see some difference..
  • That's what I thought.  I did verify I am running from ram using the disassembly window in Code composer.  The functions are being called from RAM.  When I toggle and I/O around the functions and look with a scope I see no change in the time being taken. 

  • James,

    When you say you run it from flash, you uncomment the memcopy ? that's it correct?
  • No I take the memcopy out and change my linker file to place IQmath in flash like so.
    IQmath : > FLASHA_F PAGE = 0 /* Math Code */
  • James,

    Sorry for the delay in replies.

    Here are some thoughts i have on the subject so far

    1. When we profile FLASH and RAM code we typically profile a lareger chunk of code.. because we do have a small prefetch buffer on the flash which can mask the read hits ... (this is an effor to improve performance while running from RAM). YOu will find this configured in the InitFlash routine

    //Enable Flash Pipeline mode to improve performance
    //of code executed from Flash.
    FlashRegs.FOPT.bit.ENPIPE = 1;

    you can try disabling this and seeing if it gives you a different result.

    2. As you pointed out you have 60Mhz so i would expect ~1uS for the operation.. , do you have any other ISRs in the code that can interrupt this profiling.. make sure you do DINT before the code you are trying to profile

    3. You can also look at the using the CCS integrated profiler (i know i had mentiond it can be in-accurate because it clears the pipeline multiple times), becasuse the difference you are observing is 3x it would be good to profile the code step by step to make sure it is executing correctly

    4. I am assuming the operation results in correct result ?

    -Manish