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.

MSPM0G3507-Q1: How to fill 0xff in Hex

Part Number: MSPM0G3507-Q1
Other Parts Discussed in Thread: SYSCONFIG

Hi Champ,

when use tiarmhex  to generate Hex ,  any solution to generate the HEX file with unused FLASH filled with 0xff?

  • Unused, erased flash is already at 0xFF.

  • Hi Huihuang,

    Keith is correct that erased flash should be 0xFF by default on all existing MSPM0 devices.

    If you still want to do this explicitly though, you could add a FILL value in the linker (this requires you to use a project with a generic linker and linker generation disabled in sysconfig).

    For the below I just copied the device_linker.cmd from the generated source location and pasted it into my project before disabling linker generation in sysconfig. Add the fill value to flash and it should show up in your ARM hex utility generated output file. 

    Best Regards,
    Brandon Fisher

  • Brandon, 

    I know after erase the FLASH will be 0xFF, but some customer required the output HEX filled with 0XFF.

    This is the reason why i post this question.

    I have try the method you provide, you can refer to below:

    but seems not all hole will be filled by 0xff( like below line 34-36), could you advise the reason?

  • Hi Huihuang,

    I'm not that familiar with Intel hex format, but there will be 00's as part of the flash memory of your application, and this looks to be considered part of the application memory.

    if that is valid program data, then if you changed to 0xFF may alter the output/behavior of your code.

    Best Regard,
    Brandon Fisher

  • Brandon,

    If you are not familiar with the Hex fill, please involve the expert.

    Actually , if the fill work, each date line length will be with 0X20.

  • Huihuang,

    If you are not familiar with the Hex fill, please involve the expert.

    Actually , if the fill work, each date line length will be with 0X20.

    What are you basing this on? 

    My understanding here is that the length of any line is variable and based on the byte count value that appears after the start code (see below)

    From (https://en.wikipedia.org/wiki/Intel_HEX).

    Line 34 has a length/byte count of 0x10, and the start address is 0x0240. The next line starts at 0x0250, so therefore there is no gap in memory.

    Similarly, based on my reading of your file output, line 36 is 0x18 bytes long, and starts at 0x0270. So line 37* starts at 0x0288.

    If you have an alternate way of interpreting this file output please let me know, but I don't see anything from the Intel Hex format that requires uniform data record length to avoid gaps in memory. 

    Best Regards,
    Brandon Fisher