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 Scripting - Erasing Individual Flash Segments

Other Parts Discussed in Thread: MSP430F249

Hello,

There appears to be a difference in notation between the DSS API and the User Guide for the MSP430F249.

In the DSS API, the following example is given:

// set the sectors to erase and erase flash
mySession.options.setBoolean(SECTORA, true);
mySession.options.setBoolean(SECTORB, false);
mySession.options.setBoolean(SECTORC, true);
mySession.options.setBoolean(SECTORD, true);
mySession.options.setBoolean(SECTORE, false);
mySession.flash.erase();

The User Guide for the MSP430F249 states the following:

 - Flash memory has n segments of main memory and four segments of information memory (A to D) of 64 bytes each. Each segment in main memory is 512 bytes in size.
 - Segments 0 to n may be erased in one step, or each segment may be individually erased.
 - Segments A to D can be erased individually, or as a group with segments 0−n.  Segments A to D are also called information memory.

Using DSS, I would like to erase main segment 1 only.  I have tried following the example script above (since that's all there is to work with) and tried setting the Booleans SECTOR1 and SEGMENT1 however neither of these exist.  Is there a way to erase only this segment (and if so, how do I reference it)?  Are there functions for performing the writes as well or must we really resort to opcodes here?

Many thanks,

--

Joshua

 

 

  • Joshua,

    The DSS Flash APIs only apply to a subset of devices which, unfortunately, does not include MSP430. DSS does not support erasing specific sectors on MSP430. The flash API does apply to the C28x and TMSx70 families.

    MSP430 flash erase operations are currently limited to what you can do on a program load. You can write to flash by just writing to the memory location you want to change.

    I will file a bug report to improve the documentation, and an enhancement request to extend this API to include MSP430.

  • Hi Andy,

    Thanks very much for your response.  I just need a little clarification if you don't mind though please! 

     

    Andy said:

    MSP430 flash erase operations are currently limited to what you can do on a program load.

    To be precise, are you referring to the target download options for the debugger (i.e. such as the following line of script)?

    debugSession.options.setString("MSP430DownloadOptions", "Retain unchanged memory");

     

    Andy said:

    You can write to flash by just writing to the memory location you want to change.

    Ok here's where I really need some clarification if you don't mind as I want to make sure that I don't cause any damage to the target.

    <b>7.3.3 Writing Flash Memory</b>

    ...<br/>

    A flash word (low + high byte) must not be written more than twice between erasures. Otherwise, damage can occur.

    ...<br/>

    When I write directly to a memory location in Flash via DSS (or Code Composer), does the above rule still apply or is there something else at play (perhaps in this case we are only changing a CCS/DSS representation of the memory, or there are drivers for ensuring a safe/correct write)?

     

    Andy said:

    "I will file a bug report to improve the documentation, and an enhancement request to extend this API to include MSP430.

    Thanks!

     

    --

    Joshua

     

  •  

    Joshua Lawes said:

    To be precise, are you referring to the target download options for the debugger (i.e. such as the following line of script)?

    debugSession.options.setString("MSP430DownloadOptions", "Retain unchanged memory");

    Correct. 

     

    Joshua Lawes said:

    When I write directly to a memory location in Flash via DSS (or Code Composer), does the above rule still apply or is there something else at play (perhaps in this case we are only changing a CCS/DSS representation of the memory, or there are drivers for ensuring a safe/correct write)?

    Under the covers, the driver does something like this for each memory write: determine which sectors will be affected by writing the data block, save the current data, erase the affected sectors, merge the new data with the original data, write the merged data back to flash.   Since there is always an erase with each write, it will always be safe. This isn't going to be great when writing a lot of individual bytes but could offer a solution when doing block writes. Flash can wear out too so writing a lot of individual bytes might not be a good idea.

    I hope that helps.

    Andy

  • Ok Andy, that's great.  Thanks very much for all of your input.  So when writing to flash during runtime, I'll use the array version of the DSS Memory method readWord so that the data covered by the input parameters always corresponds to a full sector.

      long[] readWord(int nPage, long nAddress, int nNumWords)
              Read mulitple words (of the default word-size for the current target) from the target and return the result as an array of unsigned integers.

    Thanks again!

    --

    Joshua