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.

Running a program from Flash

Other Parts Discussed in Thread: TMS320F28035

Hello,

          I am working on tms320f28035 experimenter's kit. I have written a code which exceeds 0xca0 size ( max size that can be written to ram). I need to now run the code in from flash.

         Please suggest some reading material or code modifications to be done to run the code from flash. 

Regards,

Shantanu.

 

  • Hi Shantanu,

    Fortunately this Forum has a search function - use it and you will find *PLENTY* of posts regarding this topic... This site in addition is particulary useful

    Best regards

    Andreas

  • Shatanu,

    This document should help you.

    Running an Application from Internal Flash Memory on the TMS320F28xxx DSP - http://www.ti.com/lit/an/spra958j/spra958j.pdf

    source: http://processors.wiki.ti.com/index.php/C2000_Flash_Common_Issues/FAQs

    Running Code Standalone

    Q: How do I need to change my code for it to run stand-alone (without CCS connected)?

    A: Refer to these resources:

    Code Does Not Run Standalone

    Q: My program runs correctly when debugging within CCS but when I attempt to run this standalone it does not work. Why is this occurring?

    A: This can occur for a few different reasons:

    1. The boot mode selection is not "jump to flash". Check the boot ROM guide and data manual for the particular device.
    2. There are initialized sections allocated to load to RAM instead of flash. All initialized sections should have their load addresses allocated to flash so they can be programmed. The .cmd file needs to be checked to ensure that all initialized sections are assigned to flash. Section 3 of the Running an Application from Internal Flash Memory on the TMS320F28xx DSP(SPRA958) App. Note explains where each compiler generated section should be allocated.
    3. If the code is time critical and needs to be run from RAM, it can be copied at runtime.
    4. After you copy critical sections to RAM, make sure the copy really occurred - check the memory contents.
    5. Try running the flash to RAM copy routine first. Some early functions may assume parts have been copied to RAM. For example, the delay function is used in the InitSysCtrl() function. This delay function is by default allocated to the functions TI's examples copy to RAM. If InitSysCtrl() is called before the copy to RAM then an exception will occur. TI is working to add comments to help avoid this pitfall. This also occurs with InitAdc().
    6. An instruction was not added to branch to the beginning of application code at the flash entry point. This is discussed further in Section 6 of SPRA958.
    7. 281x specific: In addition to the actual boot pins, the MP/MC pin needs to be pulled low to enable the boot ROM.

    To debug this issue, step through the code and try to determine where it is going wrong. Here are some debug suggestions:

    1. Flash the device
    2. Turn off the power
    3. Connect CCS and select "load symbols" only
    4. Place a breakpoint at the entry point to flash
    5. Reset the part with the debugger and run - did you hit the breakpoint? If so the boot mode looks ok
    6. Step the code until you find an issue.

    Regards,

    Manoj

  • Can you please let me know all code modifications done in Flash Epwm timer interrupt code for tms320f28035. This code I think, is run from flash. This code is only modified from epwm timer interrupt code which was ran from RAM.

     

    Thanks & Regards,

    Shantanu.

     

  • Hi,

        I read the details in doc file provided with sample codes. I did the changes in cpu timer code. That ran well on flash.

    Now when I add InitAdc() function in Main() ;  The code gets compiles properly but, when run the code the processor gets traped in illegal ISR routine!

    Please let me know wht to do now?

    Thanks,

    Shantanu.

  • Hi,

    any interrupt whose ISR vector is not defined usually goes ti illegal isr tarp function.

    On start-up all the ISR vectors are initialized by address of this illegal ISR routine.

    So when one uses an interrupt associated vector should be updated. For explae if i am using PWM interrupt i have to initialize its vector address as

    PieVectTable.EPWM1_INT = &pwmisr;

    with pwmisr() is my ISR function.

    i hope this helps you.

  • hi,

    Lets say I only did InintAdc();  and dint write any adc isr. Still the code compiles properly but it gets trapped in Illegal ISR.

     

    Also lets say I did all Adc ISR initialization correctly, still the dsp gets trapped in illegal ISR.

     

    Also when I did SCI initialization for interrupt corerctly and code works well.

     

    What should be the reason for ADC's InitAdc() causing problems?

     

    Regards,

    Shantanu

  • Shantanu,

    Adding InitAdc() shouldn't be causing all these problems.Did you try single stepping through the code to understand the issue?

    Please try single stepping through the code when InitAdc() function is executed this should give some clues as what is causing the problem. Also, set a breakpoint at the first statement ILLEGAL_ISR function, hit run, when it hits the breakpoint check the stackpointer to identify the address and data which caused the illegal isr. This should certainly give you clues to debug further and resolve the issue.

    Regards,

    Manoj