2023-03-07 06:14 AM
Hi,
I'm using STM32CubeProgrammer CLI (2.13.0).
I'm trying to write a file to my device using this command :
"C:\Program Files (x86)\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\STM32_Programmer_CLI.exe" -C port=SWD mode=UR -vb 1 -e all -w "%firmware%" 0x08020000 -V -w "%bootloader%" 0x08000000 -V
I get this error :
Warning: Wrong file path to be downloaded: "g:\.shortcut-targets-by-id\***\yyy"
Error: The download command you trying to perform (-w "g:\.shortcut-targets-by-id\***\yyy" "firmwares\***\yyyy\zzz\firmware.hex" 0x08000000) is missing the filePath to be loaded or it has a wrong extension, please note that the supported extension are .bin, .hex, .srec, .s19 .elf, .stm32, .ext2, .ext3, .ext4, .vfat, .ubi, .jffs2, .img and .tsv files.
I understand that the CLI parsed the firmware file path, which contains spaces, but I don't understand why as I put double quotes arround the %firmware% variable.
Can you help me solving this issue ? Is there a way of forcing not to parse or converting the path in a way the CLI understands it?
Solved! Go to Solution.
2023-03-10 07:46 AM
Hello @CThie.1,
Dots and spaces in path are properly handled on my side with STM32CubeProgrammer v2.13.0. Could you please share the trace of this CLI command ?
>STM32_Programmer_CLI.exe -c port=SWD mode=UR -w "g:\part1 part2\firmware.hex"
Thanks in advance,
Aziz
2023-03-07 06:21 AM
Seems like it's hung up on the DOT / PERIOD and not the spaces.
If I recall the change log they "fixed" some related problem, perhaps breaking yours.
@Nawres GHARBI @Sara BEN HADJ YAHYA
2023-03-07 08:37 AM
I can confirm that It's hung up on the space. My example might not have been clear but the error separates at the first space.
I've just tried to install 2.10.0 but same thing here.
2023-03-08 02:35 AM
It looks like your file path not only contains spaces but consists of two quoted parts: "g:\part1" SPACE "part2\firmware.hex".
The C compiler would concatenate this, but not the shell.
2023-03-10 02:11 AM
I can confirm there are not two quoted parts. The error message separates the path in two quoted parts at first space, but the full path, the one I provide to the CLI function is in one part.
Here is a more accurate example with no variable, producing the same result :
"C:\Program Files (x86)\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\STM32_Programmer_CLI.exe" -C port=SWD mode=UR -vb 1 -e all -w "g:\part1 part2\firmware.hex" 0x08020000 -V -w "%bootloader%" 0x08000000 -V
Another information, I used to work with the STSW-LINK004 CLI in the past and this problem never occurred.
2023-03-10 03:11 AM
Well then try this Windows specific trick to "fix" the hex filename (%~s...).
In future, avoid creating projects with path containing spaces and weird characters, this is recipe for loss of productivity.
2023-03-10 04:34 AM
I don't understand your workaround. Can you provide an example of the command I should type ?
2023-03-10 05:35 AM
Somewhere in the script that refers to a file with weird path (.bat or .cmd file), convert the path to short form, as follows:
set longfile="g:\part1 part2\firmware.hex"
call :shrt %longfile%
do_something %shortp%
goto :EOF
:shrt
if not exist %1 echo ERROR file must exist to get short name
set shortp=%~s1
goto :EOF
note: short paths are a property of Windows filesystem. May be not available on some drives.
2023-03-10 07:46 AM
Hello @CThie.1,
Dots and spaces in path are properly handled on my side with STM32CubeProgrammer v2.13.0. Could you please share the trace of this CLI command ?
>STM32_Programmer_CLI.exe -c port=SWD mode=UR -w "g:\part1 part2\firmware.hex"
Thanks in advance,
Aziz
2023-03-23 06:01 AM
Hello @Aziz BRIGUI ,
Here is the exact command
"C:\Program Files (x86)\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\STM32_Programmer_CLI.exe" -C port=SWD mode=UR -w "G:\.shortcut-targets-by-id\1HWWHwlSlKL_IxK1c8b06OH6V37j-jDcy\FW.hex\Firmwares_and_Release_Notes\Celullar (CARTE SIM)\firmware.hex"
And the response
Warning: Wrong file path to be downloaded: "G:\.shortcut-targets-by-id\1HWWHwlSlKL_IxK1c8b06OH6V37j-jDcy\FW.hex\Firmwares_and_Release_Notes\Celullar"
Error: The download command you trying to perform (-w "G:\.shortcut-targets-by-id\1HWWHwlSlKL_IxK1c8b06OH6V37j-jDcy\FW.hex\Firmwares_and_Release_Notes\Celullar" "(CARTE SIM)\firmware.hex") is missing the filePath to be loaded or it has a wrong extension, please note that the supported extension are .bin, .hex, .srec, .s19 .elf, .stm32, .ext2, .ext3, .ext4, .vfat, .ubi, .jffs2, .img and .tsv files.