Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

nRF5 SDK 12.3.0: GPIOTE Driver throws arr out of bound

Hey everyone,

I recently received an old Caravelle-build keyboard from a friend and I'm attempting to remap and flash it with QMK. Instructions on how to flash it are in Japanese, but I'll include a summary of the instructions / commands utilized for clarity. Now, the issue is that when I try to build, I encounter an error that appears to be related to the SDK utilized(I might be completely wrong)? I'm not well-versed in C or embedded systems in general, so any assistance would be greatly appreciated.

Btw, I'm on Linux and using nRF5_SDK_12.3.0_d7731ad

# build FW - summary of commands..
git clone  -b nrf52 https://github.com/sekigon-gonnoc/qmk_firmware.git ble_micro_pro
make git-submodule
export NRFSDK12_ROOT=<path to sdk>
pip install nrfutil
make caravelle_ble/master:default:dfu_ble
make caravelle_ble/slave:default:dfu_ble


# ERROR while compiling...

$ make caravelle_ble/master:default:dfu_ble

Making caravelle_ble/master with keymap default and target dfu_ble

make[1]: Entering directory '/home/slot/qmk_firmware'
"PLATFORM NRF5"
arm-none-eabi-gcc (15:12.2.rel1-1) 12.2.1 20221205
Copyright (C) 2022 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/caravelle_ble/master/master.c                                                  [OK]
Compiling: keyboards/caravelle_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: 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/common/nrf/sleep_led.c                                                          [OK]
Compiling: tmk_core/protocol/nrf/matrix.c                                                           [OK]
Compiling: tmk_core/protocol/nrf/io_expander.c                                                      [OK]
Compiling: tmk_core/protocol/nrf/sdk12/ble_common.c                                                 [OK]
Compiling: tmk_core/protocol/nrf/sdk12/i2c_master.c                                                 [OK]
Compiling: tmk_core/protocol/nrf/sdk12/i2c_slave.c                                                  [OK]
Compiling: tmk_core/protocol/nrf/sdk12/spi_master.c                                                 [OK]
Compiling: tmk_core/protocol/nrf/nrf52/adc.c                                                        [OK]
Compiling: tmk_core/protocol/nrf/sdk12/ble_master.c                                                 [OK]
Compiling: tmk_core/protocol/nrf/main_master.c                                                      [OK]
Compiling: tmk_core/protocol/nrf/sdk12/ble_central.c                                                [OK]
Assembling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/toolchain/gcc/gcc_startup_nrf52.S [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/toolchain/system_nrf52.c         [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/drivers_nrf/saadc/nrf_drv_saadc.c [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/drivers_nrf/hal/nrf_saadc.c      [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/ble/nrf_ble_gatt/nrf_ble_gatt.c  [OK]
Compiling: tmk_core/protocol/nrf/sdk12/ble_advertising.c                                            [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/libraries/log/src/nrf_log_backend_serial.c [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/libraries/log/src/nrf_log_frontend.c [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/libraries/button/app_button.c    [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/libraries/util/app_error.c       [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/libraries/util/app_error_weak.c  [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/libraries/scheduler/app_scheduler.c [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/libraries/timer/app_timer.c      [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/libraries/timer/app_timer_appsh.c [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/libraries/util/app_util_platform.c [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/libraries/crc16/crc16.c          [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/libraries/fds/fds.c              [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/libraries/fstorage/fstorage.c    [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/libraries/hardfault/hardfault_implementation.c [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/libraries/util/nrf_assert.c      [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/libraries/util/sdk_errors.c      [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/libraries/util/sdk_mapped_flags.c [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/drivers_nrf/clock/nrf_drv_clock.c [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/drivers_nrf/common/nrf_drv_common.c [OK]
Compiling: /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/drivers_nrf/gpiote/nrf_drv_gpiote.cIn function 'channel_free',
    inlined from 'nrf_drv_gpiote_in_uninit' at /home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/drivers_nrf/gpiote/nrf_drv_gpiote.c:620:5:
/home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/drivers_nrf/gpiote/nrf_drv_gpiote.c:217:18: error: array subscript 128 is above array bounds of 'void (*[12])(nrf_drv_gpiote_pin_t,  nrf_gpiote_polarity_t)' {aka 'void (*[12])(long unsigned int,  nrf_gpiote_polarity_t)'} [-Werror=array-bounds]
  217 |     m_cb.handlers[channel_id] = FORBIDDEN_HANDLER_ADDRESS;
      |     ~~~~~~~~~~~~~^~~~~~~~~~~~
/home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/drivers_nrf/gpiote/nrf_drv_gpiote.c: In function 'nrf_drv_gpiote_in_uninit':
/home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/drivers_nrf/gpiote/nrf_drv_gpiote.c:113:34: note: while referencing 'handlers'
  113 |     nrf_drv_gpiote_evt_handler_t handlers[GPIOTE_CH_NUM + GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS];
      |                                  ^~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [tmk_core/nrf.mk:972: .build/libnrf.sdk12.NRF52832.a//home/slot/Downloads/nRF5_SDK_12.3.0_d7731ad/components/drivers_nrf/gpiote/nrf_drv_gpiote.o] Error 1
make[1]: Leaving directory '/home/slot/qmk_firmware'
make: *** [Makefile:544: caravelle_ble/master:default:dfu_ble] Error 1
Make finished with errors

Related