Spark Logic

STM32F4 upload problem

No error at compiling, when i try to upload through arduino IDE it says
java.io.IOException: Cannot run program “{path}/stlink_upload.bat”: CreateProcess error=2, Cannot find specified file

i checked in Arduino_STM32STM32Microcontrollers and processors…Map magic glue code, ethernet compiles, just WARNING: library LwIP claims to run on [ stm32 ] architecture(s) and may be incompatible with your current board which runs on [STM32]…View in hardware catalog -master\tools\win folder and stlink_upload.bat exists, so.. what is going on?

Replies20

Thu Oct 06, 2016 8:55 pm

cut and paste the verbose output about the path to the upload bat file

Thu Oct 06, 2016 11:40 pm

Thanks for your reply, it just says {path}

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-M4Cortex-M4Microcontrollers and processors… the Due form factor) e.g. … 4de7935aae Mini-version-STM32F407VET6-development-board- Cortex-M4 -STM32-minimum-system-board.jpg Mini-version-STM32F407VET6-development-board-Cortex…View in hardware catalog “-TC:\Users\Andrea\Documents\Arduino\hardware\Arduino_STM32STM32Microcontrollers and processors…Map magic glue code, ethernet compiles, just WARNING: library LwIP claims to run on [ stm32 ] architecture(s) and may be incompatible with your current board which runs on [STM32]…View in hardware catalog -master\STM32F4STM32F4Microcontrollers and processors…uild.board' preference. Auto-set to: STM32F3_DISCOVERY_F3 Board Arduino_STM32-master: STM32F4 :discovery_f407 doesn't define a 'build.board' preference. Auto-set to: STM32F4_DISCO…View in hardware catalog \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_STM32STM32Microcontrollers and processors…Map magic glue code, ethernet compiles, just WARNING: library LwIP claims to run on [ stm32 ] architecture(s) and may be incompatible with your current board which runs on [STM32]…View in hardware catalog -master\STM32F4STM32F4Microcontrollers and processors…uild.board' preference. Auto-set to: STM32F3_DISCOVERY_F3 Board Arduino_STM32-master: STM32F4 :discovery_f407 doesn't define a 'build.board' preference. Auto-set to: STM32F4_DISCO…View in hardware catalog \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\STM32STM32Microcontrollers and processors…Map magic glue code, ethernet compiles, just WARNING: library LwIP claims to run on [ stm32 ] architecture(s) and may be incompatible with your current board which runs on [STM32]…View in hardware catalog _isrs.S.o” “C:\Users\Andrea\AppData\Local\Temp\buildce9e731677e900d0235ca5321b266c98.tmp\core\STM32STM32Microcontrollers and processors…Map magic glue code, ethernet compiles, just WARNING: library LwIP claims to run on [ stm32 ] architecture(s) and may be incompatible with your current board which runs on [STM32]…View in hardware catalog _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

Fri Oct 07, 2016 12:37 am

First thing that jumps out is that there are “/” and “\” characters in those file paths.
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.

Fri Oct 07, 2016 12:58 am

Which board do you have selected ?

As none of the STM32F4STM32F4Microcontrollers and processors…uild.board' preference. Auto-set to: STM32F3_DISCOVERY_F3 Board Arduino_STM32-master: STM32F4 :discovery_f407 doesn't define a 'build.board' preference. Auto-set to: STM32F4_DISCO…View in hardware catalog 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 ?

Fri Oct 07, 2016 4:25 am

Roger, i think it is using the stlink to upload, as the batch file name suggests, not serial.

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.

Fri Oct 07, 2016 4:44 am

Steve

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

Fri Oct 07, 2016 8:58 am

Managed to fix! Thanks everyone!
Open Documents\hardware\Arduino_STM32STM32Microcontrollers and processors…Map magic glue code, ethernet compiles, just WARNING: library LwIP claims to run on [ stm32 ] architecture(s) and may be incompatible with your current board which runs on [STM32]…View in hardware catalog -master\STM32F4STM32F4Microcontrollers and processors…uild.board' preference. Auto-set to: STM32F3_DISCOVERY_F3 Board Arduino_STM32-master: STM32F4 :discovery_f407 doesn't define a 'build.board' preference. Auto-set to: STM32F4_DISCO…View in hardware catalog \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

Fri Oct 07, 2016 9:00 am

Umm
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

Fri Oct 07, 2016 9:11 am

Windows 7 home premium, arduino ide 1.6.11

Fri Oct 07, 2016 9:56 am

Umm

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.

Fri Oct 07, 2016 1:37 pm

No i dont java installed, i guess im using the one embedded.
i will install it and retry with the original platform.txt when i have the time

Fri Oct 07, 2016 7:58 pm

No worries.

Fri Oct 07, 2016 9:50 pm

The fix is OK, in the F1 platforms.txt the same variable is used.
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"

Fri Oct 07, 2016 10:59 pm

Steve

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

Sat Oct 08, 2016 1:18 pm

Hi all, question: is there alread in the repository an upload method which leverages the standard f4 dfu bootloader?

Sat Oct 08, 2016 8:01 pm

edogaldo wrote:Hi all, question: is there alread in the repository an upload method which leverages the standard f4 dfu bootloader?

Sat Oct 08, 2016 8:19 pm

RogerClark wrote:Is it possible to enter the built in DFU via code ? e.g can the code jump to a specific address, or perhaps set some registers and then jump etc ??.

Sat Oct 08, 2016 9:07 pm

Thanks

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

Fri Dec 23, 2016 9:03 pm

Hi, I finally got around to getting my STM32F407 DiscoverySTM32F407 DiscoveryDevelopment and computing boards…ous to see how the 1Bitsy compares against the Teensy 3.2. Also have the Teensy 3.6, STM32F407 Discovery and STM32F469 Discovery and a Netduino 2 Plus. Smile As you can see, I’m g…View in hardware catalog Board up and running.

I had the upload problem, too and I have a fix. In:

Aurduino_STM32STM32Microcontrollers and processors…Map magic glue code, ethernet compiles, just WARNING: library LwIP claims to run on [ stm32 ] architecture(s) and may be incompatible with your current board which runs on [STM32]…View in hardware catalog /tools/win/stlink_update.bat

Change:

rem: ————- use STLINK CLI
stlink\ST-LINKST-LINKModules, instruments and finished devices…ot add the serial usb device… suspect flashing failed…. Do I need to debrick it with st-link ? (which I don’t have lol) BennehBoy Mon Jan 23, 2017 8:11 pm NM managed to rescue it…View in hardware catalog _CLI.exe -c SWD -P %str% 0x8000000 -Rst -Run

To:
rem: ————- use STLINK CLI
stlink\ST-LINKST-LINKModules, instruments and finished devices…ot add the serial usb device… suspect flashing failed…. Do I need to debrick it with st-link ? (which I don’t have lol) BennehBoy Mon Jan 23, 2017 8:11 pm NM managed to rescue it…View in hardware catalog _CLI.exe -c SWD UR -P %str% 0x8000000 -Rst -Run

How I found this …. Had the same problem. Downloaded the ST-LINKST-LINKModules, instruments and finished devices…ot add the serial usb device… suspect flashing failed…. Do I need to debrick it with st-link ? (which I don’t have lol) BennehBoy Mon Jan 23, 2017 8:11 pm NM managed to rescue it…View in hardware catalog utility. Tried to connect and couldn’t. Error message said to do a reset before connect. Looked at the ST-LINKST-LINKModules, instruments and finished devices…ot add the serial usb device… suspect flashing failed…. Do I need to debrick it with st-link ? (which I don’t have lol) BennehBoy Mon Jan 23, 2017 8:11 pm NM managed to rescue it…View in hardware catalog _CL.exe command line options. Reset before connect is enabled by adding a “UR” command.

I updated my ST-LINKST-LINKModules, instruments and finished devices…ot add the serial usb device… suspect flashing failed…. Do I need to debrick it with st-link ? (which I don’t have lol) BennehBoy Mon Jan 23, 2017 8:11 pm NM managed to rescue it…View in hardware catalog flash firmware prior to finding the solution, so you might have to do that as well.

Wed Mar 29, 2017 9:19 am

pre-note that i’m working in linux and not actually using the arduino ide

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)

Post a reply

Optional · up to 10 MiB