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.

LAUNCHXL-F28379D: Failed on using FLASH API functions located in another C file, enter unexpected interrupt, compiler warning on "creating output section "ramFuncSection" without a SECTIONS"

Part Number: LAUNCHXL-F28379D
Other Parts Discussed in Thread: C2000WARE

Hi expert,

I am implementing below function based on F28075's "flash_programming" example project which located in "C:\ti\c2000\C2000Ware_1_00_05_00\device_support\f2807x\examples\cpu1\flash_programming\cpu01".

There is a "Example_CallFlashAPI();" call in main loop located in "flash_programming_cpu01.c". There original example is fine on my test, but when I tried to move the definition of this function to another C file named "flash_program.c" in the same project, then the problem happens.

Phenomenon one: There is a warning in the CCS reads below

  

Phenomenon two: Program run into unexpected ISR once step come into function "Example_CallFlashAPI" shown below

I will attach the code in this post. Could anyone give me some advice on how to solve this problem? Thanks!

F28379D_FLASH_API.zip

  • Sheldon,

    Add below to your flash_program.c file.  

    #ifdef __TI_COMPILER_VERSION__

       #if __TI_COMPILER_VERSION__ >= 15009000

           #define ramFuncSection ".TI.ramfunc"

       #else

           #define ramFuncSection "ramfuncs"

       #endif

    #endif

    If you check the linker cmd file provided with flash programming example (C:\ti\c2000\C2000Ware_1_00_05_00\device_support\f2807x\examples\cpu1\flash_programming\cpu01\flash_programming_cpu1_FLASH.cmd), you will notice that .TI.ramfunc (or ramfuncs based on the compiler version) section gets allocated to a memory region defined in your cmd file.  It will be mapped to Flash for load and RAM for run, since Flash API can not be executed from Flash.  Make sure you did not delete it.

    Regarding the illegal ISR, make sure you use memcpy() to copy the .Ti.ramfunc content to RAM from Flash before you execute any code that is allocated to this section.

    memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);

    Thanks and regards,

    Vamsi

  • Hi Vamsi,
    I have solved the problem. I use the wrong section name, it should be ".Ti.ramfunc". Also, in the #gragm, there seems a missing of "" on section name in the original example project.
    Thanks!
  • Sheldon,

    Glad that it helped. Can you point me to the example file where the pragma has a mistake? I can file a ticket to fix it. Thank you.

    Best regards,
    Vamsi
  • Hi Vamsi,
    I recall what I said, as you mentioned in another post, there is a #define ramFuncSection ".TI.ramfunc" which I didn't pay attention to.
    Thanks