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.

TMS320F28335: flash jump application 1 to application 2 issue

Part Number: TMS320F28335

I am working on a TMS320F28335 device with the following flash memory usage:

  • Flash A → Bootloader

  • Flash D → Application 1

  • Flash G → Application 2

What I am doing

  1. I program Flash A (bootloader) and Flash D (Application 1) through JTAG.

  2. I build Application 2 and generate a HEX file which is linked to run in Flash D.

  3. During runtime, Application 1 copies this HEX file
    from Flash D → Flash G using the Flash API.

  4. I am using an offset of 0x18000 while writing into Flash G
    and using a jump address at 0x308000 for execution.

  5. The Flash API write into Flash G completes successfully.

 What works correctly

  • If I directly program separate HEX files into
    Flash D and Flash G using Flash API programming,
    both applications run correctly.

  • Direct programming (Flash API or JTAG) works fine.

What does NOT work

  • When Application 1 copies the HEX image from Flash D → Flash G
    at runtime and I attempt to execute it from Flash G,
    the application fails to run.

  • The HEX file was originally built for addresses
    0x320000 to 0x320002 (Flash D address range).

  • When I write the same HEX file into Flash G using an offset and then jump to 0x308000, the application does not execute.

What I believe is wrong

  • There is likely a problem with the offset used while writing,
    or the jump address when executing from Flash G.

What I need

Please check where I am going wrong and suggest the correct method to copy and execute an application from Flash G.

  • Akash,

    I'm thinking you can do something with the LOAD/RUN commands in the linker file, similar to what we show when customers load to flash but run from RAM.

    Since you invoke the API and copy the image from D to G yourself before calling into the function this should work as long as you wait until that happens before calling into it.

    2 steps:

    1)in the .cmd file, add a line like below into the "Sections" portion of the .cmd file.

    flash_reloc : {} LOAD = FLASHD,
    RUN = FLASHG,
    PAGE = 0

    2)In you source code; whatever function(s) you need to run from G, should have be assigned to flash_reloc using a pragma in the header of the .c file like this:

    #pragma CODE_SECTION(functionnamehere, "flash_reloc");
    You can have as many of these #pragmas for the various functions as you need.  Flash G needs to correspond to the start address in Sector G where you are writing the code to with the flash API call.

    This should map everything correctly and let you do what you have mentioned above.
     
    Best,
    Matthew