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

DFU customize

Hello.

During customizing a DFU, but I'm having trouble adding function [nrf_dfu_transports_close] in function [on_ctrl_pt_write].

I'm not now fetching all the c files, only the functions I need.

When I compile I get the following error. Why is that?

section .dfu_trans LMA [0000000000038700,0000000000038707] overlaps section .data LMA [0000000000038700,0000000000038937]

compiler : eclipse(gcc)

mcu : nRF52840

Parents Reply Children
  • If you're not able to upload the .ld file to the case, then please just copy the content of the file and paste it in a "Insert Code" block. (Click Insert -> Insert Code below)

  • There is not nrf52840.ld file attached to this case. 

  • Hi bjorn, I have been busy for the last 3 months.

    I attached .ld file.

    Please check it.

    /* This file is compiler dependent */
    
    /* Entry Point */
    ENTRY(Reset_Handler)
    
    /* Generate a link error if heap and stack don't fit into RAM */
    _start_and_int_stack_size = 0x800; /* Required amount of stack. This NEEDS to be at least 0x800, do not decrease. */
    
    /* The firmware header, used by the application that downloads/programs this application, resides right after
     * the vector table. It would perhaps make more sense to have it first, but the vector table must be aligned 
     * on even 512 bytes, so in order to save some flash memory the header is placed after the vector table.
     */
    _header_start_offset        = 0x200;
    
    /* Specify the memory areas */
    
    MEMORY
    {
      FLASH (rx)           : ORIGIN = 0x00026000, LENGTH = 0xAC000
      FW_FLASH_END         : ORIGIN = 0x000D2000, LENGTH = 0x0       /* end marker */
      STORAGE_DATA (r)     : ORIGIN = 0x000D2000, LENGTH = 0x4000    /* 4 x 4096 bytes */
      STORAGE_DATA_END (r) : ORIGIN = 0x000D6000, LENGTH = 0x0       /* end marker */
      SHARED_DATA (r)      : ORIGIN = 0x000FD000, LENGTH = 0x2000    /* 2 x 4096 bytes */
      SHARED_DATA_END (r)  : ORIGIN = 0x000FF000, LENGTH = 0x0       /* end marker */
      RAM_NVIC (rwx)       : ORIGIN = 0x20004600, LENGTH = 0x100
      RAM (rwx)            : ORIGIN = 0x20004700, LENGTH = (0x40000 - 0x4600 - 0x100 - 0x20 - 0x130)
      RAM_SHARED (rw)      : ORIGIN = 0x2003FEB0, LENGTH = 0x20
      PERSISTENT_RAM(xrw)  : ORIGIN = 0x2003FED0, LENGTH = 0x130
    }
    
    
    SECTIONS
    {
      .text :
      {
        KEEP(*(.isr_vector))    /*  vector table (code) */
                    
        . = _header_start_offset;
        *(.fw_header)           /* Header information of next FW */
        KEEP(*(.fw_header))
    
        . = ALIGN(4);
        *(.text)                /* .text sections (code) */
        *(.text*)               /* .text* sections (code) */
        *(.rodata)              /* .rodata sections (constants, strings, etc.) */
        *(.rodata*)             /* .rodata* sections (constants, strings, etc.) */
        *(.glue_7)              /* glue arm to thumb code */
        *(.glue_7t)             /* glue thumb to arm code */
        *(.eh_frame)
     
        KEEP(*(.init))
        KEEP(*(.fini))
    
        . = ALIGN(4);
        _etext = .;        /* define a global symbols at end of code */
      } > FLASH
     
      /* Names beginning .ARM.exidx name sections containing index entries for section unwinding. 
       * Names beginning .ARM.extab name sections containing exception unwinding information.   */
      .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
      .ARM : {
         __exidx_start = .;
        *(.ARM.exidx*)
        __exidx_end = .;
      } >FLASH
            
      .note.gnu.build-id : 
      { 
        PROVIDE( __gnuBuildId = . );
        *(.note.gnu.build-id) 
      } > FLASH
        
      .systemControlInitList :
      {
        PROVIDE( __systemControlInitList_start = . );
        KEEP( *(.systemControlInitList))
        PROVIDE( __systemControlInitList_end = . );
      } >FLASH
    
      .mbsConsoleCmdList :
      {
        PROVIDE( __mbsConsoleCmdList_start = . );
        KEEP( *(.mbsConsoleCmdList))
        PROVIDE( __mbsConsoleCmdList_end = . );
      } >FLASH
    
      .systemControlEvHandlerList :
      {
        PROVIDE( __systemControlEvHandlerList_start = . );
        KEEP( *(.systemControlEvHandlerList))
        PROVIDE( __systemControlEvHandlerList_end = . );
      } >FLASH
    
      .eventDispatcherList :
      {
        PROVIDE( __eventDispatcherList_start = . );
        KEEP( *(.eventDispatcherList))
        PROVIDE( __eventDispatcherList_end = . );
      } >FLASH
      
      .sdh_soc_observers :
      {
        PROVIDE(__start_sdh_soc_observers = .);
        KEEP(*(SORT(.sdh_soc_observers*)))
        PROVIDE(__stop_sdh_soc_observers = .);
      } > FLASH
    
      .pwr_mgmt_data :
      {
        PROVIDE(__start_pwr_mgmt_data = .);
        KEEP(*(SORT(.pwr_mgmt_data*)))
        PROVIDE(__stop_pwr_mgmt_data = .);
      } > FLASH
      .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_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
      
      __etext = .;
      
      .storageData :
      {
        __STORAGE_DATA_START__ = .; /* define global symbol for end of storage data section. */  
      } >STORAGE_DATA
    
      .storageDataEnd :
      {
        __STORAGE_DATA_END__ = .; /* define global symbol for start of storage data section. */  
      } >STORAGE_DATA_END
    
      .sharedData :
      {
        __SHARED_DATA_START__ = .; /* define global symbol for start of shared data section. */  
      } >SHARED_DATA
      
      .sharedDataEnd :
      {
        __SHARED_DATA_END__ = .; /* define global symbol for end of shared data section. */  
      } >SHARED_DATA_END
      
      .data : AT (__etext)
      {
        . = ALIGN(4);
        _sdata = .;        /* create a global symbol at data start */
        __data_start__ = .;
        *(.data)           /* .data sections */
        *(.data*)
        *(.RamFunc)        /* .RamFunc sections */
        
        . = ALIGN(4);
        _edata = .;        /* define a global symbol at data end */
      } > RAM
    
      .bss :
      {
        . = ALIGN(4);
        _sbss = .;         /* define a global symbol at bss start */
        __bss_start__ = _sbss;
        *(.bss)
        *(.bss*)
        *(COMMON)
    
        . = ALIGN(4);
        _ebss = .;         /* define a global symbol at bss end */
        __bss_end__ = _ebss;
      } > RAM
      
      PROVIDE ( end = _ebss );
      PROVIDE ( _end = _ebss );
    
      .nvictable (NOLOAD) :
      {
        PROVIDE(__start_nvictable = .);
        KEEP(*(.nvictable))
        PROVIDE(__stop_nvictable = .);
      } > RAM_NVIC
    
      .noinit (NOLOAD) :
      {
        PROVIDE(__start_noinit = .);
        KEEP(*(.noinit))
        PROVIDE(__stop_noinit = .);
      } > RAM
      
      /* Start_and_int_stack section
       * NOTE this is only used to check that there is enough RAM left,
       * the stack will in reality be located elsewhere so that it starts at the highest 
       * address _estack and ends at (_estack - _start_and_int_stack_size)
       */
       
      ._start_and_int_stack_size_reservation :
      {
        . = ALIGN(4);
        . = . + _start_and_int_stack_size;
        . = ALIGN(4);
      } >RAM
         
      .intBinRamVarsSection (NOLOAD) :
      {
        . = ALIGN(4);
        *(.intBinRamVarsSection)
        . = ALIGN(4);
      } >RAM_SHARED
      
      /* Persistent (not even zeroed) RAM section */
      .persistent_ram (NOLOAD) :
      {
        *(.persistent_ram)
      } >PERSISTENT_RAM
        
        /* Set the stack top to the end of RAM and move down the stack limit by
         * the size of the stack_dummy section. */
        __StackTop = ORIGIN(RAM) + LENGTH(RAM);
        __StackLimit = __StackTop - SIZEOF(._start_and_int_stack_size_reservation);
        PROVIDE(__stack = __StackTop);
    
      /* Remove information from the standard libraries */
      /DISCARD/ :      
      {                
        libc.a ( * )
        libm.a ( * )
        libgcc.a ( * )
      }
      /* Build attributes are encoded in a section of type SHT_ARM_ATTRIBUTES, and name .ARM.attributes. */
      .ARM.attributes 0 : { *(.ARM.attributes) }
    }
    

  • Are you using the Makefile from the SDK example to compile the bootloader project?  Below is the default linker script for our Bootloader example project. In your linker script there appears to be a lot of sections missing.

    /* Linker script to configure memory regions. */
    
    SEARCH_DIR(.)
    GROUP(-lgcc -lc -lnosys)
    
    MEMORY
    {
      FLASH (rx) : ORIGIN = 0xf8000, LENGTH = 0x6000
      RAM (rwx) :  ORIGIN = 0x200057b8, LENGTH = 0x3a848
      uicr_bootloader_start_address (r) : ORIGIN = 0x00000FF8, LENGTH = 0x4
      bootloader_settings_page (r) : ORIGIN = 0x000FF000, LENGTH = 0x1000
      uicr_mbr_params_page (r) : ORIGIN = 0x00000FFC, LENGTH = 0x4
      mbr_params_page (r) : ORIGIN = 0x000FE000, LENGTH = 0x1000
    }
    
    SECTIONS
    {
      . = ALIGN(4);
      .uicr_bootloader_start_address :
      {
        PROVIDE(__start_uicr_bootloader_start_address = .);
        KEEP(*(SORT(.uicr_bootloader_start_address*)))
        PROVIDE(__stop_uicr_bootloader_start_address = .);
      } > uicr_bootloader_start_address
      . = ALIGN(4);
      .bootloader_settings_page(NOLOAD) :
      {
        PROVIDE(__start_bootloader_settings_page = .);
        KEEP(*(SORT(.bootloader_settings_page*)))
        PROVIDE(__stop_bootloader_settings_page = .);
      } > bootloader_settings_page
      . = ALIGN(4);
      .uicr_mbr_params_page :
      {
        PROVIDE(__start_uicr_mbr_params_page = .);
        KEEP(*(SORT(.uicr_mbr_params_page*)))
        PROVIDE(__stop_uicr_mbr_params_page = .);
      } > uicr_mbr_params_page
      . = ALIGN(4);
      .mbr_params_page(NOLOAD) :
      {
        PROVIDE(__start_mbr_params_page = .);
        KEEP(*(SORT(.mbr_params_page*)))
        PROVIDE(__stop_mbr_params_page = .);
      } > mbr_params_page
    }
    
    SECTIONS
    {
      . = ALIGN(4);
      .mem_section_dummy_ram :
      {
      }
      .log_dynamic_data :
      {
        PROVIDE(__start_log_dynamic_data = .);
        KEEP(*(SORT(.log_dynamic_data*)))
        PROVIDE(__stop_log_dynamic_data = .);
      } > RAM
      .log_filter_data :
      {
        PROVIDE(__start_log_filter_data = .);
        KEEP(*(SORT(.log_filter_data*)))
        PROVIDE(__stop_log_filter_data = .);
      } > RAM
      .fs_data :
      {
        PROVIDE(__start_fs_data = .);
        KEEP(*(.fs_data))
        PROVIDE(__stop_fs_data = .);
      } > RAM
    
    } INSERT AFTER .data;
    
    SECTIONS
    {
      .mem_section_dummy_rom :
      {
      }
      .crypto_data :
      {
        PROVIDE(__start_crypto_data = .);
        KEEP(*(SORT(.crypto_data*)))
        PROVIDE(__stop_crypto_data = .);
      } > FLASH
        .nrf_queue :
      {
        PROVIDE(__start_nrf_queue = .);
        KEEP(*(.nrf_queue))
        PROVIDE(__stop_nrf_queue = .);
      } > FLASH
      .dfu_trans :
      {
        PROVIDE(__start_dfu_trans = .);
        KEEP(*(SORT(.dfu_trans*)))
        PROVIDE(__stop_dfu_trans = .);
      } > FLASH
        .svc_data :
      {
        PROVIDE(__start_svc_data = .);
        KEEP(*(.svc_data))
        PROVIDE(__stop_svc_data = .);
      } > FLASH
      .log_const_data :
      {
        PROVIDE(__start_log_const_data = .);
        KEEP(*(SORT(.log_const_data*)))
        PROVIDE(__stop_log_const_data = .);
      } > FLASH
        .nrf_balloc :
      {
        PROVIDE(__start_nrf_balloc = .);
        KEEP(*(.nrf_balloc))
        PROVIDE(__stop_nrf_balloc = .);
      } > FLASH
      .sdh_ble_observers :
      {
        PROVIDE(__start_sdh_ble_observers = .);
        KEEP(*(SORT(.sdh_ble_observers*)))
        PROVIDE(__stop_sdh_ble_observers = .);
      } > FLASH
      .log_backends :
      {
        PROVIDE(__start_log_backends = .);
        KEEP(*(SORT(.log_backends*)))
        PROVIDE(__stop_log_backends = .);
      } > FLASH
      .sdh_req_observers :
      {
        PROVIDE(__start_sdh_req_observers = .);
        KEEP(*(SORT(.sdh_req_observers*)))
        PROVIDE(__stop_sdh_req_observers = .);
      } > FLASH
      .sdh_state_observers :
      {
        PROVIDE(__start_sdh_state_observers = .);
        KEEP(*(SORT(.sdh_state_observers*)))
        PROVIDE(__stop_sdh_state_observers = .);
      } > FLASH
      .sdh_stack_observers :
      {
        PROVIDE(__start_sdh_stack_observers = .);
        KEEP(*(SORT(.sdh_stack_observers*)))
        PROVIDE(__stop_sdh_stack_observers = .);
      } > FLASH
      .sdh_soc_observers :
      {
        PROVIDE(__start_sdh_soc_observers = .);
        KEEP(*(SORT(.sdh_soc_observers*)))
        PROVIDE(__stop_sdh_soc_observers = .);
      } > FLASH
    
    } INSERT AFTER .text
    
    
    INCLUDE "nrf_common.ld"
    

Related