2023-02-21 05:13 AM
I use STM32_Programmer_CLI.exe (from STM32CubeMX version 2.11.0) to flash an STM32 with internal and external flash. In some cases the tool prints an error in red in the terminal and exits with errorlevel is set to 0.
If I want to use success or failure as a condition in my script I run into problems.
I have the following simplified script (test.cmd):
@echo off
set "STfilepath=C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\STM32_Programmer_CLI.exe"
"%STfilepath%" -c port=swd -w "elf_file.elf" 0x90000000 -el "stldr_file.stldr"
echo ERRORLEVEL=%ERRORLEVEL%
If my debugger is not plugged or the target is not connected I get ERRORLEVEL=1.
If my debugger and target are both connected, but either the elf file or the stldr file are not found I get an errormessage printed in red in the terminal, but the errorlevel is set to 0.
No programmer connected:
./test.cmd
-------------------------------------------------------------------
STM32CubeProgrammer v2.11.0
-------------------------------------------------------------------
Warning: The external loader file does not exist:
stldr_file.stldr
Error: No debug probe detected.
ERRORLEVEL=1
Debugger and target connected:
./test.cmd
-------------------------------------------------------------------
STM32CubeProgrammer v2.11.0
-------------------------------------------------------------------
Warning: The external loader file does not exist:
stldr_file.stldr
ST-LINK SN : 003300193438510734313939
ST-LINK FW : V3J10M3B5S1
Board : STLINK-V3SET
Voltage : 3.31V
SWD freq : 24000 KHz
Connect mode: Normal
Reset mode : Software reset
Device ID : 0x480
Revision ID : --
Device name : STM32H7A/B
Flash size : 2 MBytes
Device type : MCU
Device CPU : Cortex-M7
BL Version : 0x91
Warning: Write address is ignored for hex, Srec, s19 and elf files
Memory Programming ...
Error: File does not exist: elf_file.elf
ERRORLEVEL=0
In my opinion this is a bug and needs to be fixed.
Solved! Go to Solution.
2023-02-27 05:43 AM
Hello @Community member,
Thank you for your feedback,
This bug is fixed in the latest version of STM32CubeProgrammer (v2.13) available under this link.
Aziz
2023-02-27 05:43 AM
Hello @Community member,
Thank you for your feedback,
This bug is fixed in the latest version of STM32CubeProgrammer (v2.13) available under this link.
Aziz