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

Parents
  • Yes, I closely followed the guide. Unfortunately not everything was clear with the SDK12 either so the misunderstandings I had before haven't vanished ;) Also for exmple I want to log stuff and I enabled the RTT backend. But it still tries to link nrf_cli_fprintf. But I don't want to use the CLI module. Sadly I can't find any switches to turn it off ... it is all just very big and full of features even tho I feel that it is really well done, so it takes me hours of grepping just for the basics ...

    Also the missing memory sections were because of the old linker script which hadn't included them. Also for example now that the sections are in the linker script, those sections will always be there and disabling the LOG module for example wont save any memory, which feels weird to me ..

Reply
  • Yes, I closely followed the guide. Unfortunately not everything was clear with the SDK12 either so the misunderstandings I had before haven't vanished ;) Also for exmple I want to log stuff and I enabled the RTT backend. But it still tries to link nrf_cli_fprintf. But I don't want to use the CLI module. Sadly I can't find any switches to turn it off ... it is all just very big and full of features even tho I feel that it is really well done, so it takes me hours of grepping just for the basics ...

    Also the missing memory sections were because of the old linker script which hadn't included them. Also for example now that the sections are in the linker script, those sections will always be there and disabling the LOG module for example wont save any memory, which feels weird to me ..

Children
No Data
Related