Skip to main content
CThie.1
Associate
March 7, 2023
Solved

STM32_Programmer_CLI.exe write file with space in path

  • March 7, 2023
  • 5 replies
  • 5585 views

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?

This topic has been closed for replies.
Best answer by Aziz BRIGUI

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

5 replies

Tesla DeLorean
Guru
March 7, 2023

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 VenmoUp vote any posts that you find helpful, it shows what's working..
CThie.1
CThie.1Author
Associate
March 7, 2023

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.

Pavel A.
Super User
March 8, 2023

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
CThie.1Author
Associate
March 10, 2023

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.

Pavel A.
Super User
March 10, 2023

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.

CThie.1
CThie.1Author
Associate
March 10, 2023

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

Aziz BRIGUI
Aziz BRIGUIBest answer
Technical Moderator
March 10, 2023

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
CThie.1Author
Associate
March 23, 2023

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.

Tesla DeLorean
Guru
March 23, 2023

And Pavel's idea of copying this to a shorter more normative name, in say the local %TEMP% directory is not possible/working?

Is this some virtualized drive path?

Does a COPY in a script/batch file find it?

Parser does seem to be broken, and lack robustness..

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