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

SDK14: determine what modules to link/enable

Hi!

I once set up a simple project using SDK 12 and the HRS example.

Now I tried porting it to SDK 14 and SD 5. That didn't work out well.

So I started things from scratch. I now finally understand where I have to enable things, etc, but:

Where the hell do I find out what enable flags I need when? I get random linker errors that happen because I linked the right *.c file but didn't enable the module. Why do I even have to link AND enable it? How do I know which flags I have to enable when I use a certain module?

I get a heap of linker errors:

Linking target: build/firmware.out
build/firmware/main.c.o: In function `main':
/Users/yatekii/repos/230V2Switch/firmware/./src/main.c:63: undefined reference to `m_nrf_log_APP_logs_data_dynamic'
build/firmware/cble.c.o: In function `on_adv_evt':
/Users/yatekii/repos/230V2Switch/firmware/./src/cble.c:51: undefined reference to `m_nrf_log_APP_logs_data_dynamic'
build/firmware/cble.c.o: In function `delete_bonds':
/Users/yatekii/repos/230V2Switch/firmware/./src/cble.c:396: undefined reference to `m_nrf_log_APP_logs_data_dynamic'
build/firmware/cble.c.o: In function `pm_evt_handler':
/Users/yatekii/repos/230V2Switch/firmware/./src/cble.c:258: undefined reference to `m_nrf_log_APP_logs_data_dynamic'
build/firmware/gatt.c.o: In function `gatt_evt_handler':
/Users/yatekii/repos/230V2Switch/firmware/./src/gatt.c:15: undefined reference to `m_nrf_log_APP_logs_data_dynamic'
build/firmware/nrf_log_frontend.c.o: In function `nrf_log_init':
/Users/yatekii/repos/230V2Switch/firmware/./nRF5_SDK/components/libraries/experimental_log/src/nrf_log_frontend.c:171: undefined reference to `__start_log_const_data'
/Users/yatekii/repos/230V2Switch/firmware/./nRF5_SDK/components/libraries/experimental_log/src/nrf_log_frontend.c:171: undefined reference to `__stop_log_const_data'
/Users/yatekii/repos/230V2Switch/firmware/./nRF5_SDK/components/libraries/experimental_log/src/nrf_log_frontend.c:171: undefined reference to `__start_log_dynamic_data'
build/firmware/nrf_log_frontend.c.o: In function `nrf_log_frontend_dequeue':
/Users/yatekii/repos/230V2Switch/firmware/./nRF5_SDK/components/libraries/experimental_log/src/nrf_log_frontend.c:780: undefined reference to `__start_log_dynamic_data'
build/firmware/nrf_sdh.c.o:(.rodata.sdh_req_observers+0x0): undefined reference to `__start_sdh_req_observers'
build/firmware/nrf_sdh.c.o:(.rodata.sdh_req_observers+0x4): undefined reference to `__stop_sdh_req_observers'
build/firmware/nrf_sdh.c.o:(.rodata.sdh_state_observers+0x0): undefined reference to `__start_sdh_state_observers'
build/firmware/nrf_sdh.c.o:(.rodata.sdh_state_observers+0x4): undefined reference to `__stop_sdh_state_observers'
build/firmware/nrf_sdh.c.o:(.rodata.sdh_stack_observers+0x0): undefined reference to `__start_sdh_stack_observers'
build/firmware/nrf_sdh.c.o:(.rodata.sdh_stack_observers+0x4): undefined reference to `__stop_sdh_stack_observers'
collect2: error: ld returned 1 exit status
make: *** [build/firmware.out] Error 1

I traced them down to a macro:

#define NRF_SECTION_DEF(section_name, data_type)                \
    extern data_type * CONCAT_2(__start_, section_name);        \
    extern void      * CONCAT_2(__stop_,  section_name)

Which only ever marks them as extern but doesn't actually allocate any storage. Unfortunately I couldn't find the macro that actually allocates space. Where do I find it?

Also there is an entire wealth of options for the SDK which I greatly appreciate, but how in lords name do I find out which ones I need when and how? I mean it's 6k lines of text in the reference sdk_config.h ...

Thanks for any help Noah

Related