Skip to content

Blue Pill linked incorrectly for DFU Bootloader #183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
braiden opened this issue Jan 22, 2019 · 3 comments
Closed

Blue Pill linked incorrectly for DFU Bootloader #183

braiden opened this issue Jan 22, 2019 · 3 comments

Comments

@braiden
Copy link

braiden commented Jan 22, 2019

Hi,

I'm trying to build a simple Arduino blink sketch for blue pill (STM32F103C) and upload over dfu:

[env:broken]
platform = ststm32
framework = arduino
board = bluepill_f103c8
upload_protocol = dfu
upload_port = not_used

The resulting binary doesn't work. It expects to file .text at 0x0800010c, but with DFU it will be programmed at 0x0802010c. After some experimentation, overriding build.variant works:

[env:bluepill]
platform = ststm32
framework = arduino
board = bluepill_f103c8
board_build.variant = stm32f1
upload_protocol = dfu
upload_port = not_used

There's code in builder/frameworks/arduino/maple/stm32f1.py that correctly links the code, but that doesn't run by default(?). By changing build.variant something not in core variants stm32f1.py runs.

Seems like a bug? Or maybe i'm missing something.

@braiden
Copy link
Author

braiden commented Jan 24, 2019

A quick update, as I'm still new to stm32 and arduino. You probably know already, there are two cores:

new: https://github.com/stm32duino/Arduino_Core_STM32
old: https://github.com/rogerclarkmelbourne/Arduino_STM32

The old core supports the DFU (rogerclarkmelbourne/STM32duino-bootloader) bootloader I'm using. The newer core does not. Switching variants had the side effect of switching cores which is why my code started running.

As for this bug:

Is there a compelling reason to include DFU as a supported upload_protocol for boards which use stm32duino?

When the bootloader exists it occupies flash at 0x0800000 and user sketch must be linked to run at 0x0802000. Since dfu stm32duino doesn't exist in newer stm32duino core, it simply links the code to 0x0800000 and it will always fault when dfu is used.

Listing DFU as a supported upload_protocol feels like it will trap people like it did me.

I see a pull request to add a HID bootloader (https://github.com/Serasidis/STM32_HID_Bootloader) to stm32duino (stm32duino/Arduino_Core_STM32#415). Consider removing DFU and offering this as an alternative?

@BennehBoy
Copy link

@braiden, I've just updated that PR to include DFU support.

@ivankravets
Copy link
Member

See #169 (comment)

Please re-test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants