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

Segger Embedded Studio Link Errors - Undefined References

First - thanks to those who answered my question about the Segger Embedded Studio code size limit.  It appears to have be fixed when I switch the build configuration from "Internal and External" to just "Internal".  

This question may relate to the SDK rather than the Segger Embedded Studio, but my project did compile, link, and run with IAR and now I am getting these link errors with SES.  

Linking hm_chair.elf

_build/nrf_sdh.o:(.rodata.sdh_req_observers+0x0): undefined reference to `__start_sdh_req_observers'

_build/nrf_sdh.o:(.rodata.sdh_req_observers+0x4): undefined reference to `__stop_sdh_req_observers'

_build/nrf_sdh.o:(.rodata.sdh_state_observers+0x0): undefined reference to `__start_sdh_state_observers'

_build/nrf_sdh.o:(.rodata.sdh_state_observers+0x4): undefined reference to `__stop_sdh_state_observers'

  • The one being used should be in the sidebar somewhere in all the project settings. Usually it starts as the 'generic' one and you can right click to import it locally into your project where it copies it and sets it as the one it's going to use, you can then edit it. 

    If you head far enough into the actual build transcript you should find the command which uses the flash placement and other files to generate the linker file. Then you can see what it's actually using. 

  • RK Thanks much for the help - I now have a build that links without errors. My confusion was coming from two places.  First, the flash_placement.xml I had copied to the code directory was not being used.  The Project->Options->Linker-> Section Placement File was actually pointing to a directory a couple layers down in my project source rather than where I might have expected.  Modifying that xml file with the two <Program Section...> lines in my post three above this one eliminated the four linker errors.  I can now happily build in Segger above the 32K IAR Kickstarter limit, which was my main motivation for evaluating this tool.

    A second confusion source that held me up longer that I would have liked is that the Project->Options->Section Placement File indicated actually changes once the Import is done.  The imported file line was showing a file named "section_placement.xml", and when I couldn't find a file by that name I got further confused.

  • Pleased you got it going. There are a few things in SES you ‘just have to know’ and the flash settings stuff is rarely needed so rarely do you have to go there. 

    It’s worth looking at the project files, they are just XML anyway, they are sometimes easier to read than the GUI if you’re looking for stuff and you can edit them too, I often start projects that way. 

Related