cancel
Showing results for 
Search instead for 
Did you mean: 

Do STM32CubeProgrammer Command Line interface have return codes?

YTan.3
Associate II

0693W00000Dlb59QAB.pngSince STM32 STLINK Utility Command Line Interface has return codes, why STM32Cube Programmer don't have?

1 ACCEPTED SOLUTION

Accepted Solutions

Please select my answer as Best to close the question.

View solution in original post

14 REPLIES 14
Guillaume K
ST Employee

it seems that STM32CubeProgrammer returns 0 (zero) if no problem and a code different from zero in case of error. But it is not documented in the user manual as ST-LINK Utility.

Example of error case: On a Windows PC, if no STM32 connected to the PC:

STM32_Programmer_CLI.exe -c port=swd --list
 
     -------------------------------------------------------------------
 
                      STM32CubeProgrammer v2.8.0
 
     -------------------------------------------------------------------
 
 
Error: No debug probe detected.
 
 
c:\>echo %ERRORLEVEL%
 
1

Are you using something else than a Windows PC ? (Linux ? Mac ?)

Hi Guillaume,

I m using Windows. it does working.

Thank you so much for your help.

Please select my answer as Best to close the question.

Please document what the actual return codes are, the answer here isn't particularly satisfactory if someone searched on it, or the forum suggested it as an answer.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Yeah agree. It would be good if can have the list of return codes like what we have for STLINK Utility CLI user manual.

Guillaume K
ST Employee

I backtrack a little: in current version of STM32CubeProgrammer (2.8.0) there are some cases where STM32CubeProgrammer returns 1 in case of error, but some other error cases it returns 0. There are ongoing actions to correct that in future versions.

0693W00000FAbGLQA1.pngHopefully can be fixed soon. My product's manufacturing process depends on returned-code to detect failure in programming.

Now always return zero in any condition: STM32CubeProgrammer (2.8.0)

Hi Fardi,

Would you mind to share how to get "return value is 0"? Is there any special command?

Thanks

This is the script I use:

@echo off
SET COMMAND=stm32_programmer_cli -c port=SWD freq=8000 mode=UR
SET FILE=%1%
echo.
echo %FILE%
echo ===================================================================
echo SURE TO ERASE-PROGRAM-VERIFY? Press Ctrl+C to cancel
echo ===================================================================
echo.
pause
%COMMAND% -rdu -ob WPRMOD=0 WRPOT0=0 WRPOT1=0 WRPOT2=0 WRPOT3=0 WRPOT4=0 WRPOT5=0 WRPOT6=0 WRPOT7=0 -e all
echo return value is %errorlevel%
%COMMAND% -d "%FILE%" -v
echo return value is %errorlevel%
echo.
pause