Closed zfields closed 2 years ago
I was missing the adafruit-nrfutil
. I was able to install it with pip
pip install adafruit-nrfutil
I tried compiling another sketch, which led me to realize I was missing adafruit-nrfutil
. I assumed that would fix my problem, but I was mistaken.
I also thought it was only in Arduino CLI that caused the problem, but it turns out it's also happens in the Arduino IDE.
Linking everything together...
/home/zak/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/arm-none-eabi-gcc -L/tmp/arduino_build_656226 -Ofast -Wl,--gc-sections -save-temps -L/home/zak/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/cores/nRF5/linker -Tnrf52840_s140_v6.ld -Wl,-Map,/tmp/arduino_build_656226/SerialCallResponseASCII.ino.map -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -u _printf_float -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--wrap=malloc -Wl,--wrap=free --specs=nano.specs --specs=nosys.specs -o /tmp/arduino_build_656226/SerialCallResponseASCII.ino.elf /tmp/arduino_build_656226/sketch/SerialCallResponseASCII.ino.cpp.o /tmp/arduino_build_656226/core/variant.cpp.o -Wl,--start-group -L/home/zak/.arduino15/packages/adafruit/tools/CMSIS/5.7.0/CMSIS/DSP/Lib/GCC/ -larm_cortexM4lf_math -lm /tmp/arduino_build_656226/../arduino_cache_769656/core/core_7d9bf707a5a0bfe0f7f1406daaaca664.a -Wl,--end-group
/home/zak/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_656226/sketch/SerialCallResponseASCII.ino.cpp.o: in function `setup':
/home/zak/Development/Arduino/SerialCallResponseASCII/SerialCallResponseASCII.ino:32: undefined reference to `Adafruit_USBD_CDC::begin(unsigned long)'
/home/zak/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /home/zak/Development/Arduino/SerialCallResponseASCII/SerialCallResponseASCII.ino:33: undefined reference to `Adafruit_USBD_CDC::operator bool()'
/home/zak/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_656226/sketch/SerialCallResponseASCII.ino.cpp.o: in function `establishContact()':
/home/zak/Development/Arduino/SerialCallResponseASCII/SerialCallResponseASCII.ino:63: undefined reference to `Adafruit_USBD_CDC::available()'
/home/zak/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_656226/sketch/SerialCallResponseASCII.ino.cpp.o: in function `setup':
/home/zak/Development/Arduino/SerialCallResponseASCII/SerialCallResponseASCII.ino:40: undefined reference to `Serial'
/home/zak/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_656226/sketch/SerialCallResponseASCII.ino.cpp.o: in function `loop':
/home/zak/Development/Arduino/SerialCallResponseASCII/SerialCallResponseASCII.ino:44: undefined reference to `Adafruit_USBD_CDC::available()'
/home/zak/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /home/zak/Development/Arduino/SerialCallResponseASCII/SerialCallResponseASCII.ino:46: undefined reference to `Adafruit_USBD_CDC::read()'
/home/zak/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /home/zak/Development/Arduino/SerialCallResponseASCII/SerialCallResponseASCII.ino:58: undefined reference to `Serial'
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Adafruit Feather nRF52840 Express.
I found the answer in the closed issue https://github.com/adafruit/Adafruit_nRF52_Arduino/issues/653
The following code is required to make my sketch portable to your platform:
#ifdef ARDUINO_NRF52840_FEATHER
#include "Adafruit_TinyUSB.h"
#endif
:point_up_2: That's fine as a workaround, but it's a poor long-term solution.
@zfields the correct way to include tinyusb is, it is a bit annoying, but required for tinyusb to portable for other platforms: nrf52/samd/rp2040/esp32sx
#ifdef USE_TINYUSB
#include "Adafruit_TinyUSB.h"
#endif
Operating System
Linux
IDE version
Arduino CLI 0.22.0
Board
Feather nRF52840 Express
BSP version
adafruit:nrf52@1.3.0
Sketch
File > Examples > Built-in Examples > 04.Communication/SerialCallResponseASCII
What happened ?
The sketch references
Serial
, is able to compile, but then fails to link withundefined reference to 'Serial'
How to reproduce ?
arduino-cli compile --build-property compiler.cpp.extra_flags='-Wno-unused-parameter -Werror' --fqbn adafruit:nrf52:feather52840:softdevice=s140v6 --warnings all ./SerialCallResponseASCII/SerialCallResponseASCII.ino
Debug Log
N/A
Screenshots
No response