This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Building 'blinky' in Eclipse, 'undefined reference' errors while linking

SDK version: nRF5 SDK v14.2.0
Board: PCA10040 v1.2.1 (nrf52832)
Eclipse version: Eclipse for C/C++,  Oxygen.2 Release (4.7.2)
GCC version: 7.2.1 20170904 (release)
OS: Ubuntu Linux 17.04

I've been following this guide to getting started with the nRF52 SDK, with some changes based on this updated guide.

I've had to update the example blinky Makefile with several additional includes to account for SDK changes since the original guide was written.

Imports largely work now, but when the project is built the compiler complains about undefined references - specifically to bsp_board_leds_init and bsp_board_led_invert.

This is a little baffling, as it does seem to be importing the .../components/boards/boards.h file that should contain these. Including the project (zip) and build output below. Thanks in advance for thoughts / help on getting this going.


Build output

12:50:35 **** Incremental Build of configuration Default for project blinky ****
make VERBOSE=1 all 
rm -rf _build
make -f  Makefile -C ./  -e cleanobj
make[1]: Entering directory '/home/cdot/apps/nrf5x-sdk/examples/peripheral/blinky/pca10040/blank/armgcc'
rm -rf _build/*.o
make[1]: Leaving directory '/home/cdot/apps/nrf5x-sdk/examples/peripheral/blinky/pca10040/blank/armgcc'
make -f  Makefile -C ./  -e nrf52832_xxaa 
make[1]: Entering directory '/home/cdot/apps/nrf5x-sdk/examples/peripheral/blinky/pca10040/blank/armgcc'
echo  Makefile
Makefile
mkdir _build
Compiling file: system_nrf52.c
'/home/cdot/opt/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-gcc' -DCONFIG_GPIO_AS_PINRESET -DBOARD_PCA10036 -DNRF52 -DBSP_DEFINES_ONLY -mcpu=cortex-m4 -mthumb -mabi=aapcs --std=gnu99 -Wall -Werror -O0 -g3 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin --short-enums -I../../../../../../components/toolchain/gcc -I../../../../../../components/toolchain -I../../.. -I../../../../../bsp -I../../../../../../components/device -I../../../../../../components/drivers_nrf/delay -I../../../../../../components/drivers_nrf/hal -I../../../../../../components/toolchain/cmsis/include -I../../../../../../components/boards -I../../../../../../components/libraries/util -I../../../../../../components/drivers_nrf/nrf_soc_nosd -I../../../pca10040/s132/config/ -c -o _build/system_nrf52.o ../../../../../../components/toolchain/system_nrf52.c
Compiling file: main.c
'/home/cdot/opt/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-gcc' -DCONFIG_GPIO_AS_PINRESET -DBOARD_PCA10036 -DNRF52 -DBSP_DEFINES_ONLY -mcpu=cortex-m4 -mthumb -mabi=aapcs --std=gnu99 -Wall -Werror -O0 -g3 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin --short-enums -I../../../../../../components/toolchain/gcc -I../../../../../../components/toolchain -I../../.. -I../../../../../bsp -I../../../../../../components/device -I../../../../../../components/drivers_nrf/delay -I../../../../../../components/drivers_nrf/hal -I../../../../../../components/toolchain/cmsis/include -I../../../../../../components/boards -I../../../../../../components/libraries/util -I../../../../../../components/drivers_nrf/nrf_soc_nosd -I../../../pca10040/s132/config/ -c -o _build/main.o ../../../main.c
Compiling file: gcc_startup_nrf52.s
'/home/cdot/opt/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-gcc' -x assembler-with-cpp -DCONFIG_GPIO_AS_PINRESET -DBOARD_PCA10036 -DNRF52 -DBSP_DEFINES_ONLY -I../../../../../../components/toolchain/gcc -I../../../../../../components/toolchain -I../../.. -I../../../../../bsp -I../../../../../../components/device -I../../../../../../components/drivers_nrf/delay -I../../../../../../components/drivers_nrf/hal -I../../../../../../components/toolchain/cmsis/include -I../../../../../../components/boards -I../../../../../../components/libraries/util -I../../../../../../components/drivers_nrf/nrf_soc_nosd -I../../../pca10040/s132/config/ -c -o _build/gcc_startup_nrf52.o ../../../../../../components/toolchain/gcc/gcc_startup_nrf52.s
Linking target: nrf52832_xxaa.out
'/home/cdot/opt/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-gcc' -Xlinker -Map=_build/nrf52832_xxaa.map -mthumb -mabi=aapcs -L ../../../../../../components/toolchain/gcc -Tblinky_gcc_nrf52.ld -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -lc -lnosys _build/system_nrf52.o _build/main.o _build/gcc_startup_nrf52.o  -o _build/nrf52832_xxaa.out
_build/main.o: In function `main':
Makefile:126: recipe for target 'nrf52832_xxaa' failed
/home/cdot/apps/nrf5x-sdk/examples/peripheral/blinky/pca10040/blank/armgcc//../../../main.c:62: undefined reference to `bsp_board_leds_init'
make[1]: Leaving directory '/home/cdot/apps/nrf5x-sdk/examples/peripheral/blinky/pca10040/blank/armgcc'
Makefile:101: recipe for target 'all' failed
/home/cdot/apps/nrf5x-sdk/examples/peripheral/blinky/pca10040/blank/armgcc//../../../main.c:69: undefined reference to `bsp_board_led_invert'
collect2: error: ld returned 1 exit status
make[1]: *** [nrf52832_xxaa] Error 1
make: *** [all] Error 2

12:50:35 Build Finished (took 476ms)

Project files

armgcc.zip

Related