]> git.donarmstrong.com Git - qmk_firmware.git/blob - docs/flashing.md
e5fe59f8f03948a67e3e010cb75c8309da3c4f79
[qmk_firmware.git] / docs / flashing.md
1 # Flashing Instructions and Bootloader Information
2
3 There are quite a few different types of bootloaders that keyboards use, and just about all of the 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.
4
5 If 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 it bytes (along with the max). To run this process manually, compile with the target `check-size`, eg `make planck/rev4:default:check-size`.
6
7 ## DFU
8
9 Atmel'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.
10
11 To ensure compatibility with the DFU bootloader, make sure this block is present your `rules.mk` (optionally with `lufa-dfu` or `qmk-dfu` instead):
12
13     # Bootloader
14     #     This definition is optional, and if your keyboard supports multiple bootloaders of
15     #     different sizes, comment this out, and the correct address will be loaded
16     #     automatically (+60). See bootloader.mk for all options.
17     BOOTLOADER = atmel-dfu
18
19 Compatible flashers:
20
21 * [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (recommended GUI)
22 * [dfu-programmer](https://github.com/dfu-programmer/dfu-programmer) / `:dfu` in QMK (recommended command line)
23 * [Atmel's Flip](http://www.microchip.com/developmenttools/productdetails.aspx?partno=flip) (not recommended)
24
25 Flashing sequence:
26
27 1. Press the `RESET` keycode, or tap the RESET button (or short RST to GND).
28 2. Wait for the OS to detect the device
29 3. Erase the memory (may be done automatically)
30 4. Flash a .hex file
31 5. Reset the device into application mode (may be done automatically)
32
33 or:
34
35     make <keyboard>:<keymap>:dfu
36
37 ### QMK DFU
38
39 QMK 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):
40
41     #define QMK_ESC_OUTPUT F1 // usually COL
42     #define QMK_ESC_INPUT D5 // usually ROW
43     #define QMK_LED E6
44     #define QMK_SPEAKER C6
45
46 The Manufacturer and Product names are automatically pulled from your `config.h`, and "Bootloader" is added to the product.
47
48 To generate this bootloader, use the `bootloader` target, eg `make planck/rev4:default:bootloader`.
49
50 To generate a production-ready .hex file (containing the application and the bootloader), use the `production` target, eg `make planck/rev4:default:production`.
51
52 ## Caterina
53
54 Arduino boards and their clones use the [Caterina bootloader](https://github.com/arduino/Arduino/tree/master/hardware/arduino/avr/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.
55
56 To ensure compatibility with the Caterina bootloader, make sure this block is present your `rules.mk`:
57
58     # Bootloader
59     #     This definition is optional, and if your keyboard supports multiple bootloaders of
60     #     different sizes, comment this out, and the correct address will be loaded
61     #     automatically (+60). See bootloader.mk for all options.
62     BOOTLOADER = caterina
63
64 Compatible flashers:
65
66 * [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (recommended GUI)
67 * [avrdude](http://www.nongnu.org/avrdude/) with avr109 / `:avrdude` (recommended command line)
68 * [AVRDUDESS](https://github.com/zkemble/AVRDUDESS)
69
70 Flashing sequence:
71
72 1. Press the `RESET` keycode, or short RST to GND quickly (you only have 7 seconds to flash once it enters)
73 2. Wait for the OS to detect the device
74 4. Flash a .hex file
75 5. Wait for the device to reset automatically
76
77 or
78
79     make <keyboard>:<keymap>:avrdude
80
81 ## Halfkay
82
83 Halfkay is a super-slim protocol developed by PJRC that uses HID, and come on all Teensys (namely the 2.0).
84
85 To ensure compatibility with the Halfkay bootloader, make sure this block is present your `rules.mk`:
86
87     # Bootloader
88     #     This definition is optional, and if your keyboard supports multiple bootloaders of
89     #     different sizes, comment this out, and the correct address will be loaded
90     #     automatically (+60). See bootloader.mk for all options.
91     BOOTLOADER = halfkay
92
93 Compatible flashers:
94
95 * [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (recommended GUI)
96 * [Teensy Loader](https://www.pjrc.com/teensy/loader.html)
97 * [Teensy Loader Command Line](https://www.pjrc.com/teensy/loader_cli.html) (recommended command line)
98
99 Flashing sequence:
100
101 1. Press the `RESET` keycode, or short RST to GND quickly (you only have 7 seconds to flash once it enters)
102 2. Wait for the OS to detect the device
103 4. Flash a .hex file
104 5. Reset the device into application mode (may be done automatically)