cancel
Showing results for 
Search instead for 
Did you mean: 

STM32_Programmer_CLI.exe write file with space in path

CThie.1
Associate II

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Aziz BRIGUI
ST Employee

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


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

10 REPLIES 10

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​ 

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

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.

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.

CThie.1
Associate II

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.

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.

I don't understand your workaround. Can you provide an example of the command I should type ?

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.

Aziz BRIGUI
ST Employee

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


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.
CThie.1
Associate II

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.