Conversion DFU-File to Hex-File
- March 4, 2024
- 2 replies
- 5081 views
I try to convert a DFU-File to a Hex-File with the ST-Tool "DfuFileMgr.exe" from the DfuSe_v3.0.6 Toolkit.
The reason for the conversion is, that we have an Update-Application in the field that works with USP-DFU update and the old DfuSe driver. Now we would like to change to a new Application with the CubeProgrammer-API. With the CubeProgrammer-API we can download a HEX-File over DFU-USB. For compatibility reason we would like to use the old DFU-Files, convert it to HEX and upload it over DFU-USB with the CubeProgrammer-API.
I tested the convrersion it with a "round-trip":
1. Start with a given hex-File: test.hex (see attachment)
2. Convert hex-to-dfu with DfuFileMgr.exe => test.dfu (see attachment)
3. Convert back dfu-to-hex with DfuFileMgr.exe => test_00.hex (see attachment)
The generated hex-File test_00.hex has now data on Address 0x0800_0000. The original hex-File test.hex starts on Address 0x0800_C000!!! The converted Hex-File is unusable.
I verified the original and the generated hex file. The wrong code block in the gererated file from address 0x0800_0000 - 0x0800_01E0 (placed on line 516-530 in file test_00.hex) can be found in the original hex from address 0x0801_0000 - 0x0801_01E0 (placed on line 1027-1056 in the file test.hex).
The same is for each section changes 0x0801, 0x0802 and 0x0803. Always a block from 480 bytes from address 0x0000-0x01E0.
Somehow the DfuFileMgr seems to have a problem with the first code block from the original hex file from address 0x0800_C000 - 0x0800_C1D8. The next row starts on 0x0800_C1E0. The addresses from 0x0800_C1D9 - 0x0800_C1E0 are not defined in the original hex-file.
Exact the first code blocks from 480 Bytes are missplaced on the entries of the sections 0x0800, 0x0801, 0x0802.
My questions:
1. Can the DfuFileMgr.exe handle undifined code blocks in a HEX-file?
2. Is it "only" a problem for the convertion from dfu to hex or is the dfu file itselfe also wrong for hex files ith undefined code blocks?
