cancel
Showing results for 
Search instead for 
Did you mean: 

STM32_Programmer_CLI doesn't return errorlevel in case of some errors

unsigned_char_array
Senior III

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.

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.
1 ACCEPTED SOLUTION

Accepted Solutions
Aziz BRIGUI
ST Employee

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


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

1 REPLY 1
Aziz BRIGUI
ST Employee

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


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.