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.

TMS320F28388D: Store Variables in Flash

Part Number: TMS320F28388D

Hello everyone,

I am developing software for the CM of the TMS320F28388D and I want to store some variables inside the FLASH-Memory. When doing IPC I was able to specify a memory region with the Pragma:

#pragma DATA_SECTION(cpuToCm,   "MSGRAM_CPU1_TO_CM_ECAT")
const static GPC_CPU_TO_CM cpuToCm;

Linker-CMD:
MSGRAM_CPU1_TO_CM_ECAT : > CPU1TOCMMSGRAM0_ECAT, type=NOINIT

Now I tried the same thing for other data
#pragma DATA_SECTION(CiA402ProfileObjects,   "FLASH_OBJECTS")
PROTO TOBJECT OBJMEM CiA402ProfileObjects[MAX_TOTAL_AXES][13];

Linker-CMD:
FLASH_OBJECTS : > CMBANK0_SECTOR9

With this, the linker is placing the Variable inside the FLASH-Memory, but the memory isn't initialized. All I read from the memory location is 0xFFFF.

So my question is, how do I store read-only Variables inside FLASH-Memory and how can I initialize them during the FLASH-Process. (On the CM of the TMS320F28388D)

Thanks and Regards,

Marcel Kummer.

  • Hi Marcel, 

    Are you looking at the Program or Data view in the Memory Window in CCS? When you are programming the project into the device, can you see the Flash API first erasing the sector and then programming it?

    Thanks, 

    Anu

  • When I select the CM in the DebugView the dropdown where I can select (data/Program/IO/Peripheral) disappears. Hence I can only watch the default memory view. The memory view and the expression windows both show 0xFFFF.
    (CCS Version: Version: 10.1.1.00004 )

    When flashing, I can see every FLASH-Bank being deleted. When the Application gets flashed I can only see .text.

    Is it a problem if the variable isn't const?

  • Marcel, 

    I will get back to you in a day. 

    Thanks, 

    Anu

  • Hello Anu,

    did you find something that helps me?

    Regards,

    Marcel.

  • Marcel, 

    My apologies for the delay, I am still looking into this. One question for you - is anything else being written to this sector? Flash erases occur by sector, if there are flash contents that need to be modified during the execution of the program, it would need to go in a separate sector. 

    Thanks, 

    Anu

  • Hello Anu,

    no there is nothing else in this Sector. I chose an empty Sector in the linker CMD file.

    And I also don't want to do changes to the data during execution. That's why I want to put the data into FLASH in the first place.

    Regards,

    Marcel.

  • Marcel, 

    I tried reproducing the issue on my side with a few tests and saw that having the const keyword does make a difference in whether the contents of the variable are written to Flash when using the DATA_SECTION pragma. I am assuming that you will at least be reading from the array correct? If you are not reading from the array, you will also need a RETAIN pragma. 

    Thanks, 

    Anu