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.

Compiler/LAUNCHXL-F28377S: Altering data in Flash

Part Number: LAUNCHXL-F28377S

Tool/software: TI C/C++ Compiler

I want to store some data in flash separate from my program. My program runs from RAM after automatically copying a constant array from flash to RAM.  I want to be able to alter the constant array in flash so the next time the program loads, it uses the newly flashed data.  I have three questions:

1. Can I flash just the constant array (while leaving the program alone -- for security reasons, I want them separate)?

2. Can I use the DSS Java routines to do the flashing of the data in the constant array? (If so, how?)

3. I can't seem to tell from the MAP file where the data resides in flash prior to being loaded in RAM. (It only says where the data will be in RAM).  Where can I find this information so I know where to load the data?

Thank you

  • Neil Singer,

    1. Yes, you can. Allocate the constant array to a dedicated Flash sector (don't use this for other sections like .text etc) using #pragma DATA_SECTION() directive. This way, you can erase that sector alone and program the new data as needed. For this, you can select the sectors that you want to erase in the TI's CCS Flash Plugin or UniFlash. And load the updated coff file (with changed data) using the "Avoidance Range" feature. Using this feature, you can provide the ranges that you don't want the Flash tool to load - this way Flash tool will erase and program only the updated data taken from your coff file. Alternatively, you can create a separate coff file containing only the constant array and load it (select the erase settings so that Flash tool will erase only the sectors that are part of the coff file).

    2. I will ask our DSS expert to help you on this.

    3. By using he #pragma DATA_SECTION() directive, you would know the location since you will tell the location using #pragma.

    Thanks and regards,
    Vamsi
  • Neil,

    For 2), you cannot use DSS APIs to directly write to flash memory on C2000. You can only write to flash memory via a Program Load operation (ie; debugSession.memory.loadProgram()).

    Thanks,
    Ricky
  • Vamsi and Ricky,

    Thank you for the information. This is very helpful.

    Ricky -- If I create a COFF file with the just the data can I do a loadProgram() and just load the range with my data (as Vamsi suggests)?

    If So, What is the best way to create a COFF file with just the data?
    Ideally I would like to create it from C or Java. Is the format of an array simple enough to create from "scratch"?
    If so, what is that format?

    Thank you!
  • Neil,

    If you just want to program a particular pattern onto flash memory, I would suggest creating a binary file and then loading the binary file into flash memory using UniFlash. You can create the binary file using a text editor that supports hex formatting and entering your pattern that way.

    When loading a binary file, you will need to specify the start address in UniFlash. I suggest trying it out with a small pattern first to make sure you have the format/endian correct in your hex file (you can use the Memory view in UniFlash GUI to check the flash content after loading).

    Thanks,
    Ricky
  • Neil,

    Hope you are able to program the pattern in Flash by loading a binary file using UniFlash.
    I am closing this thread now. You can open a new thread if you have further questions.

    Thanks and regards,
    Vamsi