2021-07-05 07:52 AM
Hello,
My C++ code calls BlueNRG-X_Flasher_Launcher.exe with all relevant arguments. I can successfully program the BLE module STB1132-25. I have used the c standard function system(const char*) to call BlueNRG-X_Flasher_Launcher.exe. the issue is, when flash is unsuccessful or some error occurred in the flash launcher, I always get return code 1. I supposedly should get return code 0. In the same way, I am also calling ST-link utility and whenever an error occurs in the utility, I always get a return value 0. Can anyone please tell me what is correct way to call BlueNRG-X_Flasher_Launcher.exe from C++ code? and Why the return code of BlueNRG-X_Flasher_Launcher.exe is always 1 irrespective of errors.
2021-07-06 08:11 PM
The followed are some examples to have different return code under command line prompt.
C:\Users\winfred lu\ST\BlueNRG-X Flasher Utility 4.1.0\Application>BlueNRG-X_Flasher_Launcher.exe -v
Qt: Untested Windows version 10.0 detected!
4.1.0
C:\Users\winfred lu\ST\BlueNRG-X Flasher Utility 4.1.0\Application>echo %errorlevel%
0
C:\Users\winfred lu\ST\BlueNRG-X Flasher Utility 4.1.0\Application>BlueNRG-X_Flasher_Launcher.exe
Qt: Untested Windows version 10.0 detected!
usage: BlueNRG-X Flasher Launcher [-h] [-v]
{flash,read,mass_erase,verify_memory,erase_pages,uart,swd}
...
BlueNRG-X Flasher Launcher version 4.1.0.
optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exit
commands:
{flash,read,mass_erase,verify_memory,erase_pages,uart,swd}
flash Program a flash memory
read Read a flash memory
mass_erase Erase a flash memory
verify_memory Verify the content of a BlueNRG-X device with a file
erase_pages Erase one or more pages from a flash memory
uart Show all connected COM ports (UART mode)
swd Show all devices conected by ST-Link/V2, CMSIS-DAP,
J-Link (SWD mode)
...the end...
C:\Users\winfred lu\ST\BlueNRG-X Flasher Utility 4.1.0\Application>echo %errorlevel%
-1
BlueNRG-X Flasher Launcher: error: argument command: invalid choice: 'asdf' (choose from 'flash', 'read', 'mass_erase', 'verify_memory', 'erase_pages', 'uart', 'swd')
C:\Users\winfred lu\ST\BlueNRG-X Flasher Utility 4.1.0\Application>echo %errorlevel%
2