Linker error with bluetooth sketches using bluefruit

Hello,

I'm trying to get bluetooth development with Adafruit bluefruit libraries going on my nRF52840 board.

Environment:

  • SparkFun Pro nRF52840 Mini
  • Mac Book Pro 13" - Mac OS X 10.14.6
  • Arduino 1.8.13

I followed the Arduino BSP installation instructions at https://github.com/adafruit/Adafruit_nRF52_Arduino. Because I hit the problem described in the last FAQ of https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide/faqs (i.e., "Unable to upload sketch/update bootloader with macOS"), I followed the instructions and built and copied over the self-contained adafruit-nrfutil as described in https://github.com/adafruit/Adafruit_nRF52_nrfutil

At this point, I can make simple sketches (like blinking LED) to work on the board.

However, when I try to build a simple bluetooth example sketch (like blinky_ota), the Arduino IDE gives the following error:

Arduino: 1.8.13 Hourly Build 2020/04/21 12:12 (Mac OS X), Board: "SparkFun Pro nRF52840 Mini, s140 6.1.1 r0, Level 0 (Release)"

/Users/ankitharaman/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/Bluefruit52Lib/BLESecurity.cpp.o: in function `BLESecurity::BLESecurity()':
/Users/ankitharaman/Library/Arduino15/packages/adafruit/hardware/nrf52/0.22.1/libraries/Bluefruit52Lib/src/BLESecurity.cpp:79: undefined reference to `nRFCrypto_ECC_PrivateKey::nRFCrypto_ECC_PrivateKey()'
/Users/ankitharaman/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/Bluefruit52Lib/BLESecurity.cpp.o: in function `BLESecurity::begin()':
/Users/ankitharaman/Library/Arduino15/packages/adafruit/hardware/nrf52/0.22.1/libraries/Bluefruit52Lib/src/BLESecurity.cpp:91: undefined reference to `Adafruit_nRFCrypto::begin()'
/Users/ankitharaman/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/ankitharaman/Library/Arduino15/packages/adafruit/hardware/nrf52/0.22.1/libraries/Bluefruit52Lib/src/BLESecurity.cpp:94: undefined reference to `nRFCrypto_ECC_PrivateKey::begin(CRYS_ECPKI_DomainID_t)'
/Users/ankitharaman/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/ankitharaman/Library/Arduino15/packages/adafruit/hardware/nrf52/0.22.1/libraries/Bluefruit52Lib/src/BLESecurity.cpp:97: undefined reference to `nRFCrypto_ECC_PublicKey::nRFCrypto_ECC_PublicKey()'
/Users/ankitharaman/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/ankitharaman/Library/Arduino15/packages/adafruit/hardware/nrf52/0.22.1/libraries/Bluefruit52Lib/src/BLESecurity.cpp:98: undefined reference to `nRFCrypto_ECC_PublicKey::begin(CRYS_ECPKI_DomainID_t)'
/Users/ankitharaman/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/ankitharaman/Library/Arduino15/packages/adafruit/hardware/nrf52/0.22.1/libraries/Bluefruit52Lib/src/BLESecurity.cpp:101: undefined reference to `nRFCrypto_ECC::genKeyPair(nRFCrypto_ECC_PrivateKey&, nRFCrypto_ECC_PublicKey&)'
/Users/ankitharaman/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/ankitharaman/Library/Arduino15/packages/adafruit/hardware/nrf52/0.22.1/libraries/Bluefruit52Lib/src/BLESecurity.cpp:104: undefined reference to `nRFCrypto_ECC_PublicKey::toRaw(unsigned char*, unsigned long)'
/Users/ankitharaman/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/ankitharaman/Library/Arduino15/packages/adafruit/hardware/nrf52/0.22.1/libraries/Bluefruit52Lib/src/BLESecurity.cpp:105: undefined reference to `nRFCrypto_ECC_PublicKey::end()'
/Users/ankitharaman/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/ankitharaman/Library/Arduino15/packages/adafruit/hardware/nrf52/0.22.1/libraries/Bluefruit52Lib/src/BLESecurity.cpp:114: undefined reference to `nRFCrypto'
/Users/ankitharaman/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/Bluefruit52Lib/BLESecurity.cpp.o: in function `BLESecurity::_eventHandler(ble_evt_t*)':
/Users/ankitharaman/Library/Arduino15/packages/adafruit/hardware/nrf52/0.22.1/libraries/Bluefruit52Lib/src/BLESecurity.cpp:330: undefined reference to `nRFCrypto_ECC_PublicKey::nRFCrypto_ECC_PublicKey()'
/Users/ankitharaman/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/ankitharaman/Library/Arduino15/packages/adafruit/hardware/nrf52/0.22.1/libraries/Bluefruit52Lib/src/BLESecurity.cpp:331: undefined reference to `nRFCrypto_ECC_PublicKey::begin(CRYS_ECPKI_DomainID_t)'
/Users/ankitharaman/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/ankitharaman/Library/Arduino15/packages/adafruit/hardware/nrf52/0.22.1/libraries/Bluefruit52Lib/src/BLESecurity.cpp:332: undefined reference to `nRFCrypto_ECC_PublicKey::fromRaw(unsigned char*, unsigned long)'
/Users/ankitharaman/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/ankitharaman/Library/Arduino15/packages/adafruit/hardware/nrf52/0.22.1/libraries/Bluefruit52Lib/src/BLESecurity.cpp:336: undefined reference to `nRFCrypto_ECC::SVDP_DH(nRFCrypto_ECC_PrivateKey&, nRFCrypto_ECC_PublicKey&, unsigned char*, unsigned long)'
/Users/ankitharaman/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/ankitharaman/Library/Arduino15/packages/adafruit/hardware/nrf52/0.22.1/libraries/Bluefruit52Lib/src/BLESecurity.cpp:338: undefined reference to `nRFCrypto_ECC_PublicKey::end()'
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board SparkFun Pro nRF52840 Mini.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I have confirmed that the Adafruit_nRFCrypto library is indeed installed in a sibling directory to Bluefruit52Lib, and I can include the header file. However, it doesn't seem to be getting linked in. I have even tried explicitly installing Adafruit_nRFCrypto and Arduino notices the duplicate installation but the same error exists.

I'd appreciate any help to fix this problem.

@amoghprahar, your topic has been moved to a more suitable location on the forum.

Oi tudo bem ?

Eu sou Brasileiro e estou passando pelo mesmo problema que você. Vi alguns tutoriais em alguns blogs aqui no Brasil, porém ainda não tive sucesso.

Estou Com o Bluetooth Nina - 302.

Vou fazer mais tentativas e vamos nos atualizando. Lamento não poder ajudar, mas infelizmente o que nós estamos trabalhando tem pouco material.

@luis_godoy, please post in English; google translate can help if needed.

===