ErgoDash_bleをビルドする

作ったErgoDashを無線化するためにErgoDash_bleをビルドする記録を残していく。

uvb-76.hatenablog.com

12//05 追記: ご指摘を頂いて2回目以降のBLE-Micro-Proへの書き込みができるようになりました!

どうやって

BLEが乗ったPro Micro、BLE-Miicro-Proを買ったのでこれを使う。ありがたいことに、ある程度のキーボードはすでにBLE対応されたブランチが用意されているので、それをビルドする。

github.com

未完だけどわかったこと

  • Ubuntu18.04でやると修羅の道っぽい
  • nRF_SDKpythonもバージョン指定には従うこと
  • 結構詰みポイントがある

ここからUbntu18.04で作業

READMEを読みながら

make ergodash_ble/master:nrfutil
QMK Firmware 0.6.96
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 ergodash_ble/master with keymap default and target nrfutil

"PLATFORM NRF5"
arm-none-eabi-gcc (15:6.3.1+svn253039-1build1) 6.3.1 20170620
Copyright (C) 2016 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/ergodash_ble/ergodash_ble.c                                                   In file included from quantum/quantum.h:24:0,
                 from keyboards/ergodash_ble/ergodash_ble.h:4,
                 from keyboards/ergodash_ble/ergodash_ble.c:1:
tmk_core/common/wait.h:19:26: fatal error: nrf_delay.h: No such file or directory
 #   include "nrf_delay.h"
                          ^
compilation terminated.
 [ERRORS]
 | 
 | 
 | 
tmk_core/rules.mk:359: recipe for target '.build/obj_ergodash_ble_master_default/keyboards/ergodash_ble/ergodash_ble.o' failed
make[1]: *** [.build/obj_ergodash_ble_master_default/keyboards/ergodash_ble/ergodash_ble.o] Error 1
Makefile:529: recipe for target 'ergodash_ble/master:nrfutil' failed
make: *** [ergodash_ble/master:nrfutil] Error 1
Make finished with errors

delayがないっていわれる keyboards/ergodash_ble/master/rules.mk 見たらnRF_SDKのパスがべた書きされていて環境変数をみていなかったので環境変数を見るように直した。 (これはコントリビュートチャンスだ)

環境変数を通したら別のエラーが

make ergodash_ble/master:nrfutil
QMK Firmware 0.6.96
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 ergodash_ble/master with keymap default and target nrfutil

"PLATFORM NRF5"
arm-none-eabi-gcc (15:6.3.1+svn253039-1build1) 6.3.1 20170620
Copyright (C) 2016 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/ergodash_ble/ergodash_ble.c                                                   In file included from quantum/quantum.h:54:0,
                 from keyboards/ergodash_ble/ergodash_ble.h:4,
                 from keyboards/ergodash_ble/ergodash_ble.c:1:
tmk_core/common/print.h:105:23: fatal error: nrf_log.h: No such file or directory
 #  include "nrf_log.h"
                       ^
compilation terminated.
 [ERRORS]
 | 
 | 
 | 
tmk_core/rules.mk:359: recipe for target '.build/obj_ergodash_ble_master_default/keyboards/ergodash_ble/ergodash_ble.o' failed
make[1]: *** [.build/obj_ergodash_ble_master_default/keyboards/ergodash_ble/ergodash_ble.o] Error 1
Makefile:529: recipe for target 'ergodash_ble/master:nrfutil' failed
make: *** [ergodash_ble/master:nrfutil] Error 1
Make finished with errors

なんでやん。 ここでディレクトリ構造やREADMEなどを確認して、要求されているnRF5_SDK v15.0.0ではなくて、v15.2.0を使用している事に気がついた。 改めて、v15.0.0を持ってきてビルドする。

make ergodash_ble/master:nrfutil
QMK Firmware 0.6.96
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 ergodash_ble/master with keymap default and target nrfutil

