Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Build Error Undefined Reference to `__start_dfu_trans'

I am trying to add DFU to my project, so I merged in the code from the example in the SDK as follows:

  1. I included the same .c files as the example project
  2. I copied over the flash_placement.xml file
  3. I merged the preprocessor defines
  4. I copied over the linker_section_placement_segments from the example project into my project
  5. I copied over the linker_section_placement_macros from the example project into my project
  6. I carefully merged the sdk_config.h files

When I build the compile process happens as expected, but I get some linker errors that I cannot figure out!

1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.10b/gcc/arm-none-eabi/bin/ld: Output/Release/Exe/Dynojet_PV4.elf section `.dfu_trans' will not fit in region `UNPLACED_SECTIONS'
1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.10b/gcc/arm-none-eabi/bin/ld: region `UNPLACED_SECTIONS' overflowed by 8200 bytes
1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.10b/gcc/arm-none-eabi/bin/ld: Output/Release/Obj/Dynojet_PV4/nrf_dfu_transport.o: in function `nrf_dfu_transports_init':
1> D:\Projects\Dynojet PV4\SDK\components\libraries\bootloader\dfu/nrf_dfu_transport.c:57: undefined reference to `__start_dfu_trans'
1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.10b/gcc/arm-none-eabi/bin/ld: D:\Projects\Dynojet PV4\SDK\components\libraries\bootloader\dfu/nrf_dfu_transport.c:57: undefined reference to `__stop_dfu_trans'
1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.10b/gcc/arm-none-eabi/bin/ld: Output/Release/Obj/Dynojet_PV4/nrf_dfu_transport.o: in function `nrf_dfu_transports_close':
1> D:\Projects\Dynojet PV4\SDK\components\libraries\bootloader\dfu/nrf_dfu_transport.c:79: undefined reference to `__start_dfu_trans'
1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.10b/gcc/arm-none-eabi/bin/ld: D:\Projects\Dynojet PV4\SDK\components\libraries\bootloader\dfu/nrf_dfu_transport.c:79: undefined reference to `__stop_dfu_trans'
1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.10b/gcc/arm-none-eabi/bin/ld: Output/Release/Obj/Dynojet_PV4/nrf_svc_handler.o: in function `nrf_svc_handler_c':
1> D:\Projects\Dynojet PV4\SDK\components\libraries\svc/nrf_svc_handler.c:83: undefined reference to `__start_svc_data'
1> C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.10b/gcc/arm-none-eabi/bin/ld: D:\Projects\Dynojet PV4\SDK\components\libraries\svc/nrf_svc_handler.c:83: undefined reference to `__stop_svc_data'
Build failed

The __start_dfu_trans is defined in a macro, and that macro appears to be active. I also noticed that the .ld file that is generated on build has omitted this section (as well as the stop and the start/stop for the svc_data section)

I notice that in SES, the example the nrf_dfu_transport.c compiles with 228 bytes of code and 159 Data+RO. On my project it is merely 96 bytes and no Data+RO.

  • I found the issue...

    The linker_section_placement_segments had a value that was valid for the nRF52810, but not the nRF52832 I am now targeting. I pulled the correct value from another example and that left me with an error about an overlapping section. I did the same kind of thing with the flash_placement.xml file and found that there were some fixed addresses in there that were also different.

    Updating those left me with just one (different) linker error about __start_pwr_mgmt_data not being defined. I looked and the flash_placement.xml file was missing that section so I added that section.

    No more linker errors!

Related