FOOBARキーボードを作る 【QMKでファームビルド編】2018/12/29

気が付いたら基板が到着して3ヶ月もたってた。
初めて作ったキーボードの左上スイッチがぐらぐらしてきたので、そろそろFOOBARを完成させねばと思い、重い腰を上げる…

さてここからが本番。

MSYSをインストールしてQMKビルド環境を立ち上げるのは[ここ](http://bit.ly/2QNrrfe)を参照しました。

```
E430 MSYS ~
$ git clone http://github.com/qmk/qmk_firmware.git
Cloning into 'qmk_firmware'...
fatal: unable to access 'http://github.com/qmk/qmk_firmware.git/': SSL certificate problem: self signed certificate in certificate chain
```
gitでうまくいかなかったのですが、ググったら[こうしたらよい](http://bit.ly/2OoArL5
)みたいだったので実行。

```
E430 MSYS ~
$ git config --global http.sslVerify false

E430 MSYS ~
$ git clone http://github.com/qmk/qmk_firmware.git
Cloning into 'qmk_firmware'...
warning: redirecting to https://github.com/qmk/qmk_firmware.git/
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 80510 (delta 1), reused 1 (delta 1), pack-reused 80507
Receiving objects: 100% (80510/80510), 102.55 MiB | 424.00 KiB/s, done.
Resolving deltas: 100% (47398/47398), done.
Checking out files: 100% (8677/8677), done.
```
うまくいってるぽい。

とりあえずデフォルトでうまくmakeできるのを確認して、自分のキーマップをmakeした。
makeするDIRは~/qmk_firmwareでいいみたい。

```
E430 MSYS ~/qmk_firmware
$ make 40percentclub/foobar:mykeymap
QMK Firmware 0.6.210
WARNING:
 Some git sub-modules are out of date or modified, please consider running:
 make git-submodule
 You can ignore this warning if you are not compiling any ChibiOS keyboards,
 or if you have modified the ChibiOS libraries yourself.

Making 40percentclub/foobar with keymap mykeymap

avr-gcc.exe (AVR_8_bit_GNU_Toolchain_3.5.4_1709) 4.9.2
Copyright (C) 2014 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.

Compiling: keyboards/40percentclub/foobar/foobar.c                                                 [OK]
Compiling: keyboards/40percentclub/foobar/keymaps/mykeymap/keymap.c                                [OK]
Compiling: quantum/quantum.c                                                                       [OK]
Compiling: quantum/keymap_common.c                                                                 [OK]
Compiling: quantum/keycode_config.c                                                                [OK]
Compiling: quantum/split_common/matrix.c                                                           [OK]
Compiling: quantum/split_common/split_flags.c                                                      [OK]
Compiling: quantum/split_common/split_util.c                                                       [OK]
Compiling: quantum/split_common/i2c.c                                                              [OK]
Archiving: .build/obj_40percentclub_foobar_mykeymap/quantum/split_common/i2c.o                     [OK]
Compiling: quantum/split_common/serial.c                                                           [OK]
Archiving: .build/obj_40percentclub_foobar_mykeymap/quantum/split_common/serial.o                   [OK]
Compiling: tmk_core/common/host.c                                                                  [OK]
Compiling: tmk_core/common/keyboard.c                                                              [OK]
Compiling: tmk_core/common/action.c                                                                [OK]
Compiling: tmk_core/common/action_tapping.c                                                        [OK]
Compiling: tmk_core/common/action_macro.c                                                          [OK]
Compiling: tmk_core/common/action_layer.c                                                          [OK]
Compiling: tmk_core/common/action_util.c                                                           [OK]
Compiling: tmk_core/common/print.c                                                                 [OK]
Compiling: tmk_core/common/debug.c                                                                 [OK]
Compiling: tmk_core/common/util.c                                                                  [OK]
Compiling: tmk_core/common/eeconfig.c                                                              [OK]
Compiling: tmk_core/common/report.c                                                                [OK]
Compiling: tmk_core/common/avr/suspend.c                                                           [OK]
Compiling: tmk_core/common/avr/timer.c                                                             [OK]
Compiling: tmk_core/common/avr/bootloader.c                                                        [OK]
Assembling: tmk_core/common/avr/xprintf.S                                                          [OK]
Compiling: tmk_core/common/magic.c                                                                 [OK]
Compiling: tmk_core/common/mousekey.c                                                              [OK]
Compiling: tmk_core/common/command.c                                                               [OK]
Compiling: tmk_core/protocol/lufa/lufa.c                                                           [OK]
Compiling: tmk_core/protocol/usb_descriptor.c                                                      [OK]
Compiling: tmk_core/protocol/lufa/outputselect.c                                                   [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Class/Common/HIDParser.c                                      [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c                                       [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c                               [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c                                     [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c                                         [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c                                   [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c                                         [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c                                [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c                                 [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/ConfigDescriptors.c                                      [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/DeviceStandardReq.c                                      [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/Events.c                                                 [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/HostStandardReq.c                                        [OK]
Compiling: lib/lufa/LUFA/Drivers/USB/Core/USBTask.c                                                [OK]
Linking: .build/40percentclub_foobar_mykeymap.elf                                                  [OK]
Creating load file for flashing: .build/40percentclub_foobar_mykeymap.hex                          [OK]
Copying 40percentclub_foobar_mykeymap.hex to qmk_firmware folder                                   [OK]
Checking file size of 40percentclub_foobar_mykeymap.hex                                            [OK]
 * The firmware size is fine - 18152/28672 (10520 bytes free)
```

コンパイルできたかはhexファイルがあるかで確認できる。

```
E430 MSYS ~/qmk_firmware
$ ls *.hex
40percentclub_foobar_mykeymap.hex
```
後は基板を作って焼きこみ。

ちなみにキーマップはこんな感じ。
![FOOBAR_keyboard-layout_20181229.png](https://qiita-image-store.s3.amazonaws.com/0/283328/f52f3113-b28b-fc55-ede5-1db950b3374f.png)