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

Linker fails, gcc, SDK 13.0.0, nRF52: "undefined reference to ..."

Hi.

I'm in the process of migrating an application from the nRF51822 and SDK 12.2.0 to the nRF52832 and SDK 13.0.0. My code now compiles but doesn't link. Here's the make output at the linking stage:

Linking target: _build/app_s132.out
"/Users/eliot/dev/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-gcc" -Wl,-Map=_build/app_s132.map -mthumb -mabi=aapcs -L /Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/toolchain/gcc -T./app_gcc_nrf52.ld -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -lc -lnosys -u _printf_float -u _scanf_float @_build/app_s132.in -lm -o _build/app_s132.out
_build/app_s132_acc_kionix_ktxj2.c.o: In function `acc_kionix_clear_interrupt':
/Users/eliot/dev/biketracker/biketracker-firmware/app/bt08_nrf52/../acc_kionix_ktxj2.c:592: undefined reference to `app_twi_perform'
_build/app_s132_acc_kionix_ktxj2.c.o: In function `acc_kionix_init':
/Users/eliot/dev/biketracker/biketracker-firmware/app/bt08_nrf52/../acc_kionix_ktxj2.c:134: undefined reference to `app_twi_init'
_build/app_s132_acc_kionix_ktxj2.c.o: In function `acc_kionix_program':
/Users/eliot/dev/biketracker/biketracker-firmware/app/bt08_nrf52/../acc_kionix_ktxj2.c:310: undefined reference to `app_twi_perform'
/Users/eliot/dev/biketracker/biketracker-firmware/app/bt08_nrf52/../acc_kionix_ktxj2.c:350: undefined reference to `app_twi_perform'
/Users/eliot/dev/biketracker/biketracker-firmware/app/bt08_nrf52/../acc_kionix_ktxj2.c:359: undefined reference to `app_twi_perform'
/Users/eliot/dev/biketracker/biketracker-firmware/app/bt08_nrf52/../acc_kionix_ktxj2.c:370: undefined reference to `app_twi_perform'
/Users/eliot/dev/biketracker/biketracker-firmware/app/bt08_nrf52/../acc_kionix_ktxj2.c:384: undefined reference to `app_twi_perform'
_build/app_s132_acc_kionix_ktxj2.c.o:/Users/eliot/dev/biketracker/biketracker-firmware/app/bt08_nrf52/../acc_kionix_ktxj2.c:395: more undefined references to `app_twi_perform' follow
_build/app_s132_ble_periph.c.o: In function `tps_init':
/Users/eliot/dev/biketracker/biketracker-firmware/app/bt08_nrf52/../ble_periph.c:509: undefined reference to `ble_tps_init'
_build/app_s132_gps_antenova_m10478.c.o: In function `gps_get':
/Users/eliot/dev/biketracker/biketracker-firmware/app/bt08_nrf52/../gps_antenova_m10478.c:200: undefined reference to `nrf_pwr_mgmt_run'
_build/app_s132_main.c.o: In function `main':
/Users/eliot/dev/biketracker/biketracker-firmware/app/bt08_nrf52/../main.c:75: undefined reference to `nrf_pwr_mgmt_init'
/Users/eliot/dev/biketracker/biketracker-firmware/app/bt08_nrf52/../main.c:128: undefined reference to `nrf_pwr_mgmt_run'
/Users/eliot/dev/biketracker/biketracker-firmware/app/bt08_nrf52/../main.c:182: undefined reference to `nrf_pwr_mgmt_run'
_build/app_s132_modem_td1207.c.o: In function `modem_get':
/Users/eliot/dev/biketracker/biketracker-firmware/app/bt08_nrf52/../modem_td1207.c:191: undefined reference to `nrf_pwr_mgmt_run'
_build/app_s132_state.c.o: In function `state_change_sys_off_async':
/Users/eliot/dev/biketracker/biketracker-firmware/app/bt08_nrf52/../state.c:562: undefined reference to `nrf_pwr_mgmt_shutdown'
_build/app_s132_tracking.c.o: In function `alert':
/Users/eliot/dev/biketracker/biketracker-firmware/app/bt08_nrf52/../tracking.c:370: undefined reference to `nrf_pwr_mgmt_run'
_build/app_s132_nrf_drv_saadc.c.o: In function `nrf_drv_saadc_channel_init':
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/drivers_nrf/saadc/nrf_drv_saadc.c:345: undefined reference to `nrf_saadc_channel_init'
_build/app_s132_nrf_drv_common.c.o: In function `POWER_CLOCK_IRQHandler':
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/drivers_nrf/common/nrf_drv_common.c:284: undefined reference to `nrf_drv_power_onIRQ'
_build/app_s132_nrf_drv_uart.c.o: In function `nrf_drv_uart_init':
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/drivers_nrf/uart/nrf_drv_uart.c:273: undefined reference to `nrf_strerror_get'
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/drivers_nrf/uart/nrf_drv_uart.c:296: undefined reference to `nrf_strerror_get'
_build/app_s132_nrf_drv_uart.c.o: In function `nrf_drv_uart_tx':
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/drivers_nrf/uart/nrf_drv_uart.c:413: undefined reference to `nrf_strerror_get'
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/drivers_nrf/uart/nrf_drv_uart.c:428: undefined reference to `nrf_strerror_get'
_build/app_s132_nrf_drv_uart.c.o: In function `nrf_drv_uart_tx_for_uarte':
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/drivers_nrf/uart/nrf_drv_uart.c:399: undefined reference to `nrf_strerror_get'
_build/app_s132_nrf_drv_uart.c.o:/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/drivers_nrf/uart/nrf_drv_uart.c:602: more undefined references to `nrf_strerror_get' follow
_build/app_s132_app_uart_fifo.c.o: In function `uart_event_handler':
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/libraries/uart/app_uart_fifo.c:75: undefined reference to `app_fifo_put'
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/libraries/uart/app_uart_fifo.c:111: undefined reference to `app_fifo_get'
_build/app_s132_app_uart_fifo.c.o: In function `app_uart_init':
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/libraries/uart/app_uart_fifo.c:144: undefined reference to `app_fifo_init'
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/libraries/uart/app_uart_fifo.c:148: undefined reference to `app_fifo_init'
_build/app_s132_app_uart_fifo.c.o: In function `app_uart_get':
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/libraries/uart/app_uart_fifo.c:204: undefined reference to `app_fifo_get'
_build/app_s132_app_uart_fifo.c.o: In function `app_uart_put':
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/libraries/uart/app_uart_fifo.c:223: undefined reference to `app_fifo_put'
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/libraries/uart/app_uart_fifo.c:236: undefined reference to `app_fifo_get'
_build/app_s132_softdevice_handler.c.o: In function `softdevice_handler_init':
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/softdevice/common/softdevice_handler/softdevice_handler.c:380: undefined reference to `nrf_drv_power_on_sd_enable'
collect2: error: ld returned 1 exit status
make: *** [_build/app_s132.out] Error 1

It seems that the sources that contain these functions are all being compiled OK. I can see their .o files in _build and if I run objdump on them, there's stuff in there. When I check the .in file in _build, all the right .o files are in there. For comparison, a couple of example projects in the SDK examples will build just fine.

Here's my full project Makefile:

Makefile

And here's the full, verbose output from the build:

make_output.txt

I'm stumped.

[edit]

Object and dependency files for app_twi.c:

app_s132_app_twi.c.o

app_s132_app_twi.c.d

Parents
  • I'd say you have included files from app_uart and app_fifo modules but you probably haven't defined few things in sdk_config.h or rather app_config.h like

    #define APP_UART_ENABLED 1
    #define UART_ENABLED 1
    #define UART0_CONFIG_USE_EASY_DMA 1
    #define APP_UART_DRIVER_INSTANCE 0
    #define APP_FIFO_ENABLED 1
    

    There were few changes around sdk_config.h (it's position in SDK, "default" content etc.)

  • @endnode Your initial suspicion was correct! Although the defines you mentioned were all there, there were a few others that weren't. The problem, once again, is that I wrongly assumed that nRF5_SDK_13.0.0_04a0bfd/examples/ble_peripheral/ble_app_template/pca10040/s132/config/sdk_config.h was a complete file. It's not. With every SDK release I lose about a day on this. I'm now using nRF5_SDK_13.0.0_04a0bfd/config/sdk_config.h directly in my build and defining my own stuff in an app_config.h as you suggested.

Reply
  • @endnode Your initial suspicion was correct! Although the defines you mentioned were all there, there were a few others that weren't. The problem, once again, is that I wrongly assumed that nRF5_SDK_13.0.0_04a0bfd/examples/ble_peripheral/ble_app_template/pca10040/s132/config/sdk_config.h was a complete file. It's not. With every SDK release I lose about a day on this. I'm now using nRF5_SDK_13.0.0_04a0bfd/config/sdk_config.h directly in my build and defining my own stuff in an app_config.h as you suggested.

Children
No Data
Related