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.

MSP-FET: MSP FLasher Segment Erase - regex error

Part Number: MSP-FET
Other Parts Discussed in Thread: MSP430F2370, , UNIFLASH

Hi Support,

i got problems with reprogramming a single memory segment (information memory of MSP430).

Software: MSP FLasher v1.3.20

Hardware: MSP FET FLash Emulation Tool

First of all:

I read out the information memory of the chip with ./MSP430Flasher -r [test.hex,INFO] -v -z [VCC]

Everything works! The Tool writes the whole information memory into the test.hex file.

Now i changed some parameters in the test.hex file. After that i tried to write the Intel Hex File with the changed parameters back to the chip with ./MSP430Flasher -w test.hex -v -z [VCC] -e ERASE_SEGMENT

The output of the MSP FLasher says:

terminate called after throwing an instance of 'std::regex_error'

what()_ regex error

The User Guide MSP Flasher user's guide (Rev. E) says in order to reprogram a memory segment you have to provide an Intel Hex or a TI-txt file. I did that. 

best regards

  • Hi Julian,

    The regex error appears when there is an issue parsing your command. 

    Since you are trying to write to the information memory you would need to do the -u trigger to unlock the information memory to write to that section.

    The MSP Flasher User's Guide Section 3 should help you here, there is are example commands in section 7.

    Regards,

    Luke

  • Why you are using hex binary? TI txt format is simple, where you can change any byte from binary file. In hex file there is checksum foreach line, and if one byte is change, also checksum in the same line must be updated.

  • Hi,

    i followed your advice with the additional argument -u but i am still getting the same error.

    In Section 7 there are some examples but none of them with the option -u or -e.

    I also tried to unlock the memory first with option -u and afterwards writing to it with -e and -w but without success.

    best regards

  • Hey,

    i already got a functioning program working with intel hex. That is the only reason i am using the format.

    regards

  • I looked at the source for MSPFlasher and it appears as though it is using the C++ regular expression library to parse the hex file. Which suggests that there is something wrong with your data file.

  • That was my guess too.

    But i cant even write the .hex file back to the information memory that i previously read out with the command ./MSP430Flasher -r [test.hex,INFO] -v -z [VCC].

    This file has to have the right syntax and data.

  • Hi Julian,

    Just for a simple checks.

    Have you been able to program in the MAIN section? The simple GPIO toggle example would be good example to use. I don't know what device you're using but you can find a bunch of examples in resource explorer on dev.ti.com or if you give me the device I will find the example code for you.

    What was the command you used for the write after reading the info? 

    "But i cant even write the .hex file back to the information memory that I previously read out with the command ./MSP430Flasher -r [test.hex,INFO] -v -z [VCC]." - Were you writing in an unaltered version back just to see if you don't get that error.

    Regards,

    Luke

  • 
    

    Yes that was my intention. Writing the unaltered version was a Check for errors in my "modified" file.

    Device: MSP430F2370

    Programmer: MSP-FET FLash Emulation Tool

    Programming the MAIN Section is working absolutely fine. Therefore i am using the command: 

    ./MSP430Flasher -w /home/../V1.3.hex -v -z [VCC]

    Command for reading information memory:

    ./MSP430Flasher -r [test.hex,INFO] -v -z [VCC]

    Command for writing information memory:

    ./MSP430Flasher -w /home/../test.hex -v -z [VCC] -u -e ERASE_SEGMENT -u

     

    best regards

  • Hi Julian,

    I went through and programmed a simple GPIO toggle then did reads and wrote the same code back in. I did not get the regex error when I went through this, here were the steps and commands I did.

    Main Programming Check

    1. MSP430Flasher -n MSP430F2370 -r [output.txt, MAIN]
      1. This command was used to read with the TI format for check, got no errors
    2. MSP430Flasher -n MSP430F2370 -r [output.hex, MAIN]
      1. This command was used to read with the intel hex format for test, got no errors
    3. MSP430Flasher -n MSP430F2370 -w output.txt -v -z [VCC] -e ERASE_ALL
      1. This check was for a full erase and programming using the TI format, got no errors
    4. MSP430Flasher -n MSP430F2370 -w output.hex -v -z [VCC] -e ERASE_ALL
      1. This check was for a full erase and programming using the Intel Hex format, got no errors

    Info Programming Check

    1. MSP430Flasher -n MSP430F2370 -r [infoTest.txt, INFO]
      1. This command was used to read the info section with the TI format, got no errors
    2. MSP430Flasher -n MSP430F2370 -r [infoTest.hex, INFO]
      1. This command was used to read the info section with the Intel Hex format, got no errors
    3. MSP430Flasher -n MSP430F2370 -w infoTest.txt -u -v -z [VCC] -e ERASE_SEGMENT
      1. This command was used to program the TI format into the info section specifically, keeping the main untouched. Got no errors
        1. Important to note, in the hex file the first line tells what memory section to erase
    4. MSP430Flasher -n MSP430F2370 -w infoTest.hex -u -v -z [VCC] -e ERASE_SEGMENT
      1. This command was used to program with the Intel Hex format. Got no errors

    I went and removed a hex digit from the first line in the info section. The MSPFlasher exited with code 59 and stated "error within Intel Hex File"

    Can you send a screen shot of the MSP Flasher's output like the image below when you get the "std::regex_error"?

    Regards,

    Luke

  • Hey Luke,

    that is the output i am getting:

    I got the same arguments and the test.hex file is untouched after reading with 

    ./MSP430Flasher -r [test.hex,INFO] -v -z [VCC]

    My test.hex file looks like this

    :10100000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0
    :10101000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0
    :10102000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD0
    :10103000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC0
    :10104000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB0
    :10105000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA0
    :10106000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF90
    :10107000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80
    :10108000FFFFFFFFFFFFFFFF7F66077FFFFFFFFF01
    :10109000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF60
    :1010A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF50
    :1010B000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF40
    :1010C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF30
    :1010D000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF20
    :1010E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF10
    :1010F000FFFFFFFFFFFFFFFF8B8F918E828D4687E3
    :00000001FF

    I dont know if it has an impact but i am working on a linux debian system.

    regards

  • Hi Julian,

    Have you been able to look at Uniflash to do the programming instead?

    Uniflash has a command line interface if you would prefer to stick with command line. Uniflash Quick Start Guide; MSP430 Specific User's Guide for Uniflash

    Our documentation does not mention this regex error and I haven't been able to reproduce it. The file format looks correct for your intel hex, unless the checksums are wrong, but that shouldn't throw a regex error. The command you input was also the same structure as mine unless the parsing has to do with the file location. Have you tried to move the hex file into the ti/MSPFlasher_1.3.20 folder then execute the command?

    Again, I would suggest moving to Uniflash if you proceed to get the regex error.

    Regards,

    Luke

  • Hi Luke,

    there seems to be a problem with the linux version of the MSP Flasher.

    On Windows everything is working fine.

    If i am doing the exact same on linux i get repeatedly "regex error".

    Same steps, same commands, same  software version.

    I will take a look at the Uniflash and try to make it work.

    regards

  • Hi Luke,

    i installed Uniflash and tried to read out memory from my device.

    The Gui based Version of Uniflash gives you the option to export the memory as Intel-hex. Thats exactly what i need and it is working fine.

    Does the command line tool dslite have such an option too? i can not find a way to save the memory as Intel-hex.

    Currently i am using this command to read out the memory:

    dslite --mode memory -c MSP430F2370.ccxml -r 0x1080,16 -o test.hex

    But the format of the test.hex file is not suitable.

    regards

  • Hi Julian,

    Looking through Uniflash, the command line tool will output either a coff or binary format and doesn't have a TI-TXT format or Intel Hex option. The default is binary so the file you get from your command is probably a binary version (when I did the same command it gave me a binary file, regardless of the file type extension). I will contact the Uniflash team to request adding TI-TXT format and Intel Hex format on future versions.

    If you need the Intel-Hex format I would suggest continuing with the GUI version of Uniflash while developing your project. Or convert the binary output file to intel hex.

    Glad that the MSPFlasher worked on windows, which would be why I could get it working on my machine while you got the regex error on the Linux. Sadly, MSPFlasher won't be receiving anymore updates (currently at the time of this post).

    Regards,

    Luke

  • Part of the problem is that lack of a good error message. The code just relies on the default error scheme. I haven't dabbled in C++ programming for a long time but a quick search turns up examples of using the try/catch exception system with regex. Adding that to the code should help narrow down the specific reason for the error.

    It had been a while since I grabbed a copy of MSP430Flasher so I installed the most recent. I noticed that it says that erase segment does not work with Linux unless you recompile the code. Since you need to compile it anyway, you can add the exception handling.

  • Hi Luke,

    i am still trying to get it work for Uniflash.

    i am reading the Information memory with the command:

    dslite --mode memory -c MSP430F2370.ccxml -r 0x1080,8 -o filename.bin

    Output: binary file with Information memory

    If i try to write this binary file back to the device with:

    dslite --mode load -c MSP430F2370.ccxml -f C:\ti\uniflash_8.0.0\filename.bin,0x1080

    everything works!

    But my Intention is to modify some Information in the binary file and then write it back..

    If i change any of the values in the binary file and then write it back it says:

    How can i do this? Do i have to add anything? Is --mode load the right command?

    I obviously changed the values at the addresses 0x1088,0x1089 and 0x1090 but thats what i want..

    regards

  • Hi Julian,

    I'm going to check with our internal teams to see if they have further insights into this. I do see that the Flash mode is a more complex version of the load mode, which seems to allow you to skip verification by omitting the verification option. I would caution using this though, no verification can lead to unknown consequences depending on what you are programming, especially messing with non-main.

    I will get back to you with further information on Wednesday, September 7th at the latest.

    Regards,

    Luke

  • Hi Julian,

    Please use the --mode Flash 

    As you are writing to the information memory and not main memory then an additional option needs to be added to the command. By default only the main memory is erased.

    1. To erase both the main and information memory

    Add -s MSP430DownloadOptions="Erase main and information memory"

    or

    2. To erase a specific section in memory

    Add -s MSPDownloadOptions="By Address Range (specify below)" -s MSP430EraseStartAddress="0x1088" -s MSP430EraseEndAddress="0x1090"

    Just an additional tip to convert the Uniflash GUI to the CLI, under the settings tab, the option equivalent will be -s ID="value"

    Regards,

    Luke

  • Hi Luke,

    this is working on Windows.

    Again i need a solution for Linux.

    If i am using the same commands on the linux shell i am getting a Syntax Error for the Symbol "(". 

    The option -s MSPDownloadOptions="By Address Range (specify below)" does not work on linux shell.

    Is there another way to use these options??

    regards

  • The option -s MSPDownloadOptions="By Address Range (specify below)" does not work on linux shell.

    The ID being specified is incorrect. The correct ID is: MSP430DownloadOptions

    When passing in the string, wrap it with single quotes. 

    Example:

    -s MSP430DownloadOptions='"By Address Range (specify below)"'

**Attention** This is a public forum