Closed tcurdt closed 1 year ago
This bootloader was written by LeafLabs to work with the Arduino IDE.
Try posting to www.stm32duino.com to see if someone can help you make it work with another IDE
I will - but could you just confirm how it should work in general?
What's the mechanism to upload and the address is for the sketch is 0x8002000?
I now change the
platformio.ini
to[env:bluepill_f103c8] platform = ststm32 board = bluepill_f103c8 framework = arduino upload_protocol = dfu
but when running
pio run -t upload
I am getting an error (which seems to be related to an outdated dfu-util)dyld[54773]: Library not loaded: /opt/local/lib/libusb-1.0.0.dylib Referenced from: /Users/***/.platformio/packages/tool-stm32duino/dfu-util/dfu-util Reason: tried: '/opt/local/lib/libusb-1.0.0.dylib' (no such file), '/usr/local/lib/libusb-1.0.0.dylib' (no such file), '/usr/lib/libusb-1.0.0.dylib' (no such file) /Users/***/.platformio/packages/tool-stm32duino/maple_upload: line 53: 54773 Abort trap: 6 ${DFU_UTIL} -d ${usbID} -a ${altID} -D ${binfile} -R ${dfuse_addr} -R
OS: Linux Manjaro IDE: VSCode (VSCodium) PlatformIO: Core v6.1.15 Home v3.4.4
I have it working and this is my platformio.ini configuration file
[env:genericSTM32F103C8] ; Usando bootloader generic_boot20_pc13.bin
platform = ststm32
board = bluepill_f103c8
board_build.mcu = stm32f103c8t6
framework = arduino
upload_protocol = dfu
upload_command = dfu-util -a 2 -D $SOURCE
Then when i do an Upload the firmware:
Checking size .pio/build/genericSTM32F103C8/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [= ] 5.5% (used 1132 bytes from 20480 bytes)
Flash: [== ] 16.8% (used 10992 bytes from 65536 bytes)
Building .pio/build/genericSTM32F103C8/firmware.bin
Configuring upload protocol...
AVAILABLE: blackmagic, cmsis-dap, dfu, jlink, mbed, stlink
CURRENT: upload_protocol = dfu
Looking for upload port...
Auto-detected: /dev/ttyS31
Uploading .pio/build/genericSTM32F103C8/firmware.bin
dfu-util 0.11
dfu-util: Warning: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
Opening DFU capable USB device...
Device ID 1eaf:0003
Device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Interface #2 ...
Determining device status...
DFU state(2) = dfuIDLE, status(0) = No error condition is present
DFU mode device DFU version 0110
Device returned transfer size 1024
Copying data from PC to DFU device
Download [ ] 0% 0 bytes
Download [== ] 8% 1024 bytes
Download [==== ] 16% 2048 bytes
Download [====== ] 24% 3072 bytes
Download [======== ] 33% 4096 bytes
Download [========== ] 41% 5120 bytes
Download [============ ] 49% 6144 bytes
Download [============== ] 58% 7168 bytes
Download [================ ] 66% 8192 bytes
Download [================== ] 74% 9216 bytes
Download [==================== ] 83% 10240 bytes
Download [====================== ] 91% 11264 bytes
Download [======================== ] 99% 11284 bytes
Download [=========================] 100% 11284 bytes
Download done.
This is what I tried:
Now when I connect to the usb serial I the following message in a loop:
That looks like the bootloader and the welcome sketch works correctly.
I now change the
platformio.ini
tobut when running
pio run -t upload
I am getting an error (which seems to be related to an outdated dfu-util)Updating it
brew install dfu-util
and changing the reference in~/.platformio/packages/tool-stm32duino/maple_upload
, the upload succeeds:but after that upload the bootloader seems to be gone again. No usb serial shows up anymore.
I then also tried
Since the bootloader was working, this is rather a platformio issue, right?
But is
dfu
the right upload method to use with the bootloader?It just has to be written at the correct address? Which is 0x8002000?
While digging through some github issues I also found these settings:
Just not sure whether they make sense or not.
I would be very thankful for some input.