aboutsummaryrefslogtreecommitdiff
path: root/docs/zh-cn/newbs_flashing.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/zh-cn/newbs_flashing.md')
-rw-r--r--docs/zh-cn/newbs_flashing.md307
1 files changed, 307 insertions, 0 deletions
diff --git a/docs/zh-cn/newbs_flashing.md b/docs/zh-cn/newbs_flashing.md
new file mode 100644
index 000000000..05a9eb55e
--- /dev/null
+++ b/docs/zh-cn/newbs_flashing.md
@@ -0,0 +1,307 @@
1# 刷新你的键盘
2
3现在您已经构建了一个自定义固件文件,那么您就需要刷新键盘了。
4
5## 用QMK工具箱刷新键盘
6
7刷新键盘的最简单方法是使用[QMK 工具箱](https://github.com/qmk/qmk_toolbox/releases).
8
9但是,QMK工具箱目前仅适用于Windows和MacOS。如果您使用的是Linux(或者只是希望从命令行刷新固件),则必须使用 [方法概述](newbs_flashing.md#flash-your-keyboard-from-the-command-line).
10
11### 将文件加载到QMK工具箱中
12
13首先打开QMK工具箱应用程序。您将要在访达或资源管理器中找到固件文件。您的键盘固件可能是两种格式之一`.hex`或`.bin`。qmk会尝试将键盘的相应文件复制到“qmk_firmware”根目录中。
14
15?> 如果您在Windows或MacOS上,可以使用以下命令轻松地在资源管理器或访达中打开当前固件文件夹。
16
17?> Windows:
18
19 start .
20
21?> macOS:
22
23 open .
24
25固件文件始终遵循此命名格式:
26
27 <keyboard_name>_<keymap_name>.{bin,hex}
28
29例如,使用 `default` 布局的 `plank/rev5` 将使用以下名字:
30
31 planck_rev5_default.hex
32
33找到固件文件后,将其拖到QMK工具箱中的“Local file”框中,或单击“Open”并导航到固件文件的存储位置。
34
35### 将键盘置于DFU(Bootloader)模式
36
37要刷新自定义固件,您必须将键盘置于特殊的刷新模式。在此模式下,您将无法键入或使用键盘。在写入固件时,不要拔下键盘插头或以其他方式中断刷新过程,这一点非常重要。
38
39不同的键盘有不同的方式进入这种特殊模式。如果您的键盘当前运行的是QMK或TMK,而您没有得到特定的指示,请按顺序尝试以下操作:
40
41* 按住两个shift键并按 `Pause`
42* 按住两个shift键并按 `B`
43* 拔下键盘插头, 同时按住空格键和 `B` , 插上键盘然后等一会再放开按键
44* 按下PCB底部的 `RESET` 物理键
45* 找到PCB上标记有 `BOOT0` 或 `RESET`的金属点, 在插入PCB的同时短接它们
46
47成功后,您将在QMK工具箱中看到类似以下内容的消息:
48
49```
50*** Clueboard - Clueboard 66% HotSwap disconnected -- 0xC1ED:0x2390
51*** DFU device connected
52```
53
54### 刷新你的键盘
55
56单击QMK工具箱中的 `Flash` 按钮。您将看到类似以下内容的输出:
57
58```
59*** Clueboard - Clueboard 66% HotSwap disconnected -- 0xC1ED:0x2390
60*** DFU device connected
61*** Attempting to flash, please don't remove device
62>>> dfu-programmer atmega32u4 erase --force
63 Erasing flash... Success
64 Checking memory from 0x0 to 0x6FFF... Empty.
65>>> dfu-programmer atmega32u4 flash /Users/skully/qmk_firmware/clueboard_66_hotswap_gen1_skully.hex
66 Checking memory from 0x0 to 0x55FF... Empty.
67 0% 100% Programming 0x5600 bytes...
68 [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] Success
69 0% 100% Reading 0x7000 bytes...
70 [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] Success
71 Validating... Success
72 0x5600 bytes written into 0x7000 bytes memory (76.79%).
73>>> dfu-programmer atmega32u4 reset
74
75*** DFU device disconnected
76*** Clueboard - Clueboard 66% HotSwap connected -- 0xC1ED:0x2390
77```
78
79## 使用命令行刷新键盘
80
81首先,您需要知道您的键盘使用的是哪个bootloader。通常是以下四个常见的bootloader。Pro-Micro 和 clones 使用 CATERINA, Teensy 使用 Halfkay, OLKB 键盘使用 QMK-DFU, 其他的atmega32u4芯片使用DFU。
82
83您可以在以下文章中了解更多关于bootloader[刷新指令和Bootloader信息](flashing.md)。
84
85如果您知道正在使用的bootloader是哪种,那么在编译固件时,可以向“make”命令里添加一些额外参数,以自动执行刷新过程。
86
87### DFU
88
89对于DFU引导加载程序,当您准备好编译和刷新固件时,打开终端窗口并运行构建命令:
90
91 make <my_keyboard>:<my_keymap>:dfu
92
93例如,如果您的布局名为“xyverz”,并且您正在为rev5 planck构建一个布局,那么您可以使用此命令:
94
95 make planck/rev5:xyverz:dfu
96
97编译完成后,应输出以下内容:
98
99```
100Linking: .build/planck_rev5_xyverz.elf [OK]
101Creating load file for flashing: .build/planck_rev5_xyverz.hex [OK]
102Copying planck_rev5_xyverz.hex to qmk_firmware folder [OK]
103Checking file size of planck_rev5_xyverz.hex
104 * File size is fine - 18574/28672
105 ```
106
107到了这个时候, 构建脚本将每隔5秒查找一次DFU。它将重复以下操作,直到找到设备或将其取消。
108
109 dfu-programmer: no device present.
110 Error: Bootloader not found. Trying again in 5s.
111
112一旦出现以上回显,您将需要重置控制器。然后,它应该显示与以下类似的输出:
113
114```
115*** Attempting to flash, please don't remove device
116>>> dfu-programmer atmega32u4 erase --force
117 Erasing flash... Success
118 Checking memory from 0x0 to 0x6FFF... Empty.
119>>> dfu-programmer atmega32u4 flash /Users/skully/qmk_firmware/clueboard_66_hotswap_gen1_skully.hex
120 Checking memory from 0x0 to 0x55FF... Empty.
121 0% 100% Programming 0x5600 bytes...
122 [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] Success
123 0% 100% Reading 0x7000 bytes...
124 [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] Success
125 Validating... Success
126 0x5600 bytes written into 0x7000 bytes memory (76.79%).
127>>> dfu-programmer atmega32u4 reset
128```
129
130如果您对此有任何问题,您可能需要这样做:
131
132 sudo make <my_keyboard>:<my_keymap>:dfu
133
134#### DFU命令
135
136有许多DFU命令可用于将固件下载到DFU设备:
137
138* `:dfu` - 这是正常选项,等待DFU设备可用,然后刷新固件。这将每隔5秒检查一次,以查看是否出现了DFU设备。
139* `:dfu-ee` - 这将刷新一个`eep`文件,而不是普通的十六进制文件。这很不常见。
140* `:dfu-split-left` - 这将刷新正常固件,就像默认选项 (`:dfu`)一样. 但是,这也会刷新“左侧”EEPROM文件,用于分割键盘。 _这是基于Elite C的键盘的推荐选择。_
141* `:dfu-split-right` - 这将刷新正常固件,就像默认选项(`:dfu`). 但是,这也会刷新“右侧”EEPROM文件,用于分割键盘。 _这是基于Elite C的键盘的推荐选择。_
142
143
144### Caterina
145
146对于Arduino板以及其克隆版来说(比如SparkFun和ProMicro), 准备好编译和刷新固件后,打开终端窗口并运行构建命令:
147
148 make <my_keyboard>:<my_keymap>:avrdude
149
150比如, 你的布局叫"xyverz"你要创建一个rev2 Lets Split的布局,你要用以下命令:
151
152 make lets_split/rev2:xyverz:avrdude
153
154固件完成编译后,它将输出类似以下的内容:
155
156```
157Linking: .build/lets_split_rev2_xyverz.elf [OK]
158Creating load file for flashing: .build/lets_split_rev2_xyverz.hex [OK]
159Checking file size of lets_split_rev2_xyverz.hex [OK]
160 * File size is fine - 27938/28672
161Detecting USB port, reset your controller now..............
162```
163
164此时,复位,然后脚本将检测bootloader,然后刷新固件。输出应该像这样:
165
166```
167Detected controller on USB port at /dev/ttyS15
168
169Connecting to programmer: .
170Found programmer: Id = "CATERIN"; type = S
171 Software Version = 1.0; No Hardware Version given.
172Programmer supports auto addr increment.
173Programmer supports buffered memory access with buffersize=128 bytes.
174
175Programmer supports the following devices:
176 Device code: 0x44
177
178avrdude.exe: AVR device initialized and ready to accept instructions
179
180Reading | ################################################## | 100% 0.00s
181
182avrdude.exe: Device signature = 0x1e9587 (probably m32u4)
183avrdude.exe: NOTE: "flash" memory has been specified, an erase cycle will be performed
184 To disable this feature, specify the -D option.
185avrdude.exe: erasing chip
186avrdude.exe: reading input file "./.build/lets_split_rev2_xyverz.hex"
187avrdude.exe: input file ./.build/lets_split_rev2_xyverz.hex auto detected as Intel Hex
188avrdude.exe: writing flash (27938 bytes):
189
190Writing | ################################################## | 100% 2.40s
191
192avrdude.exe: 27938 bytes of flash written
193avrdude.exe: verifying flash memory against ./.build/lets_split_rev2_xyverz.hex:
194avrdude.exe: load data flash data from input file ./.build/lets_split_rev2_xyverz.hex:
195avrdude.exe: input file ./.build/lets_split_rev2_xyverz.hex auto detected as Intel Hex
196avrdude.exe: input file ./.build/lets_split_rev2_xyverz.hex contains 27938 bytes
197avrdude.exe: reading on-chip flash data:
198
199Reading | ################################################## | 100% 0.43s
200
201avrdude.exe: verifying ...
202avrdude.exe: 27938 bytes of flash verified
203
204avrdude.exe: safemode: Fuses OK (E:CB, H:D8, L:FF)
205
206avrdude.exe done. Thank you.
207```
208如果您对此有任何问题,您可能需要这样做:
209
210 sudo make <my_keyboard>:<my_keymap>:avrdude
211
212
213此外,如果要刷新多个板,请使用以下命令:
214
215 make <keyboard>:<keymap>:avrdude-loop
216
217当你完成了刷新后,你需要按下ctrl+c或者其他正确的按键来让你的操作系统终止循环。
218
219
220## HalfKay
221
222对于PJRC设备(Teensy),当您准备好编译和刷新固件时,打开终端窗口并运行构建命令:
223
224 make <my_keyboard>:<my_keymap>:teensy
225
226比如, 如果你的布局叫做"xyverz"你想创建Ergodox or Ergodox EZ的布局,你要使用以下命令:
227
228 make erdogox_ez:xyverz:teensy
229
230固件完成编译后,它将输出如下内容:
231
232```
233Linking: .build/ergodox_ez_xyverz.elf [OK]
234Creating load file for flashing: .build/ergodox_ez_xyverz.hex [OK]
235Checking file size of ergodox_ez_xyverz.hex [OK]
236 * File size is fine - 25584/32256
237 Teensy Loader, Command Line, Version 2.1
238Read "./.build/ergodox_ez_xyverz.hex": 25584 bytes, 79.3% usage
239Waiting for Teensy device...
240 (hint: press the reset button)
241 ```
242
243此时,复位键盘。完成后,您将看到如下输出:
244
245 ```
246 Found HalfKay Bootloader
247Read "./.build/ergodox_ez_xyverz.hex": 28532 bytes, 88.5% usage
248Programming............................................................................................................................................................................
249...................................................
250Booting
251```
252
253## STM32 (ARM)
254
255对于大多数ARM板(包括Proton C、Planck Rev 6和Preonic Rev 3),当您准备好编译和刷新固件时,打开终端窗口并运行构建命令:
256
257 make <my_keyboard>:<my_keymap>:dfu-util
258
259例如,如果您的keymap被命名为“xyverz”,并且您正在为Planck Revision 6键盘构建一个布局,那么您需要使用以下命令,然后将键盘重新启动到bootloader(在完成编译之前):
260
261 make planck/rev6:xyverz:dfu-util
262
263固件完成编译后,它将输出如下内容:
264
265```
266Linking: .build/planck_rev6_xyverz.elf [OK]
267Creating binary load file for flashing: .build/planck_rev6_xyverz.bin [OK]
268Creating load file for flashing: .build/planck_rev6_xyverz.hex [OK]
269
270Size after:
271 text data bss dec hex filename
272 0 41820 0 41820 a35c .build/planck_rev6_xyverz.hex
273
274Copying planck_rev6_xyverz.bin to qmk_firmware folder [OK]
275dfu-util 0.9
276
277Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
278Copyright 2010-2016 Tormod Volden and Stefan Schmidt
279This program is Free Software and has ABSOLUTELY NO WARRANTY
280Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
281
282Invalid DFU suffix signature
283A valid DFU suffix will be required in a future dfu-util release!!!
284Opening DFU capable USB device...
285ID 0483:df11
286Run-time device DFU version 011a
287Claiming USB DFU Interface...
288Setting Alternate Setting #0 ...
289Determining device status: state = dfuERROR, status = 10
290dfuERROR, clearing status
291Determining device status: state = dfuIDLE, status = 0
292dfuIDLE, continuing
293DFU mode device DFU version 011a
294Device returned transfer size 2048
295DfuSe interface name: "Internal Flash "
296Downloading to address = 0x08000000, size = 41824
297Download [=========================] 100% 41824 bytes
298Download done.
299File downloaded successfully
300Transitioning to dfuMANIFEST state
301```
302
303## 试一试吧!
304
305恭喜您! 您的自定义固件已经刷写到您的键盘
306
307试一试,确保一切按你想的方式进行。我们写了[测试和调试](newbs_testing_debugging.md)来完善新手引导。 因此,请前往那里了解如何排除自定义功能的故障。