meishi2のキーマップをQMK Firmwareを使って書き換えるメモ
環境
- MacBook Pro (13-inch, M1, 2020)
QMK Firmwareをインストール(brew経由でいけたっぽいからそっち使えばよかった)
git clone https://github.com/qmk/qmk_firmware.git #下記コマンドでbrewのupgradeが入りました(長かった) ./util/qmk_install.sh
キーマップを書き換えるために設定をコピー
qmk new-keymap #keymapの名前を入力するように言われます今回はcustom_keymapにしました
キーマップを編集
keyboards/biacco42/meishi2/keymaps/custom_keymap/keymap.c
ファイルを編集します
今回はデフォルトのやつ(コピペとか)からただの文字を出力するように変えてみます
/* Copyright 2019 Biacco42 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT( /* Base */ KC_Z, KC_X, KC_C, KC_V ) };
コンパイル
下記コマンドを打ってコンパイル
qmk compile -kb biacco42/meishi2 -km custom_keymap
エラーが出た
Ψ Compiling keymap with gmake --jobs=1 biacco42/meishi2:custom_keymap QMK Firmware 0.17.9 WARNING: Some git submodules are out of date or modified. Please consider running make git-submodule. Making biacco42/meishi2 with keymap custom_keymap tmk_core/protocol/lufa.mk:13: lib/lufa/LUFA/makefile: No such file or directory gmake[1]: *** No rule to make target 'lib/lufa/LUFA/makefile'. Stop. gmake: *** [Makefile:413: biacco42/meishi2:custom_keymap] Error 1 Make finished with errors
指示通りに下記コマンドを打つ
make git-submodule
実行結果
❯❯❯make git-submodule [master] QMK Firmware 0.17.9 Submodule 'lib/chibios' (https://github.com/qmk/ChibiOS) registered for path 'lib/chibios' Submodule 'lib/chibios-contrib' (https://github.com/qmk/ChibiOS-Contrib) registered for path 'lib/chibios-contrib' Submodule 'lib/googletest' (https://github.com/qmk/googletest) registered for path 'lib/googletest' Submodule 'lib/lufa' (https://github.com/qmk/lufa) registered for path 'lib/lufa' Submodule 'lib/printf' (https://github.com/qmk/printf) registered for path 'lib/printf' Submodule 'lib/vusb' (https://github.com/qmk/v-usb) registered for path 'lib/vusb' Cloning into '/Users/kenchaso/workspace/qmk_firmware/lib/chibios'... remote: Enumerating objects: 241811, done. remote: Counting objects: 100% (555/555), done. remote: Compressing objects: 100% (259/259), done. remote: Total 241811 (delta 374), reused 394 (delta 294), pack-reused 241256 Receiving objects: 100% (241811/241811), 157.10 MiB | 24.06 MiB/s, done. Resolving deltas: 100% (184417/184417), done. Cloning into '/Users/kenchaso/workspace/qmk_firmware/lib/chibios-contrib'... remote: Enumerating objects: 22528, done. remote: Counting objects: 100% (2835/2835), done. remote: Compressing objects: 100% (787/787), done. remote: Total 22528 (delta 2205), reused 2455 (delta 2007), pack-reused 19693 Receiving objects: 100% (22528/22528), 9.11 MiB | 19.03 MiB/s, done. Resolving deltas: 100% (14528/14528), done. Cloning into '/Users/kenchaso/workspace/qmk_firmware/lib/googletest'... remote: Enumerating objects: 22998, done. remote: Total 22998 (delta 0), reused 0 (delta 0), pack-reused 22998 Receiving objects: 100% (22998/22998), 9.01 MiB | 18.95 MiB/s, done. Resolving deltas: 100% (16989/16989), done. Cloning into '/Users/kenchaso/workspace/qmk_firmware/lib/lufa'... remote: Enumerating objects: 76739, done. remote: Counting objects: 100% (3089/3089), done. remote: Compressing objects: 100% (73/73), done. remote: Total 76739 (delta 3041), reused 3020 (delta 3016), pack-reused 73650 Receiving objects: 100% (76739/76739), 18.93 MiB | 14.62 MiB/s, done. Resolving deltas: 100% (61662/61662), done. Cloning into '/Users/kenchaso/workspace/qmk_firmware/lib/printf'... remote: Enumerating objects: 1578, done. remote: Counting objects: 100% (627/627), done. remote: Compressing objects: 100% (94/94), done. remote: Total 1578 (delta 566), reused 552 (delta 528), pack-reused 951 Receiving objects: 100% (1578/1578), 794.81 KiB | 6.16 MiB/s, done. Resolving deltas: 100% (977/977), done. Cloning into '/Users/kenchaso/workspace/qmk_firmware/lib/vusb'... remote: Enumerating objects: 1372, done. remote: Counting objects: 100% (73/73), done. remote: Compressing objects: 100% (50/50), done. remote: Total 1372 (delta 32), reused 46 (delta 18), pack-reused 1299 Receiving objects: 100% (1372/1372), 476.46 KiB | 15.37 MiB/s, done. Resolving deltas: 100% (832/832), done. Submodule path 'lib/chibios': checked out '257302333c31f1f710800c2b97acf3550de043e1' Submodule path 'lib/chibios-contrib': checked out '2a6b73ff51baf89083a220b6692a04ca2cae8750' Submodule 'ext/mcux-sdk' (https://github.com/NXPmicro/mcux-sdk) registered for path 'lib/chibios-contrib/ext/mcux-sdk' Cloning into '/Users/kenchaso/workspace/qmk_firmware/lib/chibios-contrib/ext/mcux-sdk'... remote: Enumerating objects: 38269, done. remote: Counting objects: 100% (3140/3140), done. remote: Compressing objects: 100% (1337/1337), done. remote: Total 38269 (delta 1836), reused 3046 (delta 1796), pack-reused 35129 Receiving objects: 100% (38269/38269), 73.83 MiB | 18.72 MiB/s, done. Resolving deltas: 100% (26262/26262), done. Submodule path 'lib/chibios-contrib/ext/mcux-sdk': checked out '102c27d7cc2aaac87c133702e7829a105e0cb433' Submodule path 'lib/googletest': checked out 'e2239ee6043f73722e7aa812a459f54a28552929' Submodule path 'lib/lufa': checked out '19a5d533f02a7b46eeadca99cc9699659cef7a60' Submodule path 'lib/printf': checked out 'd3b984684bb8a8bdc48cc7a1abecb93ce59bbe3e' Submodule path 'lib/vusb': checked out 'bdb53e4c043d089279d9891b68bea77614cb97ee'
その後再度コンパイルコマンドを打つ
qmk compile -kb biacco42/meishi2 -km custom_keymap
書き込み
avrdude
が大事らしい
make biacco42/meishi2:custom_keymap:avrdude
途中でreset押してって言われるのでmeishi2のリセットボタンを押す
Waiting for USB serial port - reset your controller now (Ctrl+C to cancel)..........
実行結果
❯❯❯make biacco42/meishi2:custom_keymap:avrdude QMK Firmware 0.17.9 Making biacco42/meishi2 with keymap custom_keymap and target avrdude avr-gcc (Homebrew AVR GCC 8.5.0) 8.5.0 Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Size before: text data bss dec hex filename 0 20726 0 20726 50f6 biacco42_meishi2_custom_keymap.hex Compiling: quantum/command.c [OK] Linking: .build/biacco42_meishi2_custom_keymap.elf [OK] Creating load file for flashing: .build/biacco42_meishi2_custom_keymap.hex [OK] Copying biacco42_meishi2_custom_keymap.hex to qmk_firmware folder [OK] Checking file size of biacco42_meishi2_custom_keymap.hex [OK] * The firmware size is fine - 20726/28672 (72%, 7946 bytes free) Waiting for USB serial port - reset your controller now (Ctrl+C to cancel)........................................................................................ Device /dev/tty.usbmodem11201 has appeared; assuming it is the controller. Waiting for /dev/tty.usbmodem11201 to become writable. Connecting to programmer: . Found programmer: Id = "CATERIN"; type = S Software Version = 1.0; No Hardware Version given. Programmer supports auto addr increment. Programmer supports buffered memory access with buffersize=128 bytes. Programmer supports the following devices: Device code: 0x44 avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.00s avrdude: Device signature = 0x1e9587 (probably m32u4) avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed To disable this feature, specify the -D option. avrdude: erasing chip avrdude: reading input file ".build/biacco42_meishi2_custom_keymap.hex" avrdude: input file .build/biacco42_meishi2_custom_keymap.hex auto detected as Intel Hex avrdude: writing flash (20726 bytes): Writing | ################################################## | 100% 1.53s avrdude: 20726 bytes of flash written avrdude: verifying flash memory against .build/biacco42_meishi2_custom_keymap.hex: avrdude: input file .build/biacco42_meishi2_custom_keymap.hex auto detected as Intel Hex Reading | ################################################## | 100% 0.15s avrdude: 20726 bytes of flash verified avrdude done. Thank you.
avrdude
- :avrdude: Checks every 5 seconds until a Caterina device is available (by detecting a new COM port), and then flashes the firmware.