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.

TMS320F28035: load the flash programming example in Flash

Part Number: TMS320F28035

Tool/software:

Hi Champ,

I try to load the flash programming example (Example_Flash2803x_API) in flash, so that the example could run from flash, then in runtime, executing flash operation in RAM.

However, adding the Flash Linker cmd file (F28035.cmd) into the project and having memcpy and InitFlash() in main, it seems the code not run properly in flash.

Also, the pragma was initially put there with #pragma CODE_SECTION (Example_CallFlashAPI,"ramfuncs");

Do I miss any configuration to have the example to load in Flash in the beginning ?

Regards,

Johnny

  • Hi Champ,

    Any chance to have some input here ?

    Regards,

    Johnny

  • Hi Champ,

    Any comment on this ?

    Looking forward to your support.

    Regards,

    Johnny

  • Johnny,

    The native example should have the correct .cmd file included; Example_Flash28035_ROM_API.cmd.  The key addition to this file vs a "regular" cmd is the addition of a "ramfunc" section as below:

     ramfuncs            : LOAD = FLASHA, 
                             RUN = PRAML0, 
                             LOAD_START(_RamfuncsLoadStart),
                             LOAD_END(_RamfuncsLoadEnd),
                             RUN_START(_RamfuncsRunStart),
                             PAGE = 0

    Inside the main.c file "Example_Flash2803x_API.c" there are two additions vs RAM only code and that is the Example_MemCopy function call(that copies the code from Flash to RAM) and the #pragma CODE_SECTION() that are inserted before the functions that we want to run from RAM.

    void Example_MemCopy(Uint16 *SourceAddr, Uint16* SourceEndAddr, Uint16* DestAddr)
    {
        while(SourceAddr < SourceEndAddr)
        { 
           *DestAddr++ = *SourceAddr++;
        }
        return;
    }
    
    #pragma CODE_SECTION(Example_Error,"ramfuncs");
    void Example_Error(Uint16 Status)
    {
    
    //  Error code will be in the AL register. 
        asm("    ESTOP0");
        asm("    SB 0, UNC");
    }
    etc

    Best,

    Matthew