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-F28069M: Saving code to non-volatile memory

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

Greetings for the day,

I am working on LAUNCHXL-F28069M. I've developed a code for calculation of parameters of Encoder like RPM, direction using Ecap and I'm displaying it on the OLED display (I2C comm), the code is all good but I'm facing trouble to load the code in non volatile memory or flash memory. My board loses code as soon as I reset it or cycle power and of course for my application I'll need it to restart everytime I cycle power. I read through portal and tried various suggestions and answers and yet I can't load or read from the flash.

I've tried following answers:

- Adding _FLASH in Sysctrl or to predefined Symbols : https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/539257/f28075-programming-and-running-from-flash

- Adding Non RAM .cmd file and excluding the RAM_lnk.cmd file: https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1262270/tms320f28335-flash-run/4779984?tisearch=e2e-sitesearch&keymatch=RAM%20LNK#4779984

- Toggling S1 bootmode switches (Though setting switch 3 to 0 disconnects my board, so I could only toggle 1 and 2)

- Trying different settings in Debug configuration


EDIT :  I've realised I'm successfully saving my program into the flash by checking the flash memory.

- Cleared Memory                                                                          - Programmed Memory

        

(I've also verified that RAM_lnk.cmd doesn't alter the flash memory)

though I'm now able to save the code in the flash, it's still not getting executed, is there any alteration I need to do with my connections or code?

  • Hello Divyesh,

    Have you verified that the code in the .text section of the linker command file is using the Flash memory? If you want to see a working example, you can load one of the Flash examples from C2000Ware to see the linker command file (which is where most of the work will need to be done). Once you have your program loaded to Flash and running, to modify Flash at runtime you will need to use the Flash API from RAM.

    For Flash C2000Ware examples which also include some Flash API usage, refer to C2000Ware_5_01_00_00device_support\f2806x\examples\c28\flash_programming. Note that you only need to do the memcpy if you plan on running the code from RAM but storing it in Flash so resets won't prevent the program from running afterwards.

  • Hello Omer,

    Thank you for your response, I'm not sure how do you verify the .text in the .cmd file, I mean .text file states to allocate program in "FlashA_B" of page 0, the FLASHA_B holds memory address from 0x3F0000 to 0x3F7F80, which I've verified are being updated.

      

    I found the F28069M.cmd file in C2000Ware_5_01_00_00\device_support\f2806x\common\cmd including which I could see the memory addresses being updated or cleared (As shown in the picture previously). So estimating I'm able to update the flash, I tried calling memcpy function (as mentioned below) but I run into errors like "errors encountered during linking" or "unresolved symbol remain" 

      

    I as well tried updating the flash example but I run into the error "program won't fit into the memory" on .ebss of cmd file

  • I'm not sure how do you verify the .text in the .cmd file, I mean .text file states to allocate program in "FlashA_B" of page 0, the FLASHA_B holds memory address from 0x3F0000 to 0x3F7F80, which I've verified are being updated.

    Based on your screenshots, your program should be loaded to Flash correctly. Let me know if you don't see the program at the specified addresses at the boot up of your device.

    So estimating I'm able to update the flash, I tried calling memcpy function (as mentioned below) but I run into errors like "errors encountered during linking" or "unresolved symbol remain"

    Please take a look at the console output and find what symbols are not properly defined. You'll need to find out what these are and if you have the proper header files included so that the compiler can locate the variables/functions.

    I as well tried updating the flash example but I run into the error "program won't fit into the memory" on .ebss of cmd file

    Since you've already determined what memory section is full, you can add more memory units (preferrably contiguous locations) to the section. To do this, you can replace ".ebss : > RAML2_3, PAGE=1" with ".ebss : >> RAML2_3 | RAMx, PAGE=1", where RAMx is another RAM unit in page 1 (you need to choose memories within the same page of the same memory type).

  • Thank you for your aiding replies,

    Based on your screenshots, your program should be loaded to Flash correctly. Let me know if you don't see the program at the specified addresses at the boot up of your device

    I can see the code being successfully updated at the address 

    Since you've already determined what memory section is full, you can add more memory units (preferrably contiguous locations) to the section. To do this, you can replace ".ebss : > RAML2_3, PAGE=1" with ".ebss : >> RAML2_3 | RAMx, PAGE=1", where RAMx is another RAM unit in page 1 (you need to choose memories within the same page of the same memory type).

    I previously tried doing that but encountered the same result, I've tried adding ".ebss: > M0SARAM | M1SARAM, PAGE = 1" or allotting whole M0SARAM to .ebss and M1SARAM to others. none favoured.

    Please take a look at the console output and find what symbols are not properly defined. You'll need to find out what these are and if you have the proper header files included so that the compiler can locate the variables/functions.

    I could figure out the unresolved symbols :
    _RamfuncsLoadSize ./main.obj
    _RamfuncsLoadStart ./main.obj
    _RamfuncsRunStart ./main.obj 

    this functions are not declared in the code, so I had used RamfuncsLoadSize,RamfuncsLoadStart and RamfuncsRunStart in my main code, I did update them in the cmd file as well, like I've tried doing both "using _Ramsfuncs in my main program, while keeping the F28069M.cmd as it is" and "using Ramfuncs in the main function and then updating them in the .cmd file" yet I'm forwarded to the following error.

       

    I did try adding:

    extern Uint16 RamfuncsLoadStart;
    extern Uint16 RamfuncsLoadEnd;
    extern Uint16 RamfuncsRunStart;
    extern Uint16 RamfuncsLoadSize;

    to my main file, which changes the error to the warning saying "#169-D argument of type "Uint16" is incompatible with parameter of type "const void *__restrict__""

    EDIT: The issue is resolved, I added "Example_MemCopy(Uint16 *SourceAddr, Uint16* SourceEndAddr, Uint16* DestAddr)" function from flash programming and it worked, thank you for your assistance through out.