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.

DSS/C2000 - Example of writing a single word to flash using DSS

Hi,

I am tyring to learn some basics of using the DSS for a number of tasks one of which is writing a value to flash memory. From the documentation it looks like I should be able to write a single word to flash memory (assuming it is erased) using the memory.writeWord call of the API.  I can sucessfully setup my debug session, and read data out of the memory address I wish to write (0xFFFF). I then halt the target, and attempt to write using memory.writeWord and I get an error 

SEVERE: Errors during memory.writeData(): Address: 0x3f4004 Error: 0x20000
SEVERE: Error writing memory: Errors during memory.writeData(): Address: 0x3f400
4 Error: 0x20000

I have looked though the API, the wiki, and the examples but haven't found anything that shows what steps are necessary to use the DSS to write to flash. Can someone point me to and example or other document that shows the process?

  • I'm not sure there is a way to write to a single location without doing a "load coff file". The coff file load will invoke the flash programmer when needed. I've moved this to the CCS forum to see if the experts there have any suggestions.
  • Jon,

    You can try using the memory.loadBinaryProgram( String sFileName, long startAddr ); API in DSS. This will invoke the Program Loader and in turn, the Flash Programmer to write the file.

    To write just a single word, you can create the binary file (parameter 1) by using an hex editor and entering the 'word' you want to write (ie; 0xABCD) and save the file. The second parameter is the address in Flash you want to write to.

    Note that this will invoke the Flash Erase sequence as well, depending on your settings.

    Try it out and let me know if it works for you. Please let me know if you have further questions.

    Thanks,
    Ricky
  • HI Ricky,

    Thanks for the reply - creating a binary file and using loadBinaryProgram works just fine. I do have a followup question - if I want to write to load a program and load a binary file to the same sector, can I do that? If so how?

    I was thinking that I could:

    1. Erase the sector
    2. Load the program
    3. Load the binary file

    But it seems like the flash programmer automatically erases the sector to be loaded with the binary file which erases the program that was just loaded. Is there an option to set which will disable the erase on load? 

    Thanks,

    Jon

  • Actually I got it figured out. I just need to set the erase sector option to False before loading. All works well. Thanks.