-
-
Notifications
You must be signed in to change notification settings - Fork 39.9k
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 st-flash
flash target
#9964
Conversation
Add support for flashing the firmware via the `st-flash` utility from the STLink Tools package (https://github.com/stlink-org/stlink).
For the record, I've also struck the annoying DFU problem with the F401's (maybe 1 in 8 successful boots to DFU), but the F411's I've got have all worked fine even with the 25MHz crystal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F103, F401, F411 all good.
I found another place where the available flashing tools (somewhat confusingly named “bootloaders”) are listed — the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Thanks! |
* Add `st-flash` flash target Add support for flashing the firmware via the `st-flash` utility from the STLink Tools package (https://github.com/stlink-org/stlink). * Add `st-flash` to the `qmk flash -b` output
* Add `st-flash` flash target Add support for flashing the firmware via the `st-flash` utility from the STLink Tools package (https://github.com/stlink-org/stlink). * Add `st-flash` to the `qmk flash -b` output
* Add `st-flash` flash target Add support for flashing the firmware via the `st-flash` utility from the STLink Tools package (https://github.com/stlink-org/stlink). * Add `st-flash` to the `qmk flash -b` output
* Add `st-flash` flash target Add support for flashing the firmware via the `st-flash` utility from the STLink Tools package (https://github.com/stlink-org/stlink). * Add `st-flash` to the `qmk flash -b` output
* Add `st-flash` flash target Add support for flashing the firmware via the `st-flash` utility from the STLink Tools package (https://github.com/stlink-org/stlink). * Add `st-flash` to the `qmk flash -b` output
* Add `st-flash` flash target Add support for flashing the firmware via the `st-flash` utility from the STLink Tools package (https://github.com/stlink-org/stlink). * Add `st-flash` to the `qmk flash -b` output
Description
Add support for flashing the firmware via the
st-flash
utility from the STLink Tools package (https://github.com/stlink-org/stlink).The ST-LINK CLI utility used by the
st-link-cli
target is proprietary and Windows-only; thest-flash
utility is open source (BSD 3-clause), and the STLink Tools package (calledstlink
, or sometimesstlink-tools
) is available in many Linux distributions and in Homebrew for Mac OS.I tested this with some STM32 development boards:
handwired/onekey/bluepill
firmware over ST-LINK)The main reason for this PR is that some of the STM32F401CCU6 “Blackpill” boards sold on AliExpress apparently suffer from a combination of design deficiency and suboptimal component quality, and the builtin DFU bootloader on them is unreliable to the point of being unusable, so flashing them over ST-LINK seems to be much easier than trying to make the DFU bootloader start up properly by heating up the MCU. The problem is that the designer of those boards decided to use a 25 MHz crystal for HSE, and the builtin DFU bootloader attempts to determine the HSE frequency using the builtin HSI RC oscillator as a reference, which could actually work properly if the HSI frequency was within ±1% of 16 MHz, as written in the datasheet; however, apparently on some chips the factory calibration of HSI is much worse, and if the error is more than about 2% (for the 25 MHz crystal), the HSE frequency detection does not work properly, and then DFU gets lots of USB errors and does not work. Running the actual QMK firmware on those boards is not a problem, however, because the firmware uses a static PLL configuration for the 25 MHz crystal, and a wrong HSI frequency does not matter.
Other “Blackpill” board versions (STM32F411CEU6 and the updated STM32F401CEU6) could potentially have the same problem (they have the same 25 MHz HSE crystal).
I targeted the PR to
develop
, as requested in the new PR checklist, but the base of the branch is also suitable formaster
, if you decide that the change is trivial enough to be added there directly.Types of Changes
Checklist