Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Add usb bootloader to ble bootloader.

Dear Nordic Engineers

I would like to add usb bootloader to ble bootloader.

I modify config of pca10056_usb_debug/sdk_config.h and  add .c .h file of  pca10056_usb_debug to pca10056_s140_ble.

After I  encounter some errors:

Building ‘secure_bootloader_ble_s140_pca10056_debug’ from solution ‘secure_bootloader_ble_s140_pca10056_debug’ in configuration ‘Release’
Generating linker script ‘secure_bootloader_ble_s140_pca10056_debug.ld’
Linking secure_bootloader_ble_s140_pca10056_debug.elf
.rodata is too large to fit in FLASH1 memory segment
.data is too large to fit in FLASH1 memory segment
section .tdata overlaps absolute placed section .mbr_params_page
section .mbr_params_page VMA [00000000000fe000,00000000000fefff] overlaps section .text VMA [00000000000f13b8,00000000000fe52b]
section .crypto_data VMA [00000000000fe52c,00000000000fe533] overlaps section .mbr_params_page VMA [00000000000fe000,00000000000fefff]
section .bootloader_settings_page VMA [00000000000ff000,00000000000fffff] overlaps section .rodata VMA [00000000000fe6c0,0000000000102a7b]
Build failed

This is my flash.xml file.

<!DOCTYPE Linker_Placement_File>
<Root name="Flash Section Placement">
  <MemorySegment name="FLASH1" start="$(FLASH_PH_START)" size="$(FLASH_PH_SIZE)">
    <ProgramSection load="no" name=".reserved_flash" start="$(FLASH_PH_START)" size="$(FLASH_START)-$(FLASH_PH_START)" />
    <ProgramSection alignment="0x100" load="Yes" name=".vectors" start="$(FLASH_START)" />
    <ProgramSection alignment="4" load="Yes" name=".init" />
    <ProgramSection alignment="4" load="Yes" name=".init_rodata" />
    <ProgramSection alignment="4" load="Yes" name=".text" size="0x4" />
    <ProgramSection alignment="4" keep="Yes" load="Yes" name=".crypto_data" inputsections="*(SORT(.crypto_data*))" address_symbol="__start_crypto_data" end_symbol="__stop_crypto_data" />
    <ProgramSection alignment="4" keep="Yes" load="Yes" name=".nrf_queue" inputsections="*(.nrf_queue*)" address_symbol="__start_nrf_queue" end_symbol="__stop_nrf_queue" />
    <ProgramSection alignment="4" keep="Yes" load="Yes" name=".dfu_trans" inputsections="*(SORT(.dfu_trans*))" address_symbol="__start_dfu_trans" end_symbol="__stop_dfu_trans" />
    <ProgramSection alignment="4" keep="Yes" load="Yes" name=".svc_data" inputsections="*(.svc_data*)" address_symbol="__start_svc_data" end_symbol="__stop_svc_data" />
    <ProgramSection alignment="4" keep="Yes" load="Yes" name=".log_const_data" inputsections="*(SORT(.log_const_data*))" address_symbol="__start_log_const_data" end_symbol="__stop_log_const_data" />
    <ProgramSection alignment="4" keep="Yes" load="Yes" name=".nrf_balloc" inputsections="*(.nrf_balloc*)" address_symbol="__start_nrf_balloc" end_symbol="__stop_nrf_balloc" />
    <ProgramSection alignment="4" keep="Yes" load="Yes" name=".log_backends" inputsections="*(SORT(.log_backends*))" address_symbol="__start_log_backends" end_symbol="__stop_log_backends" />
    <ProgramSection alignment="4" keep="Yes" load="Yes" name=".sdh_ble_observers" inputsections="*(SORT(.sdh_ble_observers*))" address_symbol="__start_sdh_ble_observers" end_symbol="__stop_sdh_ble_observers" />
    <ProgramSection alignment="4" keep="Yes" load="Yes" name=".sdh_req_observers" inputsections="*(SORT(.sdh_req_observers*))" address_symbol="__start_sdh_req_observers" end_symbol="__stop_sdh_req_observers" />
    <ProgramSection alignment="4" keep="Yes" load="Yes" name=".sdh_state_observers" inputsections="*(SORT(.sdh_state_observers*))" address_symbol="__start_sdh_state_observers" end_symbol="__stop_sdh_state_observers" />
    <ProgramSection alignment="4" keep="Yes" load="Yes" name=".sdh_stack_observers" inputsections="*(SORT(.sdh_stack_observers*))" address_symbol="__start_sdh_stack_observers" end_symbol="__stop_sdh_stack_observers" />
    <ProgramSection alignment="4" keep="Yes" load="Yes" name=".sdh_soc_observers" inputsections="*(SORT(.sdh_soc_observers*))" address_symbol="__start_sdh_soc_observers" end_symbol="__stop_sdh_soc_observers" />
    <ProgramSection alignment="4" keep="Yes" load="No" name=".nrf_sections" address_symbol="__start_nrf_sections" />
    <ProgramSection alignment="4" keep="Yes" load="Yes" name=".log_dynamic_data"  inputsections="*(SORT(.log_dynamic_data*))" runin=".log_dynamic_data_run"/>
    <ProgramSection alignment="4" keep="Yes" load="Yes" name=".log_filter_data"  inputsections="*(SORT(.log_filter_data*))" runin=".log_filter_data_run"/>
    <ProgramSection alignment="4" keep="Yes" load="Yes" name=".fs_data"  inputsections="*(.fs_data*)" runin=".fs_data_run"/>
    <ProgramSection alignment="4" load="Yes" name=".dtors" />
    <ProgramSection alignment="4" load="Yes" name=".ctors" />
    <ProgramSection alignment="4" load="Yes" name=".rodata" size="0x4" />
    <ProgramSection alignment="4" load="Yes" name=".ARM.exidx" address_symbol="__exidx_start" end_symbol="__exidx_end" />
    <ProgramSection alignment="4" load="Yes" runin=".fast_run" name=".fast" />
    <ProgramSection alignment="4" load="Yes" runin=".data_run" name=".data" />
    <ProgramSection alignment="4" load="Yes" runin=".tdata_run" name=".tdata" />
    <ProgramSection alignment="4" keep="Yes" load="No" name=".mbr_params_page" address_symbol="__start_mbr_params_page" end_symbol="__stop_mbr_params_page" start = "0x000FE000" size="0x1000" />
    <ProgramSection alignment="4" keep="Yes" load="No" name=".bootloader_settings_page" address_symbol="__start_bootloader_settings_page" end_symbol="__stop_bootloader_settings_page" start = "0x000FF000" size="0x1000" />
  </MemorySegment>
  <MemorySegment name="RAM1" start="$(RAM_PH_START)" size="$(RAM_PH_SIZE)">
    <ProgramSection load="no" name=".reserved_ram" start="$(RAM_PH_START)" size="$(RAM_START)-$(RAM_PH_START)" />
    <ProgramSection alignment="0x100" load="No" name=".vectors_ram" start="$(RAM_START)" address_symbol="__app_ram_start__"/>
    <ProgramSection alignment="4" keep="Yes" load="No" name=".nrf_sections_run" address_symbol="__start_nrf_sections_run" />
    <ProgramSection alignment="4" keep="Yes" load="No" name=".log_dynamic_data_run" address_symbol="__start_log_dynamic_data" end_symbol="__stop_log_dynamic_data" />
    <ProgramSection alignment="4" keep="Yes" load="No" name=".log_filter_data_run" address_symbol="__start_log_filter_data" end_symbol="__stop_log_filter_data" />
    <ProgramSection alignment="4" keep="Yes" load="No" name=".fs_data_run" address_symbol="__start_fs_data" end_symbol="__stop_fs_data" />
    <ProgramSection alignment="4" keep="Yes" load="No" name=".nrf_sections_run_end" address_symbol="__end_nrf_sections_run" />
    <ProgramSection alignment="4" load="No" name=".fast_run" />
    <ProgramSection alignment="4" load="No" name=".data_run" />
    <ProgramSection alignment="4" load="No" name=".tdata_run" />
    <ProgramSection alignment="4" load="No" name=".bss" />
    <ProgramSection alignment="4" load="No" name=".tbss" />
    <ProgramSection alignment="4" load="No" name=".non_init" />
    <ProgramSection alignment="4" size="__HEAPSIZE__" load="No" name=".heap" />
    <ProgramSection alignment="8" size="__STACKSIZE__" load="No" place_from_segment_end="Yes" name=".stack"  address_symbol="__StackLimit" end_symbol="__StackTop"/>
    <ProgramSection alignment="8" size="__STACKSIZE_PROCESS__" load="No" name=".stack_process" />
  </MemorySegment>
  <MemorySegment name="uicr_bootloader_start_address" start="0x10001014" size="0x4">
    <ProgramSection alignment="4" keep="Yes" load="Yes" name=".uicr_bootloader_start_address" address_symbol="__start_uicr_bootloader_start_address" end_symbol="__stop_uicr_bootloader_start_address" start = "0x10001014" size="0x4" />
  </MemorySegment>
  <MemorySegment name="uicr_mbr_params_page" start="0x10001018" size="0x4">
    <ProgramSection alignment="4" keep="Yes" load="Yes" name=".uicr_mbr_params_page" address_symbol="__start_uicr_mbr_params_page" end_symbol="__stop_uicr_mbr_params_page" start = "0x10001018" size="0x4" />
  </MemorySegment>
