import { _ as _export_sfc, c as createElementBlock, o as openBlock, a8 as createStaticVNode } from "./chunks/framework.B9AX-CPi.js"; const __pageData = JSON.parse('{"title":"Flashing Instructions and Bootloader Information","description":"","frontmatter":{},"headers":[],"relativePath":"flashing.md","filePath":"flashing.md"}'); const _sfc_main = { name: "flashing.md" }; const _hoisted_1 = /* @__PURE__ */ createStaticVNode('
There 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 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.
For 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).
You will also be able to use the CLI to flash your keyboard, by running:
$ qmk flash -kb <keyboard> -km <keymap>
See the qmk flash
documentation for more information.
Atmel'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.
To ensure compatibility with the DFU bootloader, make sure this block is present in your rules.mk
(optionally with lufa-dfu
or qmk-dfu
instead):
# Bootloader selection\nBOOTLOADER = atmel-dfu
Compatible flashers:
:dfu
target in QMK (recommended command line)dfu-programmer <mcu> erase --force\ndfu-programmer <mcu> flash --force <filename>\ndfu-programmer <mcu> reset
Flashing sequence:
QK_BOOT
keycodeRESET
button on the PCB if availablemake
command)QMK maintains a fork of the LUFA DFU bootloader 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
:
#define QMK_ESC_OUTPUT F1 // COL pin if COL2ROW\n#define QMK_ESC_INPUT D5 // ROW pin if COL2ROW\n// Optional:\n//#define QMK_LED E6\n//#define QMK_SPEAKER C6
Currently we do not recommend making QMK_ESC
the same key as the one designated for Bootmagic, as holding it down will cause the MCU to loop back and forth between entering and exiting the bootloader.
The manufacturer and product strings are automatically pulled from config.h
, with " Bootloader" appended to the product string.
To 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
.
make
Targets :dfu
: Checks every 5 seconds until a DFU device is available, and then flashes the firmware.: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.Arduino boards and their clones use the Caterina bootloader 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.
To ensure compatibility with the Caterina bootloader, make sure this block is present in your rules.mk
:
# Bootloader selection\nBOOTLOADER = caterina
Compatible flashers:
avr109
programmer / :avrdude
target in QMK (recommended command line)avrdude -p <mcu> -c avr109 -P <serialport> -U flash:w:<filename>:i
Flashing sequence:
QK_BOOT
keycodeRESET
button on the PCB if availablemake
Targets :avrdude
: Checks every 5 seconds until a Caterina device is available (by detecting a new COM port), and then flashes the firmware.: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.: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.HalfKay 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.
To ensure compatibility with the Halfkay bootloader, make sure this block is present in your rules.mk
:
# Bootloader selection\nBOOTLOADER = halfkay
Compatible flashers:
:teensy
target in QMK (recommended command line)teensy_loader_cli -v -mmcu=<mcu> <filename>
Flashing sequence:
QK_BOOT
keycodeRESET
button on the Teensy or PCB if availableUSBasploader is a bootloader originally by Objective Development. It emulates a USBasp ISP programmer and is used in some non-USB AVR chips such as the ATmega328P, which run V-USB.
To ensure compatibility with the USBasploader bootloader, make sure this block is present in your rules.mk
:
# Bootloader selection\nBOOTLOADER = usbasploader
Compatible flashers:
usbasp
programmer / :usbasp
target in QMK (recommended command line)avrdude -p <mcu> -c usbasp -U flash:w:<filename>:i
Flashing sequence:
QK_BOOT
keycodeBOOT
button held while quickly tapping the RESET
button on the PCBRESET
button on the PCB or short RST to GNDBootloadHID 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.
To ensure compatibility with the bootloadHID bootloader, make sure this block is present in your rules.mk
:
# Bootloader selection\nBOOTLOADER = bootloadhid
Compatible flashers:
:bootloadhid
target in QMK (recommended command line)bootloadHID -r <filename>
Flashing sequence:
QK_BOOT
keycodeQMK maintains a fork of the LUFA HID bootloader, which uses a USB HID Endpoint for flashing in the way that the PJRC's Teensy Loader flasher and HalfKay bootloader work. Additionally, it 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 ensure compatibility with the QMK HID bootloader, make sure this block is present in your rules.mk
:
# Bootloader selection\nBOOTLOADER = qmk-hid
To enable the additional features, add the following defines to your config.h
:
#define QMK_ESC_OUTPUT F1 // COL pin if COL2ROW\n#define QMK_ESC_INPUT D5 // ROW pin if COL2ROW\n// Optional:\n//#define QMK_LED E6\n//#define QMK_SPEAKER C6
Currently we do not recommend making QMK_ESC
the same key as the one designated for Bootmagic, as holding it down will cause the MCU to loop back and forth between entering and exiting the bootloader.
The manufacturer and product strings are automatically pulled from config.h
, with " Bootloader" appended to the product string.
To 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
.
Compatible flashers:
hid_bootloader_cli
, from the LUFA repo. Homebrew may (will) have support for this directly (via brew install qmk/qmk/hid_bootloader_cli
).Flashing sequence:
QK_BOOT
keycodeRESET
button on the PCB if availablemake
Targets :qmk-hid
: Checks every 5 seconds until a DFU device is available, and then flashes the firmware.All USB-capable STM32 and APM32 MCUs, except for a small handful (such as STM32F103 -- see the STM32duino section) come preloaded with a factory bootloader that cannot be modified nor deleted.
To ensure compatibility with the STM32-DFU bootloader, make sure this block is present in your rules.mk
(optionally with apm32-dfu
instead):
# Bootloader selection\nBOOTLOADER = stm32-dfu
Compatible flashers:
:dfu-util
target in QMK (recommended command line)dfu-util -a 0 -d 0483:DF11 -s 0x8000000:leave -D <filename>
Flashing sequence:
QK_BOOT
keycode (may not work on STM32F042 devices)RESET
button on the PCB; some boards may also have a toggle switch that must be flippedBOOT0
to VCC (via BOOT0
button or jumper), short RESET
to GND (via RESET
button or jumper), and then let go of the BOOT0
bridgemake
Targets :dfu-util
: Waits until an STM32 bootloader device is available, and then flashes the firmware.:dfu-util-split-left
and :dfu-util-split-right
: Flashes the firmware as with :dfu-util
, but also sets the handedness setting in EEPROM. This is ideal for Proton-C-based split keyboards.:st-link-cli
: Allows you to flash the firmware via the ST-Link CLI utility, rather than dfu-util. Requires an ST-Link dongle.:st-flash
: Allows you to flash the firmware via the st-flash
utility from STLink Tools, rather than dfu-util. Requires an ST-Link dongle.This 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.
To ensure compatibility with the STM32duino bootloader, make sure this block is present in your rules.mk
:
# Bootloader selection\nBOOTLOADER = stm32duino
Compatible flashers:
:dfu-util
target in QMK (recommended command line)dfu-util -a 2 -d 1EAF:0003 -D <filename>
Flashing sequence:
QK_BOOT
keycodeRESET
button on the PCBBOOT0
to VCC (via BOOT0
button or jumper), short RESET
to GND (via RESET
button or jumper), and then let go of the BOOT0
bridgeKeyboards produced by Input Club use NXP Kinetis microcontrollers rather than STM32, and come with their own custom bootloader, however the process and protocol is largely the same.
The 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.
Compatible flashers:
:dfu-util
target in QMK (recommended command line)dfu-util -a 0 -d 1C11:B007 -D <filename>
Flashing sequence:
QK_BOOT
keycodeRESET
button on the PCBSome keyboards produced for several commercial brands (GMMK, Akko, MonsGeek, Inland) use this bootloader. The wb32-dfu-updater
utility is bundled with QMK MSYS and Glorious's build of QMK Toolbox. If neither of these flashing methods is available for your OS, you will likely need to compile the CLI version from source.
The info.json
setting for this bootloader is wb32-dfu
.
Compatible flashers:
:flash
target in QMK (recommended command line)wb32-dfu-updater_cli -t -s 0x8000000 -D <filename>
Flashing sequence:
QK_BOOT
keycodeRESET
button on the PCBKeyboards may opt into supporting the tinyuf2 bootloader. This is currently only supported on F303/F401/F411.
The rules.mk
setting for this bootloader is tinyuf2
, and can be specified at the keymap or user level.
To ensure compatibility with the tinyuf2 bootloader, make sure this block is present in your rules.mk
:
# Bootloader selection\nBOOTLOADER = tinyuf2
Compatible flashers:
Flashing sequence:
QK_BOOT
keycodenRST
button on the PCB.or
CLI Flashing sequence:
QK_BOOT
keycodenRST
button on the PCB.qmk flash --keyboard handwired/onekey/blackpill_f411_tinyuf2 --keymap default
make
Targets :uf2-split-left
and :uf2-split-right
: Flashes the firmware but also sets the handedness setting in EEPROM by generating a side specific firmware.Keyboards may opt into supporting the uf2boot bootloader. This is currently only supported on F103.
The rules.mk
setting for this bootloader is uf2boot
, and can be specified at the keymap or user level.
To ensure compatibility with the uf2boot bootloader, make sure this block is present in your rules.mk
:
# Bootloader selection\nBOOTLOADER = uf2boot
Compatible flashers:
Flashing sequence:
QK_BOOT
keycodenRST
button on the PCB.or
CLI Flashing sequence:
QK_BOOT
keycodenRST
button on the PCB.qmk flash --keyboard handwired/onekey/bluepill_uf2boot --keymap default
make
Targets :uf2-split-left
and :uf2-split-right
: Flashes the firmware but also sets the handedness setting in EEPROM by generating a side specific firmware.The rules.mk
setting for this bootloader is rp2040
, and can be specified at the keymap or user level.
To ensure compatibility with the rp2040 bootloader, make sure this block is present in your rules.mk
:
# Bootloader selection\nBOOTLOADER = rp2040
Compatible flashers:
Flashing sequence:
QK_BOOT
keycodeBOOTSEL
button on the PCB while plugin in the usb cable.RESET
button on the PCB1.or
CLI Flashing sequence:
QK_BOOT
keycodeBOOTSEL
button on the PCB while plugin in the usb cable.RESET
button on the PCB1.qmk flash --keyboard handwired/onekey/rpi_pico --keymap default
1: This works only if the controller has been flashed with QMK Firmware with RP2040_BOOTLOADER_DOUBLE_TAP_RESET
defined.