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

Linker issue in SDK15.2

I am following this tutorial:

https://devzone.nordicsemi.com/nordic/short-range-guides/b/software-development-kit/posts/application-timer-tutorial?CommentId=43347679-22d9-4d45-ad73-4632d06c5e3e

But when I compile I ran into this issue where

1> Linking app_timer_tutorial_pca10056.elf
1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 4.16/gcc/arm-none-eabi/bin/ld: Output/app_timer_tutorial_pca10056 Release/Obj/main.o: in function `main':
1> D:\Current Work\BLE\nRF5_SDK_15.2.0_9412b96\examples\peripheral\nrf5-application-timer-tutorial/main.c:150: undefined reference to `app_timer_init'
Build failed

It appears to be a linker issue. I have done the necessary includes and the changes to the sdk_config.h file but this error still pops up.

  • Hi,

     

    From the error message, the app_timer.c which has the app_timer_init definition is not set as the tutorial. 

    Could you kindly help check:

    1. <SDK>/components/libraries/timer/app_timer.c is added into right side library folder as 
    2. The main.c includes statements:
      #include "app_timer.h"
    3. Enable timer driver in the sdk_config.h as the tutorial.

     

    -Amanda H.

  • Thank you for the fast response!

    I have indeed missed the app_timer.c inclusion, and I noticed it was also included in the tutorial. Parts 2 and 3 I have checked and are done. However, once I included the file I ran into another issue:

    Building ‘app_timer_tutorial_pca10056’ from solution ‘app_timer_tutorial_pca10056’ in configuration ‘Release’
    1> Compiling ‘app_timer.c’
    2> Compiling ‘main.c’
    1> In file included from ../../../../../../components/libraries/util/sdk_common.h:57,
    1>                  from D:\Current Work\BLE\nRF5_SDK_for_Thread\components\libraries\timer\app_timer.c:40:
    1> D:\Current Work\BLE\nRF5_SDK_for_Thread\components\libraries\timer\app_timer.c:69:32: error: 'SWIAPP_TIMER_CONFIG_SWI_NUMBER_EGUAPP_TIMER_CONFIG_SWI_NUMBER_IRQn' undeclared (first use in this function)
    1> ../../../../../../components/libraries/util/nordic_common.h:137:31: note: in definition of macro 'CONCAT_3_'
    1> D:\Current Work\BLE\nRF5_SDK_for_Thread\components\libraries\timer\app_timer.c:71:24: note: in expansion of macro 'CONCAT_3'
    1> ../../../../../../components/libraries/util/nordic_common.h:116:31: note: in expansion of macro 'CONCAT_2_'
    1> D:\Current Work\BLE\nRF5_SDK_for_Thread\components\libraries\timer\app_timer.c:69:23: note: in expansion of macro 'CONCAT_2'
    1> D:\Current Work\BLE\nRF5_SDK_for_Thread\components\libraries\timer\app_timer.c:71:33: note: in expansion of macro 'SWI_PART'
    1> D:\Current Work\BLE\nRF5_SDK_for_Thread\components\libraries\timer\app_timer.c:78:18: note: in expansion of macro 'SWI_IRQ_n'
    1> D:\Current Work\BLE\nRF5_SDK_for_Thread\components\libraries\timer\app_timer.c:365:24: note: in expansion of macro 'SWI_IRQn'
    1> D:\Current Work\BLE\nRF5_SDK_for_Thread\components\libraries\timer\app_timer.c:69:32: note: each undeclared identifier is reported only once for each function it appears in
    1> ../../../../../../components/libraries/util/nordic_common.h:137:31: note: in definition of macro 'CONCAT_3_'
    1> D:\Current Work\BLE\nRF5_SDK_for_Thread\components\libraries\timer\app_timer.c:71:24: note: in expansion of macro 'CONCAT_3'
    1> ../../../../../../components/libraries/util/nordic_common.h:116:31: note: in expansion of macro 'CONCAT_2_'
    1> D:\Current Work\BLE\nRF5_SDK_for_Thread\components\libraries\timer\app_timer.c:69:23: note: in expansion of macro 'CONCAT_2'
    1> D:\Current Work\BLE\nRF5_SDK_for_Thread\components\libraries\timer\app_timer.c:71:33: note: in expansion of macro 'SWI_PART'
    1> D:\Current Work\BLE\nRF5_SDK_for_Thread\components\libraries\timer\app_timer.c:78:18: note: in expansion of macro 'SWI_IRQ_n'
    1> D:\Current Work\BLE\nRF5_SDK_for_Thread\components\libraries\timer\app_timer.c:365:24: note: in expansion of macro 'SWI_IRQn'
    1> D:\Current Work\BLE\nRF5_SDK_for_Thread\components\libraries\timer\app_timer.c:69:32: error: 'SWIAPP_TIMER_CONFIG_SWI_NUMBER_EGUAPP_TIMER_CONFIG_SWI_NUMBER_IRQn' undeclared (first use in this function); did you mean 'SWIAPP_TIMER_CONFIG_SWI_NUMBER_EGUAPP_TIMER_CONFIG_SWI_NUMBER_IRQHandler'?
    1> ../../../../../../components/libraries/util/nordic_common.h:137:31: note: in definition of macro 'CONCAT_3_'
    1> D:\Current Work\BLE\nRF5_SDK_for_Thread\components\libraries\timer\app_timer.c:71:24: note: in expansion of macro 'CONCAT_3'
    1> ../../../../../../components/libraries/util/nordic_common.h:116:31: note: in expansion of macro 'CONCAT_2_'
    1> D:\Current Work\BLE\nRF5_SDK_for_Thread\components\libraries\timer\app_timer.c:69:23: note: in expansion of macro 'CONCAT_2'
    1> D:\Current Work\BLE\nRF5_SDK_for_Thread\components\libraries\timer\app_timer.c:71:33: note: in expansion of macro 'SWI_PART'
    1> D:\Current Work\BLE\nRF5_SDK_for_Thread\components\libraries\timer\app_timer.c:78:18: note: in expansion of macro 'SWI_IRQ_n'
    1> D:\Current Work\BLE\nRF5_SDK_for_Thread\components\libraries\timer\app_timer.c:949:26: note: in expansion of macro 'SWI_IRQn'
    Build failed
    

  • Hi, 

    Your app_timer.c comes from nRF5_SDK_for_Thread. Please use the same SDK source as nRF5_SDK_15.2.0_9412b96. 

    I suggest you go through "Add required files and includes" section of the tutorial and check your setting again.

    -Amanda H.

  • Hello,

    So I can't use the same file from across different SDKs?

    I thought as because it was a common peripheral component, I could just use it with the Thread SDK. 

    Finally for clarification, the same tutorial cannot be used for setting up app_timer in the Thread SDK?

Related