java.io.IOException: Cannot run program “{path}/stlink_upload.bat”: CreateProcess error=2, Cannot find specified file
i checked in Arduino_STM32-master\tools\win folder and stlink_upload.bat exists, so.. what is going on?
Linking everything together…
“C:\Users\Andrea\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++” -Os -Wl,–gc-sections -mcpu=cortex-m4 “-TC:\Users\Andrea\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\variants\discovery_f407/ld/jtag.ld” “-Wl,-Map,C:\Users\Andrea\AppData\Local\Temp\buildce9e731677e900d0235ca5321b266c98.tmp/stm32test.ino.map” “-LC:\Users\Andrea\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\variants\discovery_f407/ld” -o “C:\Users\Andrea\AppData\Local\Temp\buildce9e731677e900d0235ca5321b266c98.tmp/stm32test.ino.elf” “-LC:\Users\Andrea\AppData\Local\Temp\buildce9e731677e900d0235ca5321b266c98.tmp” -lm -lgcc -mthumb -Wl,–cref -Wl,–check-sections -Wl,–gc-sections -Wl,–unresolved-symbols=report-all -Wl,–warn-common -Wl,–warn-section-align -Wl,–warn-unresolved-symbols -Wl,–start-group “C:\Users\Andrea\AppData\Local\Temp\buildce9e731677e900d0235ca5321b266c98.tmp\sketch\stm32test.ino.cpp.o” “C:\Users\Andrea\AppData\Local\Temp\buildce9e731677e900d0235ca5321b266c98.tmp\core\stm32_isrs.S.o” “C:\Users\Andrea\AppData\Local\Temp\buildce9e731677e900d0235ca5321b266c98.tmp\core\stm32_vector_table.S.o” “C:\Users\Andrea\AppData\Local\Temp\buildce9e731677e900d0235ca5321b266c98.tmp\core\wirish\start.S.o” “C:\Users\Andrea\AppData\Local\Temp\buildce9e731677e900d0235ca5321b266c98.tmp\core\wirish\start_c.c.o” “C:\Users\Andrea\AppData\Local\Temp\buildce9e731677e900d0235ca5321b266c98.tmp\core\discovery_f4.cpp.o” -Wl,–whole-archive “C:\Users\Andrea\AppData\Local\Temp\buildce9e731677e900d0235ca5321b266c98.tmp/core\core.a” -Wl,–no-whole-archive -Wl,–end-group
“C:\Users\Andrea\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-objcopy” -O binary “C:\Users\Andrea\AppData\Local\Temp\buildce9e731677e900d0235ca5321b266c98.tmp/stm32test.ino.elf” “C:\Users\Andrea\AppData\Local\Temp\buildce9e731677e900d0235ca5321b266c98.tmp/stm32test.ino.bin”
Sketch uses 15,868 bytes (1%) of program storage space. Maximum is 1,048,576 bytes.
Global variables use 13,504 bytes of dynamic memory.
{path}/stlink_upload.bat COM6 {upload.altID} {upload.usbID} C:\Users\Andrea\AppData\Local\Temp\buildce9e731677e900d0235ca5321b266c98.tmp/stm32test.ino.bin
java.io.IOException: Cannot run program “{path}/stlink_upload.bat”: CreateProcess error=2, Impossibile trovare il file specificato
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at processing.app.helpers.ProcessUtils.exec(ProcessUtils.java:26)
at cc.arduino.packages.Uploader.executeUploadCommand(Uploader.java:129)
at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:206)
at cc.arduino.UploaderUtils.upload(UploaderUtils.java:78)
at processing.app.Sketch.upload(Sketch.java:1187)
at processing.app.Sketch.exportApplet(Sketch.java:1160)
at processing.app.Sketch.exportApplet(Sketch.java:1132)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2409)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: CreateProcess error=2, Impossibile trovare il file specificato
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
at java.lang.ProcessImpl.start(ProcessImpl.java:137)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
… 9 more
An error occurred while uploading the sketch
Cannot run program “{path}/stlink_upload.bat”
and
{path}/stlink_upload.bat COM6 {upload.altID} {upload.usbID} C:\Users\Andrea\AppData\Local\Temp\buildce9e731677e900d0235ca5321b266c98.tmp/stm32test.ino.bin
This may have some bearing on the issue. Also I would expect the IDE to expand “{path}” but perhaps it does..
Just my tuppence worth, as I am not running Windows, so can’t test.
As none of the STM32F4 boards use Serial as the upload method as far as I can tell ( just tried them all on my machine)
Or did you modify something ?
Mixing different slashes is handled correctly by windows.
I think, too, that expanding {path} seems to be the problem, but i dont know the solution…
Maybe searching the batch files in the f4 directory for text “stlink” would bring you closer to the root cause.
Please tell us your solution if you find one, as i also want to use f4 in the near future.
Thanks. For some reason I thought they were trying to do a serial upload.
I just tested all 4 F4 boards and they all tried to upload OK (But I didnt actually have any attached)
I wonder what version of the IDE they are using, because like you say, this looks like an issue with the IDE not expanding the {path} definition, which is specified a few lines above where its used.
I installed 1.6.12 a few days ago and its working fine, but perhaps some older versions of the IDE don’t like the syntax. But its not changed for ages, and we hardly ever update the F4 stuff
Open Documents\hardware\Arduino_STM32-master\STM32F4\platform.txt
search for
tools.stlink.upload.pattern={path}/{cmd}
edit {path} to {runtime.hardware.path}/tools/win
Thanks again, i just uploaded my first sketch
Very odd
Normally the expansion works fine.
What version of IDE are you using, What version of Windows ?
It looks very much like an obscure bug in the IDE and probably worth posting an issue on github to the IDE dev team if its repeatable
Odd.
I’m running W7 Pro, IDE 1.6.12 so you could try upgrading but I doubt that’s the cause, as I didn’t have any issues with 1.6.11
Do you have Java installed ? I know the IDE uses Java, but I thought somehow it was merged into the EXE, but perhaps external copies of Java can screw things up.
i will install it and retry with the original platform.txt when i have the time
Extract from F1 platforms.txt:
# stlink upload
tools.stlink_upload.path.windows={runtime.hardware.path}/tools/win
...
tools.stlink_upload.upload.pattern="{path}/{cmd}" {serial.port.file} {upload.altID} {upload.usbID} "{build.path}/{build.project_name}.bin"
We have a lot of redundant params, which no one has got around to removing ;-(
Actually I should be able to just copy the uploads section from the F1 platforms.txt to the F4
That could be handy even for just jumping to Serial upload on the F103
But even better if it works on the F4 for USB DFU
I had the upload problem, too and I have a fix. In:
Aurduino_STM32/tools/win/stlink_update.bat
Change:
rem: ————- use STLINK CLI
stlink\ST-LINK_CLI.exe -c SWD -P %str% 0x8000000 -Rst -Run
To:
rem: ————- use STLINK CLI
stlink\ST-LINK_CLI.exe -c SWD UR -P %str% 0x8000000 -Rst -Run
How I found this …. Had the same problem. Downloaded the ST-LINK utility. Tried to connect and couldn’t. Error message said to do a reset before connect. Looked at the ST-LINK_CL.exe command line options. Reset before connect is enabled by adding a “UR” command.
I updated my ST-LINK flash firmware prior to finding the solution, so you might have to do that as well.
i had some success flashing/uploading ‘sketches’ on my F4 using dfu-util in linux
http://www.stm32duino.com/viewtopic.php?f=39&t=1933
it turns out for dfu-util with ST’s DFUSe, dfu-util requires both the -s option to specify the load address and a raw binary file (ihex format won’t work)