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

nrf_drv_timer.c left out from compiling

I am getting following error while building the project.

undefined reference to `nrf_drv_timer_pause'

undefined reference to `nrf_drv_timer_clear'

I believe these functions are located in nrf_drv_timer.c. I have added the nrf_drv_timer.h header file and the program locates it perfectly. However, I noticed that nrf_drv_timer.c is left off from compiling when I am building the project which I think raises this error.

Note that, I have added the nrf_drv_timer.c files path in preprocessing and mentioned #define TIMER_ENABLED 1 in sdk_config.h file. Also, I am using the Segger Embedded Studio to build the project.

I will appreciate if anyone can help me in solving this issue. Thanks!

  • That's an interesting thought. Usually #defines are used in .h files and cause compilation errors for undefined functions as unused functions are tossed by the linker anyway so you just compile them and don't worry about it. However the nrf_drv_timer.c does have code guarded by #if, in this case it's 

    #if NRF_MODULE_ENABLED(TIMER) 

    and

    #if ENABLED_TIMER_COUNT

    so yes it's quite likely one of those two things is not enabled. 

Related