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

undefined reference to `nrf_pwr_mgmt_init

hello,

       i am using the Nrf52840 , SDK version 15 with segger embedded studio.

i am developing simple application but i got this issue. i already add the reference in the following location 

project-> edit option -> common-> Preprocessor-> user includes dic.

i already used some  custom library which is working fine but not power management  library.

.c file is also included. the error is coming from the linker 

here is the output 

Building ‘SmartID’ from solution ‘SmartID’ in configuration ‘Debug’
1> 'Output/SmartID Debug/Obj/thumb_crt0.o' is up to date
2> 'Output/SmartID Debug/Obj/main.o' is up to date
3> 'Output/SmartID Debug/Obj/boards.o' is up to date
1> 'Output/SmartID Debug/Obj/app_error_handler_gcc.o' is up to date
2> 'Output/SmartID Debug/Obj/app_error_weak.o' is up to date
1> 'Output/SmartID Debug/Obj/app_error.o' is up to date
4> 'Output/SmartID Debug/Obj/app_timer.o' is up to date
1> 'Output/SmartID Debug/Obj/app_util_platform.o' is up to date
2> 'Output/SmartID Debug/Obj/ble_conn_state.o' is up to date
1> 'Output/SmartID Debug/Obj/nrf_assert.o' is up to date
3> 'Output/SmartID Debug/Obj/nrf_atflags.o' is up to date
1> 'Output/SmartID Debug/Obj/nrf_atomic.o' is up to date
2> 'Output/SmartID Debug/Obj/nrf_balloc.o' is up to date
1> 'Output/SmartID Debug/Obj/nrf_memobj.o' is up to date
1> 'Output/SmartID Debug/Obj/nrf_section_iter.o' is up to date
2> 'Output/SmartID Debug/Obj/nrf_strerror.o' is up to date
1> 'Output/SmartID Debug/Obj/nrfx_twim.o' is up to date
3> 'Output/SmartID Debug/Obj/nrf_pwr_mgmt.o' is up to date
1> 'Output/SmartID Debug/Obj/ses_nRF_Startup.o' is up to date
2> 'Output/SmartID Debug/Obj/ses_nrf52840_Vectors.o' is up to date
1> 'Output/SmartID Debug/Obj/system_nrf52840.o' is up to date
4> 'Output/SmartID Debug/Obj/ble_advdata.o' is up to date
1> 'Output/SmartID Debug/Obj/nrfx_twi.o' is up to date
2> 'Output/SmartID Debug/Obj/nrf_drv_twi.o' is up to date
1> 'Output/SmartID Debug/Obj/nrf_sdh_ble.o' is up to date
3> 'Output/SmartID Debug/Obj/nrf_sdh.o' is up to date
1> 'Output/SmartID Debug/Obj/nrf_log_frontend.o' is up to date
2> 'Output/SmartID Debug/Obj/nrf_log_backend_rtt.o' is up to date
1> 'Output/SmartID Debug/Obj/nrf_log_backend_serial.o' is up to date
1> 'Output/SmartID Debug/Obj/nrf_log_backend_uart.o' is up to date
2> 'Output/SmartID Debug/Obj/nrf_log_default_backends.o' is up to date
1> 'Output/SmartID Debug/Obj/nrf_log_str_formatter.o' is up to date
3> 'Output/SmartID Debug/Obj/nrf_fprintf.o' is up to date
1> 'Output/SmartID Debug/Obj/nrf_fprintf_format.o' is up to date
2> 'Output/SmartID Debug/Obj/SEGGER_RTT_printf.o' is up to date
1> 'Output/SmartID Debug/Obj/SEGGER_RTT_Syscalls_SES.o' is up to date
4> 'Output/SmartID Debug/Obj/SEGGER_RTT.o' is up to date
1> Output/Debug/Exe/SmartID.elf does not exist.
1> Generating linker script ‘SmartID.ld’
1> "/Applications/SEGGER Embedded Studio for ARM 3.34/bin/mkld" -memory-map-segments "FLASH RX 0x0 0x100000;RAM RWX 0x20000000 0x40000" -section-placement-file /Users/atifshabbir/Development/Projects/SmartID/Project_File/flash_placement.xml -check-segment-overflow -symbols __STACKSIZE__=8192;__STACKSIZE_PROCESS__=0;__STACKSIZE_IRQ__=0;__STACKSIZE_FIQ__=0;__STACKSIZE_SVC__=0;__STACKSIZE_ABT__=0;__STACKSIZE_UND__=0;__HEAPSIZE__=8192 -section-placement-macros FLASH_PH_START=0x0;FLASH_PH_SIZE=0x100000;RAM_PH_START=0x20000000;RAM_PH_SIZE=0x40000;FLASH_START=0x26000;FLASH_SIZE=0xda000;RAM_START=0x20001d70;RAM_SIZE=0x3e290 "/Users/atifshabbir/Development/Projects/SmartID/Project_File/Output/SmartID Debug/Obj/SmartID.ld"
1> Linking SmartID.elf
1> "/Applications/SEGGER Embedded Studio for ARM 3.34/gcc/arm-none-eabi/bin/ld" -X -eReset_Handler --omagic -defsym=__vfprintf=__vfprintf_long -defsym=__vfscanf=__vfscanf_int -EL --gc-sections "-T/Users/atifshabbir/Development/Projects/SmartID/Project_File/Output/SmartID Debug/Obj/SmartID.ld" -Map Output/Debug/Exe/SmartID.map -u_vectors -o Output/Debug/Exe/SmartID.elf --emit-relocs "@/Users/atifshabbir/Development/Projects/SmartID/Project_File/Output/SmartID Debug/Obj/SmartID.ind"
1> Output/SmartID Debug/Obj/main.o: In function `power_management_init()':
1> /Users/atifshabbir/Development/Projects/SmartID/main/main.cpp:237: undefined reference to `nrf_pwr_mgmt_init()'
1> Output/SmartID Debug/Obj/main.o: In function `idle_state_handle()':
1> /Users/atifshabbir/Development/Projects/SmartID/main/main.cpp:244: undefined reference to `nrf_pwr_mgmt_run()'
Build failed

thank you 

Parents Reply
  • Hi, 

    I just tried to import pwr_mgmt into a clean project, and it shouldn't be more to it than

    1. adding nrf_pwr_mgmt.c to your project files,
    2. including a path to the library folder,
    3. including nrf_pwr_mgmt.h in your main.c,
    4. enabling in sdk_config.h.

    But is it seems like you have done all of that. I can't compile your files because you have used absolute file paths in your project which makes it hard to debug. 

    Are you able to add any other libraries or drivers?

    Are you able to add pwr_mgmt to a clean project, like the blinky example?

Children
Related