Skip to content
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

Add dual-bank STM32 bootloader support #8778

Merged
merged 1 commit into from
Jul 16, 2020

Conversation

tzarc
Copy link
Member

@tzarc tzarc commented Apr 13, 2020

Description

Adds support for STM32 dual-bank flash bootloaders, by toggling a GPIO during early init in order to charge an RC circuit attached to BOOT0.

The main rationale behind this is that dual-bank STM32 devices unconditionally execute user-mode code, regardless of whether or not the user-mode code jumps to the bootloader. If either flash bank is valid (and BOOT0 is low), then the built-in bootloader will skip any sort of DFU.

This PR allows for the initialisation sequencing to charge the RC circuit based on the example circuit posted on Discord, effectively pulling BOOT0 high before issuing the system reset. As the RC circuit takes a while to discharge, the system reset executes the ROM bootloader which subsequently sees BOOT0 high, and starts executing the DFU routines.

Tested with STM32L082 (with current QMK+current ChibiOS), and STM32G474 (against ChibiOS 20.x).

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@tzarc tzarc requested a review from a team April 13, 2020 03:39
@tzarc tzarc marked this pull request as ready for review April 13, 2020 04:14
@tzarc tzarc self-assigned this Apr 17, 2020
@drashna drashna requested review from a team April 19, 2020 00:57
Copy link
Member

@noroadsleft noroadsleft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__attribute__ ((weak)) ✔️

Don't have any chips that can use this on which to test, but the code looks good to me.

docs/platformdev_chibios_earlyinit.md Show resolved Hide resolved
@noroadsleft noroadsleft requested a review from a team May 16, 2020 16:43
@tzarc tzarc changed the base branch from master to develop July 16, 2020 06:53
@tzarc tzarc force-pushed the stm32-dual-bank-bootloaders branch from 398499a to 6c13d40 Compare July 16, 2020 06:55
@tzarc tzarc merged commit c0518c2 into qmk:develop Jul 16, 2020
@tzarc tzarc deleted the stm32-dual-bank-bootloaders branch July 16, 2020 06:58
noroadsleft pushed a commit that referenced this pull request Jul 18, 2020
noroadsleft pushed a commit that referenced this pull request Jul 26, 2020
noroadsleft pushed a commit that referenced this pull request Jul 31, 2020
noroadsleft pushed a commit that referenced this pull request Aug 11, 2020
noroadsleft pushed a commit that referenced this pull request Aug 27, 2020
noroadsleft pushed a commit that referenced this pull request Aug 29, 2020
nicocesar pushed a commit to nicocesar/qmk_firmware that referenced this pull request Sep 6, 2020
drashna pushed a commit to zsa/qmk_firmware that referenced this pull request Sep 30, 2020
kjganz pushed a commit to kjganz/qmk_firmware that referenced this pull request Oct 28, 2020
BorisTestov pushed a commit to BorisTestov/qmk_firmware that referenced this pull request May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants