Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Secure USB DFU1.1 bootloader for STM32 with STM32F4x1xE target fully compatible to STM32duino and PlatformIO

License

NotificationsYou must be signed in to change notification settings

rbm78bln/STM32duino-bootloader_stm32f411-blackpill

 
 

Repository files navigation

First things first: Don't forget to read the originalREADME.md of the parent project.

Secure STM32duino-compatible USB DFU1.1 bootloader for STM32F401(xE) and STM32F411(xE) (Blackpill)

This is a fork ofdmitrystu's greatsboot_stm32 bootloader, which is a beautiful piece of software, with a few modifications to make it act similarly likerogerclarkmelbourne'sSTM32duino-bootloader, adapt the nifty little RTC magic number feature fromSerasidis'STM32 HID-Bootloader, and thus provide better compatiblity to theSTM32duino Arduino Core - especially when developing withPlatformIO and VSCode.

So why all this?

For downloading firmwares to your Blackpill via USB you can simply do the little finger dance and you're fine... kind of... unless you're some lazy dude like me, who doesn't want to do the extraequilibristics to fiddle around with the board all the time while coding. Having a pretty weak pull-down connected to BOOT1 with a far higher resistance than my thick clumsy fingers doesn't help neither.

Since the STM32F103 doesn't have a USB-capable bootloader in ROM,Roger wrote theSTM32duino-bootloader for the Bluepill andST-Link Baite-Clones, which always starts up after resetting the board and then proceeds to the user application after a short timeout. This way the host can toggle the DTR "pin" of the USB-serial which is detected by theSTM32duino Arduino Core and triggers a reset of the board like theMaple boards first implemented this.

The beforementionedHID Bootloader, which isonly partly supported by PlatformIO'sST STM32-platform, andRoger'sSTM32duino-bootloader additionally implementchecking a register of the RTC's backup domain to determine whether the bootloader should beforce-entered orskipped completely after the reset, which can be controlled by the user application and is also reflected in theSTM32duino Arduino Core. See itsbootloader.c for more details.

To complete the whole and round it nicelyWeAct especially made theirHID Bootloader incompatible withSerasidis'STM32 HID-Bootloader from which it was forked and their Blackpills are usually shipped with. Yay!I'm lovin' it!

Bringing it all together

So what would be nice is a standard dfu-capable bootloader that can easily be entered automatically using your development IDE and is supported by the standard STM32-Arduino Framework.So here you go!

This bootloader implements

  • The DFU protocol (sboot)
  • Application offsets 0x2000 and 0x4000 in flash(it can actually be quite tiny depending on the selected features)
  • Automatically entering the bootloader after power-on (STM32duino-bootloader)
  • Entering the bootloader by double-clicking the reset-button (sboot)
  • Entering the bootloader by holding down a user-button (all)
  • Force-entering the bootloader when no firmware is detected (STM32duino-bootloader)
  • Force-entering or force-skipping the bootloader by
    • RTC magic number (HID/STM32duino Bootloader) or
    • magic number in SRAM (sboot)
  • Automatically exiting the bootloader and running the firmware after various configurable timeouts
  • Encrypted firmware downloads (sboot)
  • Verifying the checksum of the firmware (sboot)
  • A nervously flashing LED while in bootloader
  • Each of the features above can be enabled/disabled separatelyNot all combinations make sense! You choose! (userconfig.h)

Supported MCU targets

mcu_targetMCUremarks
stm32f401xeSTM32F401xEtested
stm32f411xeSTM32F411xEtested

This bootloader does not (yet?) implement

Activating the bootloader

  • Simply just power up your board
  • Toggle the DTR "pin" of the USB-serial interface
  • Write RTC_MAGIC_NUMBER_BOOTLOADER into register 4 of the RTC backup domain (RTC->BKP4R) and issue a (whatever) reset
  • Write DFU_BOOTKEY at DFU_BOOTKEY_ADDR (RAM top by default) and make a software reset
  • Assert DFU_BOOTSTRAP_PIN on DFU_BOOTSTRAP_PORT on startup
  • Make a double reset during the DFU_DBLRESET_MS period
  • Overwrite the first four bytes of your user firmware

Using the bootloader

Inexamples/hello_world you can find a very basic example on how to use this bootloader for your daily work withPlatformIO and VSCode.

How can I use this bootloader with Arduino IDE?

What isArduino IDE?

sboot_stm32f411

About

Secure USB DFU1.1 bootloader for STM32 with STM32F4x1xE target fully compatible to STM32duino and PlatformIO

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • C47.5%
  • Assembly44.4%
  • Makefile7.8%
  • Shell0.3%

[8]ページ先頭

©2009-2025 Movatter.jp