Failed to upload to STM32F407V using STLink
System: Windows 11 Pro 23H2
Arduino IDE: 2.2.1
Core: ver. 2022.9.26 STM32F4xx boards (by stm32duino)
Hi! As a beginner, I was trying to upload example programs such as blink, to a STM32F407V board using stLink. However, regardless of having the stLink dongle connected or not, “done uploading” notice always appears right after I trigger the upload button. Although it says “done uploading”, nothing is actually uploaded successfully.
I have also tried using ver 1.8.x arduino IDE, but it gave the same result. Has anyone came across similar issue? Thanks in advance
No, that's odd.
If I give the upload command with these settings, without having a STLink connected to my PC I get below error.
Hi @toch2442 . I'm going to ask you to post the full verbose output from an upload.
This procedure is not intended to solve the problem. The purpose is to gather more information.
Please do this:
Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
The "Preferences " dialog will open.
Uncheck the box next to Show verbose output during: ☑
compilation in the "Preferences " dialog.
Check the box next to Show verbose output during: ☐ upload .
Click the "OK " button.
The "Preferences " dialog will close.
Attempt an upload, just as you did before.
Wait for the upload to finish.
Right click on the black "Output " panel at the bottom of the Arduino IDE window.
A context menu will open.
From the context menu, click Copy All .
Open a forum reply here by clicking the "Reply " button.
Click the <CODE/>
icon on the post composer toolbar.
This will add the forum's code block markup (```
) to your reply to make sure the error messages are correctly formatted.
Press the Ctrl +V keyboard shortcut (Command +V for macOS users).
This will paste the upload output into the code block.
Move the cursor outside of the code block markup before you add any additional text to your reply.
Click the "Reply " button to post the output.
I only have a bluepill (STM32F103C6) at hand right now. Though, it also results in the same uploading problem. Here is the verbose during upload:
FQBN: stm32duino:STM32F1:genericSTM32F103C6:upload_method=STLinkMethod
Using board 'genericSTM32F103C6' from platform in folder: C:\Users\admin\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F1\2022.9.26
Using core 'maple' from platform in folder: C:\Users\admin\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F1\2022.9.26
Detecting libraries used...
C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++ -c -g -Os -w -DDEBUG_LEVEL=DEBUG_NONE -std=gnu++11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -fno-use-cxa-atexit -DBOARD_generic_stm32f103c -DVECT_TAB_ADDR=0x8000000 -DERROR_LED_PORT=GPIOC -DERROR_LED_PIN=13 -w -x c++ -E -CC -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10607 -DARDUINO_GENERIC_STM32F103C -DARDUINO_ARCH_STM32F1 -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DSERIAL_USB -DGENERIC_BOOTLOADER -DMCU_STM32F103C6 -mthumb -march=armv7-m -D_STM32F1_ -DMCU_STM32F103C6 -mthumb -march=armv7-m -D_STM32F1_ -IC:\Users\admin\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F1\2022.9.26\system/libmaple -IC:\Users\admin\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F1\2022.9.26\system/libmaple/include -IC:\Users\admin\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F1\2022.9.26\system/libmaple/stm32f1/include -IC:\Users\admin\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F1\2022.9.26\system/libmaple/usb/stm32f1 -IC:\Users\admin\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F1\2022.9.26\system/libmaple/usb/usb_lib -IC:\Users\admin\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F1\2022.9.26\cores\maple -IC:\Users\admin\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F1\2022.9.26\variants\generic_stm32f103c C:\Users\admin\AppData\Local\Temp\arduino\sketches\4E21EB368B71CCA7CB35354EF1FD1788\sketch\sketch_apr14a.ino.cpp -o nul
Generating function prototypes...
C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++
Is this all the output? There should be more output than that, since it didn't even finish the compile step.
My apology. There indeed should be more output. Here is another run using STM32F407V instead. Although it shows a successful upload, there is actually NO stlink inserted.
FQBN: stm32duino:STM32F4:generic_f407v
Using board 'generic_f407v' from platform in folder: C:
\Users\admin\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26
Using core 'maple' from platform in folder: C:
\Users\admin\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26
Detecting libraries used...
C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++ -c -g -Os -Wall -std=gnu++11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DERROR_LED_PIN=PA7 -w -x c++ -E -CC -mcpu=cortex-m4 -DARDUINO=10607 -DVARIANT_generic_f407v -DARDUINO_ARCH_STM32F4 -DCRYSTAL_FREQ=8 -DLED_BUILTIN=PA6 -DSERIAL_USB -DUSER_ADDR_ROM=0x08000000 -mthumb -D__STM32F4__ -DSTM32F4 -IC:\Users\admin\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\system/libmaple -IC:\Users\admin\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\cores\maple/libmaple/usbF4 -IC:\Users\admin\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\cores\maple -IC:\Users\admin\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\variants\generic_f407v C:\Users\admin\AppData\Local\Temp\arduino\sketches\E65CAA8E79E161355A212ACD453A0996\sketch\sketch_apr15a.ino.cpp -o nul
Generating function prototypes...
C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++ -c -g -Os -Wall -std=gnu++11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DERROR_LED_PIN=PA7 -w -x c++ -E -CC -mcpu=cortex-m4 -DARDUINO=10607 -DVARIANT_generic_f407v -DARDUINO_ARCH_STM32F4 -DCRYSTAL_FREQ=8 -DLED_BUILTIN=PA6 -DSERIAL_USB -DUSER_ADDR_ROM=0x08000000 -mthumb -D__STM32F4__ -DSTM32F4 -IC:\Users\admin\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\system/libmaple -IC:\Users\admin\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\cores\maple/libmaple/usbF4 -IC:\Users\admin\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\cores\maple -IC:\Users\admin\AppData\Local\Arduino15\packages\stm32duino\hardware\STM32F4\2022.9.26\variants\generic_f407v C:\Users\admin\AppData\Local\Temp\arduino\sketches\E65CAA8E79E161355A212ACD453A0996\sketch\sketch_apr15a.ino.cpp -o C:\Users\admin\AppData\Local\Temp\1761596703\sketch_merged.cpp
C:\Users\admin\AppData\Local\Arduino15\packages\builtin\tools\ctags\5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives C:\Users\admin\AppData\Local\Temp\1761596703\sketch_merged.cpp
Compiling sketch...
"C:\\Users\\admin\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -Wall -MMD -std=gnu++11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DERROR_LED_PIN=PA7 -mcpu=cortex-m4 -DARDUINO=10607 -DVARIANT_generic_f407v -DARDUINO_ARCH_STM32F4 -DCRYSTAL_FREQ=8 -DLED_BUILTIN=PA6 -DSERIAL_USB -DUSER_ADDR_ROM=0x08000000 -mthumb -D__STM32F4__ -DSTM32F4 "-IC:\\Users\\admin\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F4\\2022.9.26\\system/libmaple" "-IC:\\Users\\admin\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F4\\2022.9.26\\cores\\maple/libmaple/usbF4" "-IC:\\Users\\admin\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F4\\2022.9.26\\cores\\maple" "-IC:\\Users\\admin\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F4\\2022.9.26\\variants\\generic_f407v" "C:\\Users\\admin\\AppData\\Local\\Temp\\arduino\\sketches\\E65CAA8E79E161355A212ACD453A0996\\sketch\\sketch_apr15a.ino.cpp" -o "C:\\Users\\admin\\AppData\\Local\\Temp\\arduino\\sketches\\E65CAA8E79E161355A212ACD453A0996\\sketch\\sketch_apr15a.ino.cpp.o"
Compiling libraries...
Compiling core...
Using previously compiled file: C:\Users\admin\AppData\Local\Temp\arduino\sketches\E65CAA8E79E161355A212ACD453A0996\core\generic_f407v.cpp.o
Using precompiled core: C:\Users\admin\AppData\Local\Temp\arduino\cores\f99b28b3076e4c9479a73aad2915fd0d\core.a
Linking everything together...
"C:\\Users\\admin\\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\\admin\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F4\\2022.9.26\\variants\\generic_f407v/ld/jtag.ld" "-Wl,-Map,C:\\Users\\admin\\AppData\\Local\\Temp\\arduino\\sketches\\E65CAA8E79E161355A212ACD453A0996/sketch_apr15a.ino.map" "-LC:\\Users\\admin\\AppData\\Local\\Arduino15\\packages\\stm32duino\\hardware\\STM32F4\\2022.9.26\\variants\\generic_f407v/ld" -Wl,--wrap=atexit,--wrap=__cxa_atexit,--wrap=exit -specs=nano.specs -o "C:\\Users\\admin\\AppData\\Local\\Temp\\arduino\\sketches\\E65CAA8E79E161355A212ACD453A0996/sketch_apr15a.ino.elf" "-LC:\\Users\\admin\\AppData\\Local\\Temp\\arduino\\sketches\\E65CAA8E79E161355A212ACD453A0996" -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\\admin\\AppData\\Local\\Temp\\arduino\\sketches\\E65CAA8E79E161355A212ACD453A0996\\sketch\\sketch_apr15a.ino.cpp.o" "C:\\Users\\admin\\AppData\\Local\\Temp\\arduino\\sketches\\E65CAA8E79E161355A212ACD453A0996\\core\\generic_f407v.cpp.o" -Wl,--whole-archive "C:\\Users\\admin\\AppData\\Local\\Temp\\arduino\\cores\\f99b28b3076e4c9479a73aad2915fd0d\\core.a" -Wl,--no-whole-archive -Wl,--end-group
"C:\\Users\\admin\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-objcopy" -O binary "C:\\Users\\admin\\AppData\\Local\\Temp\\arduino\\sketches\\E65CAA8E79E161355A212ACD453A0996/sketch_apr15a.ino.elf" "C:\\Users\\admin\\AppData\\Local\\Temp\\arduino\\sketches\\E65CAA8E79E161355A212ACD453A0996/sketch_apr15a.ino.bin"
"C:\\Users\\admin\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-size" -A "C:\\Users\\admin\\AppData\\Local\\Temp\\arduino\\sketches\\E65CAA8E79E161355A212ACD453A0996/sketch_apr15a.ino.elf"
Sketch uses 18920 bytes (3%) of program storage space. Maximum is 514288 bytes.
Global variables use 5552 bytes (4%) of dynamic memory, leaving 125520 bytes for local variables. Maximum is 131072 bytes.
"C:\Users\admin\AppData\Local\Arduino15\packages\stm32duino\tools\stm32tools\2022.9.26/win/stlink_upload.bat" "C:\Users\admin\AppData\Local\Temp\arduino\sketches\E65CAA8E79E161355A212ACD453A0996/sketch_apr15a.ino.bin"
That doesn't show a successful upload. It calls the upload script, then silence...
It's been a while since I had to set my system up, but ISTR that you had to install STMCubeMX and maybe STMProgrammer. Did you do those steps? Complete instructions should be with stm32duino
That is when using the more popular "STM32 MCU based boards " platform:
https://github.com/stm32duino/Arduino_Core_STM32/wiki/Upload-methods#stm32cubeprogrammer
@toch2442 is not using that platform. They are using the "STM32F4 Boards (Arduino_STM32) " platform by Roger Clark:
Arduino STM32. Hardware files to support STM32 boards, on Arduino IDE 1.8.x including LeafLabs Maple and other generic STM32F103 boards
Although not as polished as "STM32 MCU based boards " and now largely unmaintained, the nice characteristic of the Roger Clark platform when compared to the other is that it uses open source upload tools. These tools are bundled with the "STM32F4 Boards (Arduino_STM32) " platform installation. So you only have to install the platform via Boards Manager (a community member maintains a Boards Manager package for the platform ) and you have everything you need instead of having to register an account on the ST Microelectronics website so you can download and install the proprietary STM32CubeProgrammer .
You can see the contents of the stlink_upload.bat
file here:
@echo off
rem: Note %~dp0 get path of this batch file
rem: Need to change drive if My Documents is on a drive other than C:
set driverLetter=%~dp0
set driverLetter=%driverLetter:~0,2%
%driverLetter%
cd %~dp0
rem: the two line below are needed to fix path issues with incorrect slashes before the bin file name
set str=%1
set str=%str:/=\%
rem: ------------- use STLINK CLI
stlink\ST-LINK_CLI.exe -c SWD -P %str% 0x8000000 -Rst -Run -NoPrompt
rem: Using the open source texane-stlink instead of the proprietary STM stlink exe
rem:texane-stlink\st-flash.exe write %str% 0x8000000
The copy of the stlink tools used by the batch file are here:
Of course, none of that explains the problem reported by @toch2442
1 Like
system
Closed
October 12, 2024, 9:26pm
9
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.