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

DFU on custom board, memory problem

Hello,

Currently, I'm trying to flash my custom board that has nRF52832 with an uart application that I integrated buttonless DFU. I'm running into a problem where when I try to flash my hex file that has the following combination :

  • Softdevice
  • Bootloader
  • Application
  • Bootloader setting

I got the following error :

"ERROR: The file specified is not a valid hex file, has data outside valid areas"

"ERROR: or does not have data in valid areas."

From what I understand, it is an error on the memory side where my program might have passed its limit. But I don't know how to fix it. I'm not sure the type of model of my nRF52832, but on nRF Connect, it says that it is NRF52832_xxAB_REV1, Core RAM: 32KiB and Core ROM: 256KiB in pages of 4KiB. I'm using SES with SDK 16.0.0

  • For the debug bootloader, do I have to modify the section placement macros like in the example that you provided me?

    I also have another weird remark. With the previous application, if I don't have RTT Viewer on, it will not update successfully. But when I have RTT Viewer to see the log, it succeeds in doing the DFU. Is that normal?

  • Hello,

    Yes, you would have to modify the project settings. Look at the settings found in the project that I sent. 

     

    Fikri Saman said:
    I also have another weird remark. With the previous application, if I don't have RTT Viewer on, it will not update successfully. But when I have RTT Viewer to see the log, it succeeds in doing the DFU. Is that normal?

     Does this mean that you are doing a debug session in SES, or that you only close RTT viewer opened externally?

    The RTT viewer itself shouldn't matter, but if you run a debug session, that may affect the CLOCK. What is your clock configuration by the way? Do you have an external LFXTAL? I don't think I asked what kind of HW you are running this on.

    BR,

    Edvin

  • I modified the bootloader_debug with the settings that you sent me before and got the following errors :

    Does this mean that you are doing a debug session in SES, or that you only close RTT viewer opened externally?

    I actually don't know how to debug the bootloader via SES, that's why I used RTT viewer. It would be nice if you could point me in the right direction to debug with SES, please.

    What is your clock configuration by the way? Do you have an external LFXTAL? I don't think I asked what kind of HW you are running this on.

    I don't think I understand what you're demanding. Are you asking about my custom board or the equipment I used to program my custom board?

  • Fikri Saman said:
    I modified the bootloader_debug with the settings that you sent me before and got the following errors :

     What does your flash_placement.xml look like? And what does your project settings->Code->build->memory Segments setting look like? And what does your project settings->Code->linker->Section Placement Macros look like?

    And for the two last ones, remember to select "Common" before checking them:

     

    Fikri Saman said:
    I don't think I understand what you're demanding. Are you asking about my custom board or the equipment I used to program my custom board?

     I am asking about your custom board. Does it contain an LFXTAL? That would be the X2 in this figure:

    To run a debug session:

    If you set NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED to 0 in sdk_config, you will get the RTT output in Segger Embedded Studio.

    Best regards,

    Edvin

  • Here are my Section Placement Macros :

    My flash_placement.xml :

    <!DOCTYPE Linker_Placement_File>
    <Root name="Flash Section Placement">
      <MemorySegment name="FLASH" 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" />
        <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_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_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_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" />
        <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" />
      </MemorySegment>
      <MemorySegment name="RAM" 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="bootloader_settings_page" start="0x0003F000" 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 = "0x0003F000" size="0x1000" />
      </MemorySegment>
      <MemorySegment name="mbr_params_page" start="0x0003E000" size="0x1000">
        <ProgramSection alignment="4" keep="Yes" load="No" name=".mbr_params_page" address_symbol="__start_mbr_params_page" end_symbol="__stop_mbr_params_page" start = "0x0003E000" size="0x1000" />
      </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>
    

    My memory segments :

    FLASH RX 0x0 0x40000;RAM RWX 0x20000000 0x8000;uicr_bootloader_start_address RX 0x10001014 0x4;bootloader_settings_page RX 0x0003F000 0x1000;uicr_mbr_params_page RX 0x10001018 0x4;mbr_params_page RX 0x0003E000 0x1000

    They are all the same as the ones you sent me before and yet I still have these errors :

    Does it contain an LFXTAL?

    Yes, it does contain an LFXTAL.

    Concerning the debug session, if I run a debug session, wouldn't it erase the current program on my custom board? And which program do I have to run the debug session since there are the bootloader and the main application on my custom board

Related