aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2021-01-20 14:04:21 +1100
committerGitHub <noreply@github.com>2021-01-20 14:04:21 +1100
commiteba512596a0e7845b9cf7efdad19b820e9974e00 (patch)
tree7f557187a3d4942362fde386c2f4aab32842398c
parentd28d474dc05ee008615f8bf94c0e1664b614ad91 (diff)
downloadqmk_firmware-eba512596a0e7845b9cf7efdad19b820e9974e00.tar.gz
qmk_firmware-eba512596a0e7845b9cf7efdad19b820e9974e00.zip
Add stm32-dfu and apm32-dfu to bootloader.mk (#11019)
* Add stm32-dfu and apm32-dfu to bootloader.mk * Update flashing docs * Update comment * Further wordsmithing
-rw-r--r--bootloader.mk41
-rw-r--r--docs/flashing.md239
2 files changed, 154 insertions, 126 deletions
diff --git a/bootloader.mk b/bootloader.mk
index 5487f9ece..8b4bc7a0f 100644
--- a/bootloader.mk
+++ b/bootloader.mk
@@ -20,15 +20,19 @@
20# Sets the bootloader defined in the keyboard's/keymap's rules.mk 20# Sets the bootloader defined in the keyboard's/keymap's rules.mk
21# Current options: 21# Current options:
22# 22#
23# halfkay PJRC Teensy 23# AVR:
24# caterina Pro Micro (Sparkfun/generic) 24# halfkay PJRC Teensy
25# atmel-dfu Atmel factory DFU 25# caterina Pro Micro (Sparkfun/generic)
26# lufa-dfu LUFA DFU 26# atmel-dfu Atmel factory DFU
27# qmk-dfu QMK DFU (LUFA + blinkenlight) 27# lufa-dfu LUFA DFU
28# bootloadHID HIDBootFlash compatible (ATmega32A) 28# qmk-dfu QMK DFU (LUFA + blinkenlight)
29# USBasp USBaspLoader (ATmega328P) 29# bootloadHID HIDBootFlash compatible (ATmega32A)
30# kiibohd Input:Club Kiibohd bootloader (only used on their boards) 30# USBasp USBaspLoader (ATmega328P)
31# stm32duino STM32Duino (STM32F103x8) 31# ARM:
32# kiibohd Input:Club Kiibohd bootloader (only used on their boards)
33# stm32duino STM32Duino (STM32F103x8)
34# stm32-dfu STM32 USB DFU in ROM
35# apm32-dfu APM32 USB DFU in ROM
32# 36#
33# BOOTLOADER_SIZE can still be defined manually, but it's recommended 37# BOOTLOADER_SIZE can still be defined manually, but it's recommended
34# you add any possible configuration to this list 38# you add any possible configuration to this list
@@ -95,6 +99,20 @@ ifdef BOOTLOADER_SIZE
95 OPT_DEFS += -DBOOTLOADER_SIZE=$(strip $(BOOTLOADER_SIZE)) 99 OPT_DEFS += -DBOOTLOADER_SIZE=$(strip $(BOOTLOADER_SIZE))
96endif 100endif
97 101
102ifeq ($(strip $(BOOTLOADER)), stm32-dfu)
103 OPT_DEFS += -DBOOTLOADER_STM32_DFU
104
105 # Options to pass to dfu-util when flashing
106 DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave
107 DFU_SUFFIX_ARGS ?= -v 0483 -p DF11
108endif
109ifeq ($(strip $(BOOTLOADER)), apm32-dfu)
110 OPT_DEFS += -DBOOTLOADER_APM32_DFU
111
112 # Options to pass to dfu-util when flashing
113 DFU_ARGS ?= -d 314B:0106 -a 0 -s 0x08000000:leave
114 DFU_SUFFIX_ARGS ?= -v 314B -p 0106
115endif
98ifeq ($(strip $(BOOTLOADER)), kiibohd) 116ifeq ($(strip $(BOOTLOADER)), kiibohd)
99 OPT_DEFS += -DBOOTLOADER_KIIBOHD 117 OPT_DEFS += -DBOOTLOADER_KIIBOHD
100 ifeq ($(strip $(MCU_ORIG)), MK20DX128) 118 ifeq ($(strip $(MCU_ORIG)), MK20DX128)
@@ -104,10 +122,10 @@ ifeq ($(strip $(BOOTLOADER)), kiibohd)
104 MCU_LDSCRIPT = MK20DX256BLDR8 122 MCU_LDSCRIPT = MK20DX256BLDR8
105 endif 123 endif
106 124
125 # Options to pass to dfu-util when flashing
107 DFU_ARGS = -d 1C11:B007 126 DFU_ARGS = -d 1C11:B007
108 DFU_SUFFIX_ARGS = -v 1C11 -p B007 127 DFU_SUFFIX_ARGS = -v 1C11 -p B007
109endif 128endif
110
111ifeq ($(strip $(BOOTLOADER)), stm32duino) 129ifeq ($(strip $(BOOTLOADER)), stm32duino)
112 OPT_DEFS += -DBOOTLOADER_STM32DUINO 130 OPT_DEFS += -DBOOTLOADER_STM32DUINO
113 MCU_LDSCRIPT = STM32F103x8_stm32duino_bootloader 131 MCU_LDSCRIPT = STM32F103x8_stm32duino_bootloader
@@ -115,6 +133,7 @@ ifeq ($(strip $(BOOTLOADER)), stm32duino)
115 # STM32F103 does NOT have an USB bootloader in ROM (only serial), so setting anything here does not make much sense 133 # STM32F103 does NOT have an USB bootloader in ROM (only serial), so setting anything here does not make much sense
116 STM32_BOOTLOADER_ADDRESS = 0x80000000 134 STM32_BOOTLOADER_ADDRESS = 0x80000000
117 135
118 DFU_ARGS = -d 1EAF:0003 -a2 -R 136 # Options to pass to dfu-util when flashing
137 DFU_ARGS = -d 1EAF:0003 -a 2 -R
119 DFU_SUFFIX_ARGS = -v 1EAF -p 0003 138 DFU_SUFFIX_ARGS = -v 1EAF -p 0003
120endif 139endif
diff --git a/docs/flashing.md b/docs/flashing.md
index 5c245c567..be6aec652 100644
--- a/docs/flashing.md
+++ b/docs/flashing.md
@@ -1,242 +1,251 @@
1# Flashing Instructions and Bootloader Information 1# Flashing Instructions and Bootloader Information
2 2
3There are quite a few different types of bootloaders that keyboards use, and just about all of them use a different flashing method. Luckily, projects like the [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) aim to be compatible with all the different types without having to think about it much, but this article will describe the different types of bootloaders, and available methods for flashing them. 3There are quite a few different types of bootloaders that keyboards use, and almost all of them use their own flashing method and tools. Luckily, projects like the [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) aim to support as many of them as possible, but this article will describe the different types of bootloaders, and available methods for flashing them.
4 4
5If you have a bootloader selected with the `BOOTLOADER` variable in your `rules.mk`, QMK will automatically calculate if your .hex file is the right size to be flashed to the device, and output the total size in bytes (along with the max). 5For AVR-based keyboards, QMK will automatically calculate if your `.hex` file is the right size to be flashed to the device based on the `BOOTLOADER` value set in `rules.mk`, and output the total size in bytes (along with the max).
6 6
7## DFU 7You will also be able to use the CLI to flash your keyboard, by running:
8```
9$ qmk flash -kb <keyboard> -km <keymap>
10```
11See the [`qmk flash`](cli_commands.md#qmk-flash) documentation for more information.
8 12
9Atmel's DFU bootloader comes on all atmega32u4 chips by default, and is used by many keyboards that have their own ICs on their PCBs (Older OLKB boards, Clueboards). Some keyboards may also use LUFA's DFU bootloader (or QMK's fork) (Newer OLKB boards) that adds in additional features specific to that hardware. 13## Atmel DFU
10 14
11To ensure compatibility with the DFU bootloader, make sure this block is present your `rules.mk` (optionally with `lufa-dfu` or `qmk-dfu` instead): 15Atmel's DFU bootloader comes on all USB AVRs by default (except for 16/32U4RC), and is used by many keyboards that have their own ICs on their PCBs (older OLKB boards, Clueboards). Some keyboards may also use LUFA's DFU bootloader, or QMK's fork of it (newer OLKB boards), that adds in additional features specific to that hardware.
16
17To ensure compatibility with the DFU bootloader, make sure this block is present in your `rules.mk` (optionally with `lufa-dfu` or `qmk-dfu` instead):
12 18
13```make 19```make
14# Bootloader selection 20# Bootloader selection
15# Teensy halfkay
16# Pro Micro caterina
17# Atmel DFU atmel-dfu
18# LUFA DFU lufa-dfu
19# QMK DFU qmk-dfu
20# ATmega32A bootloadHID
21# ATmega328P USBasp
22BOOTLOADER = atmel-dfu 21BOOTLOADER = atmel-dfu
23``` 22```
24 23
25Compatible flashers: 24Compatible flashers:
26 25
27* [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (recommended GUI) 26* [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (recommended GUI)
28* [dfu-programmer](https://github.com/dfu-programmer/dfu-programmer) / `:dfu` in QMK (recommended command line) 27* [dfu-programmer](https://github.com/dfu-programmer/dfu-programmer) / `:dfu` target in QMK (recommended command line)
29 28
30Flashing sequence: 29Flashing sequence:
31 30
321. Press the `RESET` keycode, or tap the RESET button (or short RST to GND). 311. Enter the bootloader using any of the following methods:
32 * Press the `RESET` keycode
33 * Press the `RESET` button on the PCB if available
34 * Short RST to GND quickly
332. Wait for the OS to detect the device 352. Wait for the OS to detect the device
343. Erase the memory (may be done automatically) 363. Erase the flash memory (will be done automatically if using the Toolbox or CLI/`make` command)
354. Flash a .hex file 374. Flash a .hex file
365. Reset the device into application mode (may be done automatically) 385. Reset the device into application mode (will be done automatically as above)
37
38or:
39
40 make <keyboard>:<keymap>:dfu
41 39
42### QMK DFU 40### QMK DFU
43 41
44QMK has a fork of the LUFA DFU bootloader that allows for a simple matrix scan for exiting the bootloader and returning to the application, as well as flashing an LED/making a ticking noise with a speaker when things are happening. To enable these features, use this block in your `config.h` (The key that exits the bootloader needs to be hooked-up to the INPUT and OUTPUT defined here): 42QMK maintains [a fork of the LUFA DFU bootloader](https://github.com/qmk/lufa/tree/master/Bootloaders/DFU) that additionally performs a simple matrix scan for exiting the bootloader and returning to the application, as well as flashing an LED/making a ticking noise with a speaker when things are happening. To enable these features, add the following defines to your `config.h`:
45
46 #define QMK_ESC_OUTPUT F1 // usually COL
47 #define QMK_ESC_INPUT D5 // usually ROW
48 #define QMK_LED E6
49 #define QMK_SPEAKER C6
50 43
51The Manufacturer and Product names are automatically pulled from your `config.h`, and "Bootloader" is added to the product. 44```c
52 45#define QMK_ESC_OUTPUT F1 // COL pin if COL2ROW
53To generate this bootloader, use the `bootloader` target, eg `make planck/rev4:default:bootloader`. 46#define QMK_ESC_INPUT D5 // ROW pin if COL2ROW
47// Optional:
48//#define QMK_LED E6
49//#define QMK_SPEAKER C6
50```
51Currently we do not recommend making `QMK_ESC` the same key as the one designated for [Bootmagic Lite](feature_bootmagic.md#bootmagic-lite), as holding it down will cause the MCU to loop back and forth between entering and exiting the bootloader.
54 52
55To generate a production-ready .hex file (containing the application and the bootloader), use the `production` target, eg `make planck/rev4:default:production`. 53The manufacturer and product strings are automatically pulled from `config.h`, with " Bootloader" appended to the product string.
56 54
57### DFU commands 55To generate this bootloader, use the `bootloader` target, eg. `make planck/rev4:default:bootloader`. To generate a production-ready .hex file (combining QMK and the bootloader), use the `production` target, eg. `make planck/rev4:default:production`.
58 56
59There are a number of DFU commands that you can use to flash firmware to a DFU device: 57### `make` Targets
60 58
61* `:dfu` - This is the normal option and waits until a DFU device is available, and then flashes the firmware. This will check every 5 seconds, to see if a DFU device has appeared. 59* `:dfu`: Checks every 5 seconds until a DFU device is available, and then flashes the firmware.
62* `:dfu-ee` - This flashes an `eep` file instead of the normal hex. This is uncommon. 60* `:dfu-split-left` and `:dfu-split-right`: Flashes the firmware as with `:dfu`, but also sets the handedness setting in EEPROM. This is ideal for Elite-C-based split keyboards.
63* `:dfu-split-left` - This flashes the normal firmware, just like the default option (`:dfu`). However, this also flashes the "Left Side" EEPROM file for split keyboards. _This is ideal for Elite C based split keyboards._
64* `:dfu-split-right` - This flashes the normal firmware, just like the default option (`:dfu`). However, this also flashes the "Right Side" EEPROM file for split keyboards. _This is ideal for Elite C based split keyboards._
65 61
66## Caterina 62## Caterina
67 63
68Arduino boards and their clones use the [Caterina bootloader](https://github.com/arduino/ArduinoCore-avr/tree/master/bootloaders/caterina) (any keyboard built with a Pro Micro, or clone), and uses the avr109 protocol to communicate through virtual serial. Bootloaders like [A-Star](https://www.pololu.com/docs/0J61/9) are based on Caterina. 64Arduino boards and their clones use the [Caterina bootloader](https://github.com/arduino/ArduinoCore-avr/tree/master/bootloaders/caterina) or a variant of it (any keyboard built with a Pro Micro or clone, and the Pololu A-Star), and uses the AVR109 protocol to communicate through virtual serial.
69 65
70To ensure compatibility with the Caterina bootloader, make sure this block is present your `rules.mk`: 66To ensure compatibility with the Caterina bootloader, make sure this block is present in your `rules.mk`:
71 67
72```make 68```make
73# Bootloader selection 69# Bootloader selection
74# Teensy halfkay
75# Pro Micro caterina
76# Atmel DFU atmel-dfu
77# LUFA DFU lufa-dfu
78# QMK DFU qmk-dfu
79# ATmega32A bootloadHID
80# ATmega328P USBasp
81BOOTLOADER = caterina 70BOOTLOADER = caterina
82``` 71```
83 72
84Compatible flashers: 73Compatible flashers:
85 74
86* [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (recommended GUI) 75* [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (recommended GUI)
87* [avrdude](http://www.nongnu.org/avrdude/) with avr109 / `:avrdude` (recommended command line) 76* [avrdude](http://www.nongnu.org/avrdude/) with the `avr109` programmer / `:avrdude` target in QMK (recommended command line)
88* [AVRDUDESS](https://github.com/zkemble/AVRDUDESS) 77* [AVRDUDESS](https://github.com/zkemble/AVRDUDESS)
89 78
90Flashing sequence: 79Flashing sequence:
91 80
921. Press the `RESET` keycode, or short RST to GND quickly (you only have 7 seconds to flash once it enters) 811. Enter the bootloader using any of the following methods (you only have 7 seconds to flash once it enters; some variants may require you to reset twice within 750 milliseconds):
82 * Press the `RESET` keycode
83 * Press the `RESET` button on the PCB if available
84 * Short RST to GND quickly
932. Wait for the OS to detect the device 852. Wait for the OS to detect the device
943. Flash a .hex file 863. Flash a .hex file
954. Wait for the device to reset automatically 874. Wait for the device to reset automatically
96 88
97or 89### `make` Targets
98
99 make <keyboard>:<keymap>:avrdude
100
101
102### Caterina commands
103
104There are a number of DFU commands that you can use to flash firmware to a DFU device:
105
106* `:avrdude` - This is the normal option which waits until a Caterina device is available (by detecting a new COM port), and then flashes the firmware.
107* `:avrdude-loop` - This runs the same command as `:avrdude`, but after each device is flashed, it will attempt to flash again. This is useful for bulk flashing. _This requires you to manually escape the loop by hitting Ctrl+C._
108* `:avrdude-split-left` - This flashes the normal firmware, just like the default option (`:avrdude`). However, this also flashes the "Left Side" EEPROM file for split keyboards. _This is ideal for Pro Micro based split keyboards._
109* `:avrdude-split-right` - This flashes the normal firmware, just like the default option (`:avrdude`). However, this also flashes the "Right Side" EEPROM file for split keyboards. _This is ideal for Pro Micro based split keyboards._
110 90
91* `:avrdude`: Checks every 5 seconds until a Caterina device is available (by detecting a new COM port), and then flashes the firmware.
92* `:avrdude-loop`: Flashes the firmware as with `:avrdude`, but after each device is flashed, will attempt to flash again. This is useful for bulk flashing. Hit Ctrl+C to escape the loop.
93* `:avrdude-split-left` and `:avrdude-split-right`: Flashes the firmware as with `:avrdude`, but also sets the handedness setting in EEPROM. This is ideal for Pro Micro-based split keyboards.
111 94
95## HalfKay
112 96
113## Halfkay 97HalfKay is a super-slim bootloader developed by PJRC that presents itself as an HID device (which requires no additional driver), and comes preflashed on all Teensys, namely the 2.0. It is currently closed-source, and thus once overwritten (eg. via ISP flashing another bootloader), cannot be restored.
114 98
115Halfkay is a super-slim protocol developed by PJRC that uses HID, and comes on all Teensys (namely the 2.0). 99To ensure compatibility with the Halfkay bootloader, make sure this block is present in your `rules.mk`:
116
117To ensure compatibility with the Halfkay bootloader, make sure this block is present your `rules.mk`:
118 100
119```make 101```make
120# Bootloader selection 102# Bootloader selection
121# Teensy halfkay
122# Pro Micro caterina
123# Atmel DFU atmel-dfu
124# LUFA DFU lufa-dfu
125# QMK DFU qmk-dfu
126# ATmega32A bootloadHID
127# ATmega328P USBasp
128BOOTLOADER = halfkay 103BOOTLOADER = halfkay
129``` 104```
130 105
131Compatible flashers: 106Compatible flashers:
132 107
133* [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (recommended GUI) 108* [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (recommended GUI)
109* [Teensy Loader Command Line](https://www.pjrc.com/teensy/loader_cli.html) / `:teensy` target in QMK (recommended command line)
134* [Teensy Loader](https://www.pjrc.com/teensy/loader.html) 110* [Teensy Loader](https://www.pjrc.com/teensy/loader.html)
135* [Teensy Loader Command Line](https://www.pjrc.com/teensy/loader_cli.html) (recommended command line)
136 111
137Flashing sequence: 112Flashing sequence:
138 113
1391. Press the `RESET` keycode, or short RST to GND quickly (you only have 7 seconds to flash once it enters) 1141. Enter the bootloader using any of the following methods (you only have 7 seconds to flash once it enters):
115 * Press the `RESET` keycode
116 * Press the `RESET` button on the Teensy or PCB if available
117 * short RST to GND quickly
1402. Wait for the OS to detect the device 1182. Wait for the OS to detect the device
1413. Flash a .hex file 1193. Flash a .hex file
1424. Reset the device into application mode (may be done automatically) 1204. Reset the device into application mode (may be done automatically)
143 121
144## USBasploader 122## USBasploader
145 123
146USBasploader is a bootloader developed by matrixstorm. It is used in some non-USB AVR chips such as the ATmega328P, which run V-USB. 124USBasploader is a bootloader originally by [Objective Development](https://www.obdev.at/products/vusb/usbasploader.html). It emulates a USBasp ISP programmer and is used in some non-USB AVR chips such as the ATmega328P, which run V-USB.
147 125
148To ensure compatibility with the USBasploader bootloader, make sure this block is present in your `rules.mk`: 126To ensure compatibility with the USBasploader bootloader, make sure this block is present in your `rules.mk`:
149 127
150```make 128```make
151# Bootloader selection 129# Bootloader selection
152# Teensy halfkay
153# Pro Micro caterina
154# Atmel DFU atmel-dfu
155# LUFA DFU lufa-dfu
156# QMK DFU qmk-dfu
157# ATmega32A bootloadHID
158# ATmega328P USBasp
159BOOTLOADER = USBasp 130BOOTLOADER = USBasp
160``` 131```
161 132
162Compatible flashers: 133Compatible flashers:
163 134
164* [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (recommended GUI) 135* [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (recommended GUI)
165* [avrdude](http://www.nongnu.org/avrdude/) with the `usbasp` programmer 136* [avrdude](http://www.nongnu.org/avrdude/) with the `usbasp` programmer / `:usbasp` target in QMK (recommended command line)
166* [AVRDUDESS](https://github.com/zkemble/AVRDUDESS) 137* [AVRDUDESS](https://github.com/zkemble/AVRDUDESS)
167 138
168Flashing sequence: 139Flashing sequence:
169 140
1701. Press the `RESET` keycode, or keep the boot pin shorted to GND while quickly shorting RST to GND 1411. Enter the bootloader using any of the following methods:
142 * Press the `RESET` keycode
143 * Keep the `BOOT` button held while quickly tapping the `RESET` button on the PCB
1712. Wait for the OS to detect the device 1442. Wait for the OS to detect the device
1723. Flash a .hex file 1453. Flash a .hex file
1734. Reset the device into application mode (may be done automatically) 1464. Press the `RESET` button on the PCB or short RST to GND
174 147
175## BootloadHID 148## BootloadHID
176 149
177BootloadHID is a USB bootloader for AVR microcontrollers. The uploader tool requires no kernel level driver on Windows and can therefore be run without installing any DLLs. 150BootloadHID is a USB bootloader for AVR microcontrollers. It presents itself as an HID input device, much like HalfKay, and can therefore be run without installing any driver on Windows.
178 151
179To ensure compatibility with the bootloadHID bootloader, make sure this block is present your `rules.mk`: 152To ensure compatibility with the bootloadHID bootloader, make sure this block is present in your `rules.mk`:
180 153
181```make 154```make
182# Bootloader selection 155# Bootloader selection
183# Teensy halfkay
184# Pro Micro caterina
185# Atmel DFU atmel-dfu
186# LUFA DFU lufa-dfu
187# QMK DFU qmk-dfu
188# ATmega32A bootloadHID
189# ATmega328P USBasp
190BOOTLOADER = bootloadHID 156BOOTLOADER = bootloadHID
191``` 157```
192 158
193Compatible flashers: 159Compatible flashers:
194 160
195* [HIDBootFlash](http://vusb.wikidot.com/project:hidbootflash) (recommended Windows GUI) 161* [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (recommended GUI)
196* [bootloadhid Command Line](https://www.obdev.at/products/vusb/bootloadhid.html) / `:BootloadHID` in QMK (recommended command line) 162* [bootloadHID CLI](https://www.obdev.at/products/vusb/bootloadhid.html) / `:bootloadHID` target in QMK (recommended command line)
163* [HIDBootFlash](http://vusb.wikidot.com/project:hidbootflash)
197 164
198Flashing sequence: 165Flashing sequence:
199 166
2001. Enter the bootloader using any of the following methods: 1671. Enter the bootloader using any of the following methods:
201 * Tap the `RESET` keycode (may not work on all devices) 168 * Tap the `RESET` keycode
202 * Hold the salt key while plugging the keyboard in (usually documented within keyboard readme) 169 * Hold the salt key while plugging the keyboard in - for PS2AVRGB boards, this is usually the key connected to MCU pins A0 and B0, otherwise it will be documented in your keyboard's readme
2032. Wait for the OS to detect the device 1702. Wait for the OS to detect the device
2043. Flash a .hex file 1713. Flash a .hex file
2054. Reset the device into application mode (may be done automatically) 1724. Reset the device into application mode (may be done automatically)
206 173
207or: 174## STM32/APM32 DFU
208 175
209 make <keyboard>:<keymap>:bootloadHID 176All STM32 and APM32 MCUs, except for F103 (see the [STM32duino section](#stm32duino)) come preloaded with a factory bootloader that cannot be modified nor deleted.
210 177
211## STM32 178To ensure compatibility with the STM32-DFU bootloader, make sure this block is present in your `rules.mk` (optionally with `apm32-dfu` instead):
212 179
213All STM32 chips come preloaded with a factory bootloader that cannot be modified nor deleted. Some STM32 chips have bootloaders that do not come with USB programming (e.g. STM32F103) but the process is still the same. 180```make
214 181# Bootloader selection
215At the moment, no `BOOTLOADER` variable is needed on `rules.mk` for STM32. 182BOOTLOADER = stm32-dfu
183```
216 184
217Compatible flashers: 185Compatible flashers:
218 186
219* [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (recommended GUI) 187* [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (recommended GUI)
220* [dfu-util](https://github.com/Stefan-Schmidt/dfu-util) / `:dfu-util` (recommended command line) 188* [dfu-util](http://dfu-util.sourceforge.net/) / `:dfu-util` target in QMK (recommended command line)
221 189
222Flashing sequence: 190Flashing sequence:
223 191
2241. Enter the bootloader using any of the following methods: 1921. Enter the bootloader using any of the following methods:
225 * Tap the `RESET` keycode (may not work on STM32F042 devices) 193 * Tap the `RESET` keycode (may not work on STM32F042 devices)
226 * If a reset circuit is present, tap the RESET button 194 * If a reset circuit is present, tap the `RESET` button on the PCB; some boards may also have a toggle switch that must be flipped
227 * Otherwise, you need to bridge BOOT0 to VCC (via BOOT0 button or bridge), short RESET to GND (via RESET button or bridge), and then let go of the BOOT0 bridge 195 * Otherwise, you need to bridge `BOOT0` to VCC (via `BOOT0` button or jumper), short `RESET` to GND (via `RESET` button or jumper), and then let go of the `BOOT0` bridge
2282. Wait for the OS to detect the device 1962. Wait for the OS to detect the device
2293. Flash a .bin file 1973. Flash a .bin file
230 * You will receive a warning about the DFU signature; Just ignore it
2314. Reset the device into application mode (may be done automatically) 1984. Reset the device into application mode (may be done automatically)
232 * If you are building from command line (e.g. `make planck/rev6:default:dfu-util`), make sure that `:leave` is passed to the `DFU_ARGS` variable inside your `rules.mk` (e.g. `DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000:leave`) so that your device resets after flashing
233 199
234### STM32 Commands 200### `make` Targets
201
202* `:dfu-util`: Waits until an STM32 bootloader device is available, and then flashes the firmware.
203* `:dfu-util-split-left` and `:dfu-util-split-right`: Flashes the firmware as with `:avrdude`, but also sets the handedness setting in EEPROM. This is ideal for Proton-C-based split keyboards.
204* `:st-link-cli`: Allows you to flash the firmware via the ST-Link CLI utility, rather than dfu-util. Requires an ST-Link dongle.
205* `:st-flash`: Allows you to flash the firmware via the `st-flash` utility from [STLink Tools](https://github.com/stlink-org/stlink), rather than dfu-util. Requires an ST-Link dongle.
206
207## STM32duino
235 208
236There are a number of DFU commands that you can use to flash firmware to a STM32 device: 209This bootloader is used almost exclusively for STM32F103 boards, as they do not come with a USB DFU bootloader. The source code and prebuilt binaries can be found [here](https://github.com/rogerclarkmelbourne/STM32duino-bootloader).
237 210
238* `:dfu-util` - The default command for flashing to STM32 devices, and will wait until an STM32 bootloader device is present. 211To ensure compatibility with the STM32duino bootloader, make sure this block is present in your `rules.mk`:
239* `:dfu-util-split-left` - This flashes the normal firmware, just like the default option (`:dfu-util`). However, this also configures the "Left Side" EEPROM setting for split keyboards. 212
240* `:dfu-util-split-right` - This flashes the normal firmware, just like the default option (`:dfu-util`). However, this also configures the "Right Side" EEPROM setting for split keyboards. 213```make
241* `:st-link-cli` - This allows you to flash the firmware via ST-LINK's CLI utility, rather than dfu-util. 214# Bootloader selection
242* `:st-flash` - This allows you to flash the firmware via the `st-flash` utility from [STLink Tools](https://github.com/stlink-org/stlink), rather than dfu-util. 215BOOTLOADER = stm32duino
216```
217
218Compatible flashers:
219
220* [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (recommended GUI)
221* [dfu-util](http://dfu-util.sourceforge.net/) / `:dfu-util` target in QMK (recommended command line)
222
223Flashing sequence:
224
2251. Enter the bootloader using any of the following methods:
226 * Tap the `RESET` keycode
227 * If a reset circuit is present, tap the `RESET` button on the PCB
228 * Otherwise, you need to bridge `BOOT0` to VCC (via `BOOT0` button or jumper), short `RESET` to GND (via `RESET` button or jumper), and then let go of the `BOOT0` bridge
2292. Wait for the OS to detect the device
2303. Flash a .bin file
2314. Reset the device into application mode (may be done automatically)
232
233## Kiibohd DFU
234
235Keyboards produced by Input Club use NXP Kinetis microcontrollers rather than STM32, and come with their own [custom bootloader](https://github.com/kiibohd/controller/tree/master/Bootloader), however the process and protocol is largely the same.
236
237The `rules.mk` setting for this bootloader is `kiibohd`, but since this bootloader is limited to Input Club boards, it should not be necessary to set at keymap or user level.
238
239Compatible flashers:
240
241* [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (recommended GUI)
242* [dfu-util](http://dfu-util.sourceforge.net/) / `:dfu-util` target in QMK (recommended command line)
243
244Flashing sequence:
245
2461. Enter the bootloader using any of the following methods:
247 * Tap the `RESET` keycode (this may only enter the MCU into a "secure" bootloader mode; see https://github.com/qmk/qmk_firmware/issues/6112)
248 * Press the `RESET` button on the PCB
2492. Wait for the OS to detect the device
2503. Flash a .bin file
2514. Reset the device into application mode (may be done automatically)