"PLATFORM NRF5"
arm-none-eabi-gcc (15:6.3.1+svn253039-1build1) 6.3.1 20170620
Copyright (C) 2016 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/ergodash_ble/ergodash_ble.c                                                    [OK]
Compiling: keyboards/ergodash_ble/master/master.c                                                   [OK]
Compiling: keyboards/ergodash_ble/keymaps/default/keymap.c                                          [OK]
Compiling: quantum/quantum.c                                                                        [OK]
Compiling: quantum/keymap_common.c                                                                  [OK]
Compiling: quantum/keycode_config.c                                                                 [OK]
Compiling: quantum/process_keycode/process_leader.c                                                 [OK]
Compiling: quantum/rgblight.c                                                                       [OK]
Compiling: drivers/nrf52/ws2812.c                                                                   [OK]
Compiling: quantum/led_tables.c                                                                     [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/nrf/suspend.c                                                            [OK]
Compiling: tmk_core/common/nrf/timer.c                                                              [OK]
Compiling: tmk_core/common/nrf/bootloader.c                                                         [OK]
Compiling: tmk_core/common/nrf/printf.c                                                             [OK]
Compiling: tmk_core/common/nrf/eeprom.c                                                             [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/nrf/matrix.c                                                           [OK]
Compiling: tmk_core/protocol/nrf/nrf52/adc.c                                                        [OK]
Compiling: tmk_core/protocol/nrf/sdk15/ble_common.c                                                 [OK]
Compiling: tmk_core/protocol/nrf/sdk15/usbd.c                                                       [OK]
Compiling: tmk_core/protocol/nrf/sdk15/app_usbd_hid_kbd.c                                           [OK]
Compiling: tmk_core/protocol/nrf/sdk15/app_usbd_hid_mouse.c                                         [OK]
Compiling: tmk_core/protocol/nrf/sdk15/i2c_master.c                                                 [OK]
Compiling: tmk_core/protocol/nrf/sdk15/cli.c                                                        [OK]
Compiling: tmk_core/protocol/nrf/microshell/core/microshell.c                                       [OK]
Compiling: tmk_core/protocol/nrf/microshell/core/mscore.c                                           [OK]
Compiling: tmk_core/protocol/nrf/microshell/util/mscmd.c                                            [OK]
Compiling: tmk_core/protocol/nrf/microshell/util/msopt.c                                            [OK]
Compiling: tmk_core/protocol/nrf/microshell/util/ntlibc.c                                           [OK]
Compiling: tmk_core/protocol/nrf/sdk15/ble_master.c                                                 [OK]
Compiling: tmk_core/protocol/nrf/main_master.c                                                      [OK]
Compiling: tmk_core/protocol/nrf/sdk15/ble_central.c                                                [OK]
Assembling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/modules/nrfx/mdk/gcc_startup_nrf52840.S       [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/usbd/app_usbd_core.c      [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/peer_manager/security_dispatcher.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/softdevice/common/nrf_sdh_ble.c     [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/common/ble_conn_params.c        [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/nrf_ble_gatt/nrf_ble_gatt.c     [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/ble_db_discovery/ble_db_discovery.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/ble_services/ble_nus_c/ble_nus_c.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/experimental_log/src/nrf_log_backend_rtt.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/experimental_log/src/nrf_log_backend_serial.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/experimental_log/src/nrf_log_backend_uart.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/experimental_log/src/nrf_log_default_backends.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/experimental_log/src/nrf_log_frontend.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/experimental_log/src/nrf_log_str_formatter.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/button/app_button.c       [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/util/app_error.c          [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/util/app_error_handler_gcc.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/util/app_error_weak.c     [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/scheduler/app_scheduler.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/timer/app_timer.c         [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/util/app_util_platform.c  [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/crc16/crc16.c             [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/fds/fds.c                 [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/hardfault/hardfault_implementation.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/util/nrf_assert.c         [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/atomic_fifo/nrf_atfifo.c  [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/atomic_flags/nrf_atflags.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/atomic/nrf_atomic.c       [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/balloc/nrf_balloc.c       [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/external/fprintf/nrf_fprintf.c                 [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/external/fprintf/nrf_fprintf_format.c          [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/fstorage/nrf_fstorage.c   [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/fstorage/nrf_fstorage_sd.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/experimental_memobj/nrf_memobj.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/pwr_mgmt/nrf_pwr_mgmt.c   [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/experimental_section_vars/nrf_section_iter.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/strerror/nrf_strerror.c   [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/integration/nrfx/legacy/nrf_drv_clock.c        [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/integration/nrfx/legacy/nrf_drv_uart.c         [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/integration/nrfx/legacy/nrf_drv_power.c        [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/integration/nrfx/legacy/nrf_drv_twi.c          [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/modules/nrfx/drivers/src/nrfx_gpiote.c         [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/modules/nrfx/drivers/src/nrfx_clock.c          [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/modules/nrfx/drivers/src/nrfx_power.c          [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/modules/nrfx/drivers/src/nrfx_power_clock.c    [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/modules/nrfx/drivers/src/prs/nrfx_prs.c        [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/modules/nrfx/drivers/src/nrfx_uart.c           [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/modules/nrfx/drivers/src/nrfx_uarte.c          [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/modules/nrfx/drivers/src/nrfx_saadc.c          [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/modules/nrfx/drivers/src/nrfx_twi.c            [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/modules/nrfx/drivers/src/nrfx_twim.c           [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/modules/nrfx/drivers/src/nrfx_twis.c           [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/modules/nrfx/drivers/src/nrfx_pwm.c            [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/modules/nrfx/mdk/system_nrf52840.c             [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/external/segger_rtt/SEGGER_RTT.c               [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/external/segger_rtt/SEGGER_RTT_Syscalls_GCC.c  [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/external/segger_rtt/SEGGER_RTT_printf.c        [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/common/ble_advdata.c            [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/ble_advertising/ble_advertising.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/common/ble_conn_state.c         [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/ble_link_ctx_manager/ble_link_ctx_manager.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/common/ble_srv_common.c         [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/peer_manager/gatt_cache_manager.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/peer_manager/gatts_cache_manager.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/peer_manager/id_manager.c       [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/nrf_ble_qwr/nrf_ble_qwr.c       [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/peer_manager/peer_data_storage.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/peer_manager/peer_database.c    [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/peer_manager/peer_id.c          [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/peer_manager/peer_manager.c     [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/peer_manager/pm_buffer.c        [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/peer_manager/pm_mutex.c         [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/peer_manager/security_manager.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/ble_services/ble_bas/ble_bas.c  [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/ble_services/ble_dis/ble_dis.c  [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/ble/ble_services/ble_hids/ble_hids.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/softdevice/common/nrf_sdh.c         [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/softdevice/common/nrf_sdh_soc.c     [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/queue/nrf_queue.c         [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/usbd/class/hid/app_usbd_hid.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/usbd/class/hid/generic/app_usbd_hid_generic.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/usbd/class/cdc/acm/app_usbd_cdc_acm.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/usbd/app_usbd.c           [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/usbd/app_usbd_string_desc.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/libraries/usbd/class/dummy/app_usbd_dummy.c [OK]
Compiling: /home/ikaruga/dev/nRF5_SDK_15.0.0_a53641a/components/drivers_nrf/usbd/nrf_drv_usbd.c     [OK]
Linking: ergodash_ble_master_default.elf                                                            [ERRORS]
 | 
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o: Conflicting CPU architectures 13/1
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-atexit.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-atexit.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-ctype_.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-ctype_.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-exit.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-exit.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-fini.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-fini.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-impure.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-impure.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-init.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-init.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-memcmp.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-memcmp.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-memcpy-stub.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-memcpy-stub.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-memset.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-memset.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-rand.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-rand.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-sprintf.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-sprintf.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-strcpy.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-strcpy.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-strlen-stub.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-strlen-stub.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-__atexit.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-__atexit.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-__call_atexit.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-__call_atexit.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-malloc.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-malloc.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-nano-freer.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-nano-freer.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-nano-mallocr.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-nano-mallocr.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-nano-svfprintf.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-nano-svfprintf.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-nano-vfprintf_i.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-nano-vfprintf_i.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-sbrkr.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-sbrkr.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-memchr-stub.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-memchr-stub.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-memmove.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-memmove.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-nano-reallocr.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-nano-reallocr.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-reent.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-reent.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-nano-msizer.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-nano-msizer.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libnosys.a(sbrk.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libnosys.a(sbrk.o)
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: ergodash_ble_master_default.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libnosys.a(_exit.o) does not
 | /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libnosys.a(_exit.o)
 | collect2: error: ld returned 1 exit status
 | 
tmk_core/rules.mk:286: recipe for target 'ergodash_ble_master_default.elf' failed
make[1]: *** [ergodash_ble_master_default.elf] Error 1
Makefile:529: recipe for target 'ergodash_ble/master:nrfutil' failed
make: *** [ergodash_ble/master:nrfutil] Error 1
Make finished with errors

リンクエラーが湧いてきた。

[https://stackoverflow.com/questions/50151897/arm-gcc-conflicting-cpu-architectures:embed:cite]

そして、ここのとおりにaptの操作をしていると、

.../binutils-arm-none-eabi_2.27-9ubuntu1+9_amd64.deb を展開する準備をしています ...
binutils-arm-none-eabi (2.27-9ubuntu1+9) を展開しています...
dpkg: アーカイブ /var/cache/apt/archives/binutils-arm-none-eabi_2.27-9ubuntu1+9_amd64.deb の処理中にエラーが発生しました (--unpack):
 '/usr/bin/arm-none-eabi-addr2line' を上書きしようとしています。これはパッケージ gcc-arm-embedded 7-2018q2-1~bionic1 にも存在します
dpkg-deb: エラー: ペースト subprocess was killed by signal (Broken pipe)
処理中にエラーが発生しました:
 /var/cache/apt/archives/binutils-arm-none-eabi_2.27-9ubuntu1+9_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

依存関係を解消できず、完全に詰んでしまった。

ここからMacで作業

依存関係の解消に時間を使いたくない(というかわからない)のでMacにパッケージを入れ直し。

brew tap osx-cross/avr
brew tap PX4/homebrew-px4
brew update
brew install avr-gcc@7
brew link --force avr-gcc@7
brew install dfu-programmer
brew install dfu-util
brew install gcc-arm-none-eabi
brew install avrdude

3時間くらいかけてインストールを行った後に make ergodash_ble/master:nrfutilを実行するとあっさりと書き込みができましたとさ。

で、これで終わりじゃなくて。焼けたことが確認できたので、キーマップを変えてもう一度焼こうとしたら

$ make ergodash_ble/master:nrfutil
QMK Firmware 0.6.96
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 ergodash_ble/master with keymap default and target nrfutil

"PLATFORM NRF5"
arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204]
Copyright (C) 2017 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: tmk_core/common/command.c                                                                [OK]
Linking: ergodash_ble_master_default.elf                                                            [OK]
Creating binary load file for flashing: ergodash_ble_master_default.bin                             [OK]

|===============================================================|
|##      ##    ###    ########  ##    ## #### ##    ##  ######  |
|##  ##  ##   ## ##   ##     ## ###   ##  ##  ###   ## ##    ## |
|##  ##  ##  ##   ##  ##     ## ####  ##  ##  ####  ## ##       |
|##  ##  ## ##     ## ########  ## ## ##  ##  ## ## ## ##   ####|
|##  ##  ## ######### ##   ##   ##  ####  ##  ##  #### ##    ## |
|##  ##  ## ##     ## ##    ##  ##   ###  ##  ##   ### ##    ## |
| ###  ###  ##     ## ##     ## ##    ## #### ##    ##  ######  |
|===============================================================|
|You are generating a package with the debug bit enabled in the |
|init packet. This is only compatible with a debug bootloader   |
|and is not suitable for production.                            |
|===============================================================|


|===============================================================|
|##      ##    ###    ########  ##    ## #### ##    ##  ######  |
|##  ##  ##   ## ##   ##     ## ###   ##  ##  ###   ## ##    ## |
|##  ##  ##  ##   ##  ##     ## ####  ##  ##  ####  ## ##       |
|##  ##  ## ##     ## ########  ## ## ##  ##  ## ## ## ##   ####|
|##  ##  ## ######### ##   ##   ##  ####  ##  ##  #### ##    ## |
|##  ##  ## ##     ## ##    ##  ##   ###  ##  ##   ### ##    ## |
| ###  ###  ##     ## ##     ## ##    ## #### ##    ##  ######  |
|===============================================================|
|You are not providing a signature key, which means the DFU     |
|files will not be signed, and are vulnerable to tampering.     |
|This is only compatible with a signature-less bootloader and is|
|not suitable for production environments.                      |
|===============================================================|

Zip created at ergodash_ble_master_default.zip
Detecting USB port, put your controller into dfu-mode now..........
Detected controller on USB port at /dev/tty.usbmodem43
Programming Started

Traceback (most recent call last):
  File "/Users/ikaruga/.pyenv/versions/2.7.15/bin/nrfutil", line 11, in <module>
    load_entry_point('nrfutil==4.0.0', 'console_scripts', 'nrfutil')()
  File "/Users/ikaruga/.pyenv/versions/2.7.15/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Users/ikaruga/.pyenv/versions/2.7.15/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/Users/ikaruga/.pyenv/versions/2.7.15/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/ikaruga/.pyenv/versions/2.7.15/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/ikaruga/.pyenv/versions/2.7.15/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/ikaruga/.pyenv/versions/2.7.15/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/Users/ikaruga/.pyenv/versions/2.7.15/lib/python2.7/site-packages/nordicsemi/__main__.py", line 827, in usb_serial
    do_serial(package, port, connect_delay, flow_control, packet_receipt_notification, baud_rate, False)
  File "/Users/ikaruga/.pyenv/versions/2.7.15/lib/python2.7/site-packages/nordicsemi/__main__.py", line 793, in do_serial
    dfu.dfu_send_images()
  File "/Users/ikaruga/.pyenv/versions/2.7.15/lib/python2.7/site-packages/nordicsemi/dfu/dfu.py", line 129, in dfu_send_images
    self._dfu_send_image(self.manifest.application)
  File "/Users/ikaruga/.pyenv/versions/2.7.15/lib/python2.7/site-packages/nordicsemi/dfu/dfu.py", line 90, in _dfu_send_image
    self.dfu_transport.open()
  File "/Users/ikaruga/.pyenv/versions/2.7.15/lib/python2.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 214, in open
    self.__get_mtu()
  File "/Users/ikaruga/.pyenv/versions/2.7.15/lib/python2.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 315, in __get_mtu
    self.mtu = struct.unpack('<H', bytearray(response))[0]
TypeError: 'NoneType' object is not iterable
make[1]: *** [nrfutil] Error 1
make: *** [ergodash_ble/master:nrfutil] Error 1
Make finished with errors

nrfutilがエラーを吐いてくる…エラーの中身はPythonだとありがちなエラーっぽいんだけどもさっぱりわからない。 nrfutil version 4.0.0

さてどうしたものか。

--------追記----------

以下のようなご指摘をいただきました!

ブートローダ、READMEに書いてたなと読み返すと、「キーボードのリセットボタンを押しながら電源投入」という指示がありましたね…USB接続してからリセットボタン押してました… 無事、二度目以降の書き込みもできるようになりました。幸運にもmaster,slave間の通信はうまく行っていたので、接続面に関しては問題なさそう!

--------追記ここまで----------

進捗

f:id:uvb_76:20181204014800p:plain
進捗
- ファームは焼けて、masterのペアリングはできるようになった。 - master, slave間の通信ができるようになり、USBからの電源供給でBluetoothを使用した入力が可能になった

  • 電源の確保
  • 電源ユニットを外出しにする勇気をもつ がまだ。