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

SDK14: Undefined symbol sdh_req_observers$$Base

I am currently porting my project from SDK13.0 to 14.0 so I can use s332 v5.0.0.

I receive warnings when compiling

.\_build\nrf52_firmware.axf: Warning: L6330W: Undefined symbol sdh_req_observers$$Base (referred from nrf_sdh.o). Unused section has been removed.
.\_build\nrf52_firmware.axf: Warning: L6330W: Undefined symbol sdh_req_observers$$Limit (referred from nrf_sdh.o). Unused section has been removed.
.\_build\nrf52_firmware.axf: Warning: L6330W: Undefined symbol sdh_stack_observers$$Base (referred from nrf_sdh.o). Unused section has been removed.
.\_build\nrf52_firmware.axf: Warning: L6330W: Undefined symbol sdh_stack_observers$$Limit (referred from nrf_sdh.o). Unused section has been removed.
.\_build\nrf52_firmware.axf: Warning: L6330W: Undefined symbol sdh_state_observers$$Base (referred from nrf_sdh.o). Unused section has been removed.
.\_build\nrf52_firmware.axf: Warning: L6330W: Undefined symbol sdh_state_observers$$Limit (referred from nrf_sdh.o). Unused section has been removed.
.\_build\nrf52_firmware.axf: Warning: L6330W: Undefined symbol sdh_ant_observers$$Base (referred from nrf_sdh_ant.o). Unused section has been removed.
.\_build\nrf52_firmware.axf: Warning: L6330W: Undefined symbol sdh_ant_observers$$Limit (referred from nrf_sdh_ant.o). Unused section has been removed.
.\_build\nrf52_firmware.axf: Warning: L6330W: Undefined symbol sdh_ble_observers$$Base (referred from nrf_sdh_ble.o). Unused section has been removed.
.\_build\nrf52_firmware.axf: Warning: L6330W: Undefined symbol sdh_ble_observers$$Limit (referred from nrf_sdh_ble.o). Unused section has been removed.
.\_build\nrf52_firmware.axf: Warning: L6330W: Undefined symbol sdh_soc_observers$$Base (referred from nrf_sdh_soc.o). Unused section has been removed.
.\_build\nrf52_firmware.axf: Warning: L6330W: Undefined symbol sdh_soc_observers$$Limit (referred from nrf_sdh_soc.o). Unused section has been removed.

What is causing the undefined symbol errors?

Is it related to the fact that my ble_evt_dispatch function is never called, even though i use

NRF_SDH_BLE_OBSERVER(m_ble_observer, APP_BLE_OBSERVER_PRIO, ble_evt_dispatch, NULL);
  • Hi goldwake,

    I just faced a similar problem yesterday when upgrading to SDK14 but I am using the GNU ARM GCC toolchain. The problem was that the NRF_SDH_BLE_OBSERVER macro is declaring variables as extern. So these variables need to be defined in the linker script for the symbols to be recognized.

    I'm not sure what the syntax is for the toolchain you're using but this is what I had to add to my linker script (gcc_nrf52.ld) to fix this:

      .sdh_stack_observers :
      {
        PROVIDE(__start_sdh_stack_observers = .);
        KEEP(*(SORT(.sdh_stack_observers*)))
        PROVIDE(__stop_sdh_stack_observers = .);
      } > FLASH
    
      .sdh_req_observers :
      {
        PROVIDE(__start_sdh_req_observers = .);
        KEEP(*(SORT(.sdh_req_observers*)))
        PROVIDE(__stop_sdh_req_observers = .);
      } > FLASH
    
      .sdh_ant_observers :
      {
        PROVIDE(__start_sdh_ant_observers = .);
        KEEP(*(SORT(.sdh_ant_observers*)))
        PROVIDE(__stop_sdh_ant_observers = .);
      } > FLASH
    
      .sdh_state_observers :
      {
        PROVIDE(__start_sdh_state_observers = .);
        KEEP(*(SORT(.sdh_state_observers*)))
        PROVIDE(__stop_sdh_state_observers = .);
      } > FLASH
    
      .sdh_ble_observers :
      {
        PROVIDE(__start_sdh_ble_observers = .);
        KEEP(*(SORT(.sdh_ble_observers*)))
        PROVIDE(__stop_sdh_ble_observers = .);
      } > FLASH
    
      .sdh_soc_observers :
      {
        PROVIDE(__start_sdh_soc_observers = .);
        KEEP(*(SORT(.sdh_soc_observers*)))
        PROVIDE(__stop_sdh_soc_observers = .);
      } > FLASH
    

    Hope this helps!

  • Thanks for the info, I haven't got a fix for armcc yet. All of the examples i've checked suppress the warning in the linker tab of project options by using

    --diag_suppress 6330
    

    If i remove that, I get similar warnings.

  • Hi goldwake,

    I have been having the same issue as you I think. Ultimately some of the linker warnings can be ignored (for any observer sets that are not being used by your code), but, if the sections and section references aren't being linked correctly, then ignoring them will be ignoring a real problem.

    For me, I was getting the same linker warnings you were, e.g.

    Undefined symbol sdh_ble_observers$$Base
    Undefined symbol sdh_ble_observers$$Limit
    

    if you remove the --diag_suppress 6330 and compile one of the SDK examples, e.g. examples\ble_peripheral\ble_app_hrs\pca10040\s132\arm5_no_packs

    you can see that the linker warnigns are different:

    .\_build\nrf52832_xxaa.axf: Warning: L6330W: Undefined symbol sdh_req_observers1$$Base (referred from nrf_sdh.o). Unused section has been removed.
    .\_build\nrf52832_xxaa.axf: Warning: L6330W: Undefined symbol sdh_req_observers1$$Limit (referred from nrf_sdh.o). Unused section has been removed.
    .\_build\nrf52832_xxaa.axf: Warning: L6330W: Undefined symbol sdh_stack_observers1$$Base (referred from nrf_sdh.o). Unused section has been removed.
    .\_build\nrf52832_xxaa.axf: Warning: L6330W: Undefined symbol sdh_stack_observers1$$Limit (referred from nrf_sdh.o). Unused section has been removed.
    .\_build\nrf52832_xxaa.axf: Warning: L6330W: Undefined symbol sdh_state_observers1$$Base (referred from nrf_sdh.o). Unused section has been removed.
    .\_build\nrf52832_xxaa.axf: Warning: L6330W: Undefined symbol sdh_state_observers1$$Limit (referred from nrf_sdh.o). Unused section has been removed.
    

    you can see that the section names always have a 1 suffix, and the observers that are actually used are not generating warnings.

    For me, the issue was having --gnu specified in the "Misc Controls" textbox in C/C++ tab. Removing that seems to have corrected the underlying issue for me, and now only unused observer sets generate the linker warnings.

    Hope that might help someone!

Related