Bug: STM32CubeProgrammer 2.4.0 CLI, missing STM32_Prog_DB.xml doesn't throw an error, but doesn't work as expected
- March 9, 2020
- 2 replies
- 1498 views
Hi,
I'm trying to slim down the required files to use the STM32CubeProgrammer CLI tool as mentioned in my other question.
I noticed if i was missing the STM32_Prog_DB.xml file from one folder above, the erase operation of the affected sectors fails silently, but no error is reported or mentioned on some firmware files:
> .\bin\STM32_Programmer_CLI.exe -c port=COM3 br=57600 P=EVEN db=8 sb=1 -w .\firmware_silent.hex
-------------------------------------------------------------------
STM32CubeProgrammer v2.4.0
-------------------------------------------------------------------
Serial Port COM3 is successfully opened.
Port configuration: parity = even, baudrate = 57600, data-bit = 8,
stop-bit = 1.0, flow-control = off
Activating device: OK
Chip ID: 0x413
BootLoader protocol version: 3.1
Memory Programming ...
Opening and parsing file: firmware_silent.hex
File : firmware_silent.hex
Size : 25104 Bytes
Address : 0x08000000
Erasing memory corresponding to segment 0:
Download in Progress:
██████████████████████████████████████████████████ 100%
File download complete
Time elapsed during download operation: 00:00:06.701The command finishes with exit code 0.
Afterwards no sector was erased, but the new firmware file was written over the existing flash memory content.
A verification read afterwards failed of course.
Adding the file again works as expected:
> .\bin\STM32_Programmer_CLI.exe -c port=COM3 br=57600 P=EVEN db=8 sb=1 -w .\firmware_silent.hex
-------------------------------------------------------------------
STM32CubeProgrammer v2.4.0
-------------------------------------------------------------------
Serial Port COM3 is successfully opened.
Port configuration: parity = even, baudrate = 57600, data-bit = 8,
stop-bit = 1.0, flow-control = off
Activating device: OK
Chip ID: 0x413
BootLoader protocol version: 3.1
Device name : STM32F405xx/F407xx/F415xx/F417xx
Flash size : 1 MBytes (default)
Device type : MCU
Device CPU : Cortex-M4
Memory Programming ...
Opening and parsing file: firmware_silent.hex
File : firmware_silent.hex
Size : 25104 Bytes
Address : 0x08000000
Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 1]
Download in Progress:
██████████████████████████████████████████████████ 100%
File download complete
Time elapsed during download operation: 00:00:07.477I don't know if it's expected behavour, but as a user I'd rather get en error if the erase operation is not performed correctly.
---------------------------------------------------------------
Further Testing showed the following: Using a second hex file which is working with STM32_Prog_DB.xml present works:
> .\bin\STM32_Programmer_CLI.exe -c port=COM3 br=57600 P=EVEN db=8 sb=1 -w .\firmware_fails.hex
-------------------------------------------------------------------
STM32CubeProgrammer v2.4.0
-------------------------------------------------------------------
Serial Port COM3 is successfully opened.
Port configuration: parity = even, baudrate = 57600, data-bit = 8,
stop-bit = 1.0, flow-control = off
Activating device: OK
Chip ID: 0x413
BootLoader protocol version: 3.1
Device name : STM32F405xx/F407xx/F415xx/F417xx
Flash size : 1 MBytes (default)
Device type : MCU
Device CPU : Cortex-M4
Memory Programming ...
Opening and parsing file: firmware_fails.hex
File : firmware_fails.hex
Size : 1022 Bytes
Address : 0x08000000
Erasing memory corresponding to segment 0:
Erasing internal memory sector 0
Download in Progress:
██████████████████████████████████████████████████ 100%
File download complete
Time elapsed during download operation: 00:00:00.703Removing the file again leads to a crash with exit code -1073741819:
> .\bin\STM32_Programmer_CLI.exe -c port=COM3 br=57600 P=EVEN db=8 sb=1 -w .\firmware_fails.hex
-------------------------------------------------------------------
STM32CubeProgrammer v2.4.0
-------------------------------------------------------------------
Serial Port COM3 is successfully opened.
Port configuration: parity = even, baudrate = 57600, data-bit = 8,
stop-bit = 1.0, flow-control = off
Activating device: OK
Chip ID: 0x413
BootLoader protocol version: 3.1
Memory Programming ...
Opening and parsing file: firmware_fails.hex
File : firmware_fails.hex
Size : 1022 Bytes
Address : 0x08000000
Erasing memory corresponding to segment 0:Further details as verbose log attached.
Best regards.
