aboutsummaryrefslogtreecommitdiff
path: root/docs/newbs_flashing.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/newbs_flashing.md')
-rw-r--r--docs/newbs_flashing.md275
1 files changed, 11 insertions, 264 deletions
diff --git a/docs/newbs_flashing.md b/docs/newbs_flashing.md
index 428e698e2..3cbeb1c4b 100644
--- a/docs/newbs_flashing.md
+++ b/docs/newbs_flashing.md
@@ -86,13 +86,13 @@ Click the `Flash` button in QMK Toolbox. You will see output similar to the foll
86 86
87## Flash your Keyboard from the Command Line 87## Flash your Keyboard from the Command Line
88 88
89This has been made pretty simple compared to what it used to be. When you are ready to compile and flash your firmware, open up your terminal window and run the build command: 89This has been made pretty simple compared to what it used to be. When you are ready to compile and flash your firmware, open up your terminal window and run the flash command:
90 90
91 make <my_keyboard>:<my_keymap>:flash 91 qmk flash
92 92
93For example, if your keymap is named "xyverz" and you're building a keymap for a rev5 planck, you'll use this command: 93If you have not configured your keyboard/keymap name, or you have multiple keyboards, you can specify the keyboard and keymap:
94 94
95 make planck/rev5:xyverz:flash 95 qmk flash -kb <my_keyboard> -km <my_keymap>
96 96
97This will check the keyboard's configuration, and then attempt to flash it based on the specified bootloader. This means that you don't need to know which bootloader that your keyboard uses. Just run the command, and let the command do the heavy lifting. 97This will check the keyboard's configuration, and then attempt to flash it based on the specified bootloader. This means that you don't need to know which bootloader that your keyboard uses. Just run the command, and let the command do the heavy lifting.
98 98
@@ -106,273 +106,20 @@ There are five main bootloaders that are used. Pro Micro and clones use Caterina
106 106
107You can find more information about the bootloaders in the [Flashing Instructions and Bootloader Information](flashing.md) page. 107You can find more information about the bootloaders in the [Flashing Instructions and Bootloader Information](flashing.md) page.
108 108
109If you know what bootloader that you're using, then when compiling the firmware, you can actually add some extra text to the `make` command to automate the flashing process. 109If you know what bootloader that you're using you can specify that in your flash command:
110 110
111### DFU 111 qmk flash -bl <bootloader>
112 112
113For the DFU bootloader, when you're ready to compile and flash your firmware, open up your terminal window and run the build command: 113Run this command to get a list of valid bootloaders:
114 114
115 make <my_keyboard>:<my_keymap>:dfu 115 qmk flash --bootloaders
116 116
117For example, if your keymap is named "xyverz" and you're building a keymap for a rev5 planck, you'll use this command: 117### More information
118 118
119 make planck/rev5:xyverz:dfu 119See the Flashing documentation for more information on esoteric flashing situations.
120
121Once it finishes compiling, it should output the following:
122
123```
124Linking: .build/planck_rev5_xyverz.elf [OK]
125Creating load file for flashing: .build/planck_rev5_xyverz.hex [OK]
126Copying planck_rev5_xyverz.hex to qmk_firmware folder [OK]
127Checking file size of planck_rev5_xyverz.hex
128 * File size is fine - 18574/28672
129 ```
130
131After it gets to this point, the build script will look for the DFU bootloader every 5 seconds. It will repeat the following until the device is found or you cancel it.
132
133 dfu-programmer: no device present.
134 Error: Bootloader not found. Trying again in 5s.
135
136Once it does this, you'll want to reset the controller. It should then show output similar to this:
137
138```
139*** Attempting to flash, please don't remove device
140>>> dfu-programmer atmega32u4 erase --force
141 Erasing flash... Success
142 Checking memory from 0x0 to 0x6FFF... Empty.
143>>> dfu-programmer atmega32u4 flash /Users/skully/qmk_firmware/clueboard_66_hotswap_gen1_skully.hex
144 Checking memory from 0x0 to 0x55FF... Empty.
145 0% 100% Programming 0x5600 bytes...
146 [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] Success
147 0% 100% Reading 0x7000 bytes...
148 [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] Success
149 Validating... Success
150 0x5600 bytes written into 0x7000 bytes memory (76.79%).
151>>> dfu-programmer atmega32u4 reset
152```
153
154?> If you have any issues with this - such as `dfu-programmer: no device present` - please see the [Frequently Asked Build Questions](faq_build.md).
155
156#### DFU commands
157
158There are a number of DFU commands that you can use to flash firmware to a DFU device:
159
160* `: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.
161* `:dfu-ee` - This flashes an `eep` file instead of the normal hex. This is uncommon.
162* `: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._
163* `: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._
164
165
166### Caterina
167
168For Arduino boards and their clones (such as the SparkFun ProMicro), when you're ready to compile and flash your firmware, open up your terminal window and run the build command:
169
170 make <my_keyboard>:<my_keymap>:avrdude
171
172For example, if your keymap is named "xyverz" and you're building a keymap for a rev2 Lets Split, you'll use this command:
173
174 make lets_split/rev2:xyverz:avrdude
175
176Once the firmware finishes compiling, it will output something like this:
177
178```
179Linking: .build/lets_split_rev2_xyverz.elf [OK]
180Creating load file for flashing: .build/lets_split_rev2_xyverz.hex [OK]
181Checking file size of lets_split_rev2_xyverz.hex [OK]
182 * File size is fine - 27938/28672
183Detecting USB port, reset your controller now..............
184```
185
186At this point, reset the board and then the script will detect the bootloader and then flash the board. The output should look something like this:
187
188```
189Detected controller on USB port at /dev/ttyS15
190
191Connecting to programmer: .
192Found programmer: Id = "CATERIN"; type = S
193 Software Version = 1.0; No Hardware Version given.
194Programmer supports auto addr increment.
195Programmer supports buffered memory access with buffersize=128 bytes.
196
197Programmer supports the following devices:
198 Device code: 0x44
199
200avrdude.exe: AVR device initialized and ready to accept instructions
201
202Reading | ################################################## | 100% 0.00s
203
204avrdude.exe: Device signature = 0x1e9587 (probably m32u4)
205avrdude.exe: NOTE: "flash" memory has been specified, an erase cycle will be performed
206 To disable this feature, specify the -D option.
207avrdude.exe: erasing chip
208avrdude.exe: reading input file "./.build/lets_split_rev2_xyverz.hex"
209avrdude.exe: input file ./.build/lets_split_rev2_xyverz.hex auto detected as Intel Hex
210avrdude.exe: writing flash (27938 bytes):
211
212Writing | ################################################## | 100% 2.40s
213
214avrdude.exe: 27938 bytes of flash written
215avrdude.exe: verifying flash memory against ./.build/lets_split_rev2_xyverz.hex:
216avrdude.exe: load data flash data from input file ./.build/lets_split_rev2_xyverz.hex:
217avrdude.exe: input file ./.build/lets_split_rev2_xyverz.hex auto detected as Intel Hex
218avrdude.exe: input file ./.build/lets_split_rev2_xyverz.hex contains 27938 bytes
219avrdude.exe: reading on-chip flash data:
220
221Reading | ################################################## | 100% 0.43s
222
223avrdude.exe: verifying ...
224avrdude.exe: 27938 bytes of flash verified
225
226avrdude.exe: safemode: Fuses OK (E:CB, H:D8, L:FF)
227
228avrdude.exe done. Thank you.
229```
230If you have any issues with this, you may need to this:
231
232 sudo make <my_keyboard>:<my_keymap>:avrdude
233
234
235#### Caterina commands
236
237There are a number of DFU commands that you can use to flash firmware to a DFU device:
238
239* `: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.
240* `: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 Control+C._
241* `: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._
242* `: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._
243
244
245### HalfKay
246
247For the PJRC devices (Teensy's), when you're ready to compile and flash your firmware, open up your terminal window and run the build command:
248
249 make <my_keyboard>:<my_keymap>:teensy
250
251For example, if your keymap is named "xyverz" and you're building a keymap for an Ergodox or Ergodox EZ, you'll use this command:
252
253 make ergodox_ez:xyverz:teensy
254
255Once the firmware finishes compiling, it will output something like this:
256
257```
258Linking: .build/ergodox_ez_xyverz.elf [OK]
259Creating load file for flashing: .build/ergodox_ez_xyverz.hex [OK]
260Checking file size of ergodox_ez_xyverz.hex [OK]
261 * File size is fine - 25584/32256
262 Teensy Loader, Command Line, Version 2.1
263Read "./.build/ergodox_ez_xyverz.hex": 25584 bytes, 79.3% usage
264Waiting for Teensy device...
265 (hint: press the reset button)
266 ```
267
268 At this point, reset your board. Once you've done that, you'll see output like this:
269
270 ```
271 Found HalfKay Bootloader
272Read "./.build/ergodox_ez_xyverz.hex": 28532 bytes, 88.5% usage
273Programming............................................................................................................................................................................
274...................................................
275Booting
276```
277
278### STM32 (ARM)
279
280For a majority of ARM boards (including the Proton C, Planck Rev 6, and Preonic Rev 3), when you're ready to compile and flash your firmware, open up your terminal window and run the build command:
281
282 make <my_keyboard>:<my_keymap>:dfu-util
283
284For example, if your keymap is named "xyverz" and you're building a keymap for the Planck Revision 6 keyboard, you'll use this command and then reboot the keyboard to the bootloader (before it finishes compiling):
285
286 make planck/rev6:xyverz:dfu-util
287
288Once the firmware finishes compiling, it will output something like this:
289
290```
291Linking: .build/planck_rev6_xyverz.elf [OK]
292Creating binary load file for flashing: .build/planck_rev6_xyverz.bin [OK]
293Creating load file for flashing: .build/planck_rev6_xyverz.hex [OK]
294
295Size after:
296 text data bss dec hex filename
297 0 41820 0 41820 a35c .build/planck_rev6_xyverz.hex
298
299Copying planck_rev6_xyverz.bin to qmk_firmware folder [OK]
300dfu-util 0.9
301
302Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
303Copyright 2010-2016 Tormod Volden and Stefan Schmidt
304This program is Free Software and has ABSOLUTELY NO WARRANTY
305Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
306
307Invalid DFU suffix signature
308A valid DFU suffix will be required in a future dfu-util release!!!
309Opening DFU capable USB device...
310ID 0483:df11
311Run-time device DFU version 011a
312Claiming USB DFU Interface...
313Setting Alternate Setting #0 ...
314Determining device status: state = dfuERROR, status = 10
315dfuERROR, clearing status
316Determining device status: state = dfuIDLE, status = 0
317dfuIDLE, continuing
318DFU mode device DFU version 011a
319Device returned transfer size 2048
320DfuSe interface name: "Internal Flash "
321Downloading to address = 0x08000000, size = 41824
322Download [=========================] 100% 41824 bytes
323Download done.
324File downloaded successfully
325Transitioning to dfuMANIFEST state
326```
327
328#### STM32 Commands
329
330There are a number of DFU commands that you can use to flash firmware to a STM32 device:
331
332* `:dfu-util` - The default command for flashing to STM32 devices, and will wait until an STM32 bootloader is present. .
333* `: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.
334* `: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.
335* `:st-link-cli` - This allows you to flash the firmware via ST-LINK's CLI utility, rather than dfu-util.
336
337
338### BootloadHID
339
340For Bootmapper Client(BMC)/bootloadHID/ATmega32A based boards, when you're ready to compile and flash your firmware, open up your terminal window and run the build command:
341
342 make <my_keyboard>:<my_keymap>:bootloaderHID
343
344For example, if your keymap is named "xyverz" and you're building a keymap for a jj40, you'll use this command:
345
346 make jj40:xyverz:bootloaderHID
347
348Once the firmware finishes compiling, it will output something like this:
349
350```
351Linking: .build/jj40_default.elf [OK]
352Creating load file for flashing: .build/jj40_default.hex [OK]
353Copying jj40_default.hex to qmk_firmware folder [OK]
354Checking file size of jj40_default.hex [OK]
355 * The firmware size is fine - 21920/28672 (6752 bytes free)
356```
357
358After it gets to this point, the build script will look for the DFU bootloader every 5 seconds. It will repeat the following until the device is found or you cancel it.
359
360```
361Error opening HIDBoot device: The specified device was not found
362Trying again in 5s.
363```
364
365Once it does this, you'll want to reset the controller. It should then show output similar to this:
366
367```
368Page size = 128 (0x80)
369Device size = 32768 (0x8000); 30720 bytes remaining
370Uploading 22016 (0x5600) bytes starting at 0 (0x0)
3710x05580 ... 0x05600
372```
373 120
374## Test It Out! 121## Test It Out!
375 122
376Congrats! Your custom firmware has been programmed to your keyboard! 123Congrats! Your custom firmware has been programmed to your keyboard!
377 124
378Give it a try and make sure everything works the way you want it to. We've written [Testing and Debugging](newbs_testing_debugging.md) to round out this Newbie Guide, so head over there to learn about how to troubleshoot your custom functionality. 125Give it a try and make sure everything works the way you want it to. We've written [Testing and Debugging](newbs_testing_debugging.md) to round out this Newbie Guide, so head over there to learn about validating your firmware and how to troubleshoot your custom functionality.