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.

MSP430F5529: Reserve flash for data - Keeps erasing flash during

Part Number: MSP430F5529

Tool/software:

I have updated my linker file to reserve some space out of flash for data only.  I'm using large code model, which looks to start putting code at 0x10000 in FLASH2 region first, thus is why I carved out the memory from the FLASH section.  I can see my application write to the memory and when I read it back via display in the memory window it appears correct.  However, when then perform another debug session the memory gets overwritten.

I have tried updating settings in the (.json) and selecting only a range for it to erase, but that doesn't seem to work.

    FLASH                   : origin = 0x4400, length = 0xB780  /* Used to end at 0xFB7F */
    DATAFLASH               : origin = 0xFB80, length = 0x0400  /* Reserved 1024 bytes */
    FLASH2                  : origin = 0x10000,length = 0x143F8 /* Boundaries changed to fix CPU47 */
  • In "Project->Properties->Debug->MSP430 Flash Settings->Erase Options", select "Erase and Download necessary segments only".

    Unsolicited: I think Flash segments are 512 bytes on the F5529. You should probably align DATAFLASH (origin and length) on a 0x200 boundary so you can erase it later.

  • I have tried this option without success.  I am aligning on 512 boundary. Below is the region definition from linker file.  I think there could be an issue with the settings not being saved when I make changes in Project->Properties->Debug->MSP430 Flash Settings->Erase options. Also, I don't have the exact path you are talking about to get to MSP430 Flash Settings.  I have provided a screenshot.


        .dataflash (NOLOAD): {
            __dataflash_start = .;
            . = . + DATAFLASH_SIZE;    /* reserve 1024 bytes (DATAFLASH length) */
            __dataflash_end = .;
        } > DATAFLASH
  • What do your MEMORY specifications look like now?

    You won't be able to fit a 512-byte aligned, 1024-byte area between 0xFB80 and 0xFF80 (the start of the interrupt vectors). I expect you'll have to start the area at 0xFA00 (putting the second segment at 0xFC00). Can you put it in the "high Flash" area (FLASH2)?

    I tried the "necessary segments only" option in CCS 12.6.1 and 20.3.0, and it seemed to stay set after closing/re-opening CCS.

  • I'm using the LARGE flash model and it is my understanding that it utilizes the FLASH2 area first, so I'd rather put it into FLASH area at the end.  I don't see where the interrupt vectors are defined.  (INT00-RESET)  Can you tell me what those are.  I'm going to try and move it in the area before like you suggested if that works.

  • I put it at 0xFA00, and it still doesn't fix the issue.  One thing to note is that I change to "Erase and download necessary segments only (Differential Download)", and when I start a debug session again it goes back to the default of "Erase main memory only".  So I still think there is something else wrong.  I would cut and paste screen shots here, but it doesn't seem to work.  Maybe we can setup a zoom or something?

    DATAFLASH_SIZE = 0x0400;
        FLASH                   : origin = 0x4400, length = 0xB600  /* Was 0xBB80 */
        DATAFLASH               : origin = 0xFA00, length = 0x0400  /* Reserved 1024 bytes */
        FLASH2                  : origin = 0x10000,length = 0x143F8 /* Boundaries changed to fix CPU47 */
  • I observe that the "necessary segments" setting seems to stay (and is honored) even after starting (a few) debug sessions. This is the case for CCS v12.6 and v20.3.

    I'm not sure what we're doing differently.

  • Where do we go from here?  Mine isn't working.

  • Unsolicited: I continued experimenting, and began encountering Verification Errors with no particular pattern.

    I then discovered this (old) thread, which suggested using Erase Option "Replace written memory locations, retain unwritten memory locations" instead. It takes visibly longer, but I encountered no Verification Errors.

     https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1000801/msp430f5325-flash-memory-sections-being-erased-on-debugging-start-does-msp-fet-use-mass-or-segment-erase/3697285 

    If you don't encounter this symptom, this observation is probably moot.

  • In my lnk_msp430f5529.cmd, the interrupt vectors are emplaced using a bunch of lines of the form: 

    >    INT00                   : origin = 0xFF80, length = 0x0002
    They are also specified in data sheet (SLAS590P) Table 9-1.
    They're right there in the middle of the Flash space, which sometimes makes things awkward.
  • [Sorry, I missed your post.]

    It appears we are doing things differently somehow. 

    1) You mentioned editing a .json; what file is this? I work with the .cmd file in the Project, along with the Project->Properties. I'm wondering if you're editing some CCS-generated file.

    2) You mentioned that your path to the MSP430 Flash Settings was different from mine. What is yours?

    3) How do you invoke the debugger? in CCS v20.3, I found 3 different methods, and none of them changed the Flash settings. (I don't recall CCS ever changing my Flash settings on its own.)

    4) What CCS version are you using? I've been supposing v20.3.

    You can use the "Insert->Image" thing (at the bottom of the Forum edit box) to insert images.

  • 1). I'm no longer changing the .json it is auto created by the tool.

    2). First thing, to not for the path, is that it doesn't exist unless you connect to the target with the debugger first by clicking the debug/play button.

    One you are stopped in main, from the menu I select Run->Debugger Properties->MSP430 Flash Settings.   Then a screen/dialog box pops up where you can change the settings you have recommended.  There is a Save&Close button on the lower right that I press after changing the settings.

    3). I click on the green play/debug option.  To start CCS I double click on the icon.  

    4). Version: 20.3.0.14__1.9.0

    Insert Image doesn't work in my browser.  I put the file name with the path in the "url/file" click OK and nothing happens. 

  • 1) I just saw this in another forum. This is someone who is editing .theia/launch.json, and the settings are ignored/overwritten. The claim is that this behavior is new for v20.3.0

     https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1574337/mspm0g3507-issue-when-i-flash-or-start-a-debug-session-in-ccs-the-entire-flash-is-being-erased-even-though-the-configurations-that-work-in-uniflash-and-ccs-operate-expectedly 

    2) Once you're stopped in main(), the program has already been loaded, so it's too late. What do you see at Project->Properties->Debug->MSP430 Flash Settings->Erase options? (I don't have my equipment here, so I can't investigate what that Run option is.)

    3) I'm not familiar with that icon, but I'll see if I can find it. [Edit: I usually use right-click->Debug Project. I also found 2x items in the (I think) Run menu.]

    In the Insert->Image, did you click UPLOAD? (The word itself is a "button".)

  • I can't type everything out and I can't insert images here.  Can we setup a zoom?

  • 2A) I found Run->Debug Properties; when I make changes to the Flash Settings, they appear to be reflected in the Project Properties (as expected). Setting them there is still too late, though.

    Run->Debug Properties:

    Project->Properties:

    [Edit: Removed duplicate image]

  • I went back to CCS version 20.1 and now if I high light the project in the explorer window, then in the menu do Project->Properties, then at the bottom there is a Debug that you can click on. Then there is a pulldown box towards the top that is called "Category", this is where you can select MSP430 Flash Settings.  Select "Erase and download necessary segments only", and then click Save&Close button.  It now saves and works as it should.  With all this said, I think there is a problem with the latest version of the CCS software, like the link you provided earlier in this chain someone else is having the same issue.

  • This sounds like progress.

    My CCS claims to be the same as yours (was): 20.3.0.14__1.9.0, but somehow we see different behavior.

    But I'm not going to argue with success.

**Attention** This is a public forum