</Root>

Pls. give some good suggestion on how to solve these errors?

I will share this program to help other people.when this program is solved.

Best regrads.

Parents
  • Hi Wang, 

    Could you let me know what exactly you did by " pca10056_usb_debug/sdk_config.h and  add .c .h file of  pca10056_usb_debug to pca10056_s140_ble."  ? 

    The error is suggesting that the flash size configure for the bootloader is not enough to handle both the USB and BLE transport layer. 


    What you need to do is to increase the size of the bootloader. To do that you need to move the start address of the bootloader down, for example instead of

    FLASH_START=0xf8000

    FLASH_SIZE=0x6000

    You can change it to 

    FLASH_START=0xf6000

    FLASH_SIZE=0x8000

  • Dear Bui

    The following file is my project.

    I will try to change to

    FLASH_START=0xf6000

    FLASH_SIZE=0x8000

    It displays some new errors:

    Building ‘secure_bootloader_ble_s140_pca10056_debug’ from solution ‘secure_bootloader_ble_s140_pca10056_debug’ in configuration ‘Release’
    Generating linker script ‘secure_bootloader_ble_s140_pca10056_debug.ld’
    Linking secure_bootloader_ble_s140_pca10056_debug.elf
    .text is too large to fit in FLASH1 memory segment
    .crypto_data is too large to fit in FLASH1 memory segment
    .dfu_trans is too large to fit in FLASH1 memory segment
    .svc_data is too large to fit in FLASH1 memory segment
    .log_const_data is too large to fit in FLASH1 memory segment
    .nrf_balloc is too large to fit in FLASH1 memory segment
    .log_backends is too large to fit in FLASH1 memory segment
    .sdh_ble_observers is too large to fit in FLASH1 memory segment
    .sdh_req_observers is too large to fit in FLASH1 memory segment
    .sdh_state_observers is too large to fit in FLASH1 memory segment
    .sdh_stack_observers is too large to fit in FLASH1 memory segment
    .sdh_soc_observers is too large to fit in FLASH1 memory segment
    .fs_data is too large to fit in FLASH1 memory segment
    .rodata is too large to fit in FLASH1 memory segment
    .data is too large to fit in FLASH1 memory segment
    section .tdata overlaps absolute placed section .mbr_params_page
    section .mbr_params_page VMA [00000000000fe000,00000000000fefff] overlaps section .text VMA [00000000000f63b8,000000000010352b]
    Build failed

    Please give me some good suggestion.

    Best regards.

    7416.sdk_config.h4572.ses.zip

  • Hi Wang, 


    Have you tried to increase the flash more ? 

    Note that if you use Oberon library it will require more flash space. 

    Please state the SDK version you are using. 

  • Dear Bui

    I use NRF5 SDK 17.1.0.I will try to increase the flash more.

    Please help me review my project.Does it have other problem?

    Thank you

    Best regards.

  • I tried to build your project but it got another issue: 

    I would suggest you to have a look at this case:  Official BLE and UART Combined DFU bootloader? There is an instruction on how to do it. 

    And I also made an example here , it's for UART and BLE in SDK v15.2 but it's a good source of reference. 

Reply Children
No Data
Related