<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>DFU linker settings in gcc</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/52459/dfu-linker-settings-in-gcc</link><description>Dear All 
 We implement a DFU over USB functionality to the custom board nrf52840 board by compiling via gcc. Somehow there is my understanding problem with the linker for bootloader and app. Here is the important part of the secure_bootloader.ld linker</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 30 Sep 2019 06:35:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/52459/dfu-linker-settings-in-gcc" /><item><title>RE: DFU linker settings in gcc</title><link>https://devzone.nordicsemi.com/thread/212444?ContentTypeID=1</link><pubDate>Mon, 30 Sep 2019 06:35:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c8ecc56-281a-4bfa-9cb2-0ce444eee7b2</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;You can flip bits from 1 to 0, but if the bits needs to be set from zero to 1, then you will have to trigger&amp;nbsp;&lt;span&gt;NRF_NVMC-&amp;gt;ERASEUICR before writing the new value. Note you should read back the all the UICR registers and write the modified values back to UICR.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;You should also note that&amp;nbsp;&lt;span&gt;NRF_NVMC-&amp;gt;ERASEUICR will be blocked when the Debug Access port is disabled, see&lt;/span&gt;&amp;nbsp;&lt;a title="Access port protection behavior" href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/nvmc.html?cp=3_0_0_3_2_5#concept_protection"&gt;Access port protection behavior&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU linker settings in gcc</title><link>https://devzone.nordicsemi.com/thread/212412?ContentTypeID=1</link><pubDate>Sun, 29 Sep 2019 19:17:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ed48556-e852-4be1-8621-bb36c2517bcf</guid><dc:creator>bilenemek</dc:creator><description>&lt;p&gt;Thanks, now I did understand, nrf_bootloader_info.h holds the info about the starting address. I was erasing UICR by correcting the voltage regulation, I do not know how to do this without NRF_NVMC-&amp;gt;ERASEUICR but this is a subject of another topic.&lt;/p&gt;
&lt;p&gt;Everything is running as expected.&lt;/p&gt;
&lt;p&gt;To your question about LEDs. The bootloader is fast, but slower than 50 ms (eye can see 20 frames per second), so it is a good indicator, at least for testing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU linker settings in gcc</title><link>https://devzone.nordicsemi.com/thread/212038?ContentTypeID=1</link><pubDate>Thu, 26 Sep 2019 11:57:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ef9b2f4-cf81-4e64-806d-7cf7f8323fe0</guid><dc:creator>bjorn-spockeli</dc:creator><description>[quote user="bilenemek"]Which part/command is writing the bootloader start address to the UICR? Is it the app (itself or its linker file) or flashing bootloader+settings?[/quote]
&lt;p&gt;&amp;nbsp;The bootloader start address is placed in the UICR register at address 0x10001014 in the bootloader project. THis is linked in to the bootloader hex so the bootloader start address is written to the UICR register when you flash the bootloader hex.&amp;nbsp;&lt;/p&gt;
[quote user="bilenemek"]As the first time after flashing bootloader starts, I assume that the app is deleting this information or erase the whole uicr. Is there any way to erase uicr or bootloader address from it by using the app?[/quote]
&lt;p&gt;No, the buttonless DFU example we have does not erase the UICR, otherwise the bootloader would not run on every boot.&amp;nbsp;The application should at not really erase the UICR, but it is possible to erase the UICR at runtime by writting to the&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/nvmc.html?cp=3_0_0_3_2_8#register.ERASEUICR"&gt;ERASEUICR&lt;/a&gt;&amp;nbsp;register in the NVMC peripheral.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="bilenemek"]I am using LEDs and not nrf logging (if I want to enable logging in the sdk, the linker complains that the size of the bootloader is bigger than the space reserved for it). LED triggering is very basic and directly in the very beginning of the main in the bootloader, please ignore the MBR part, now I know that I can clean it up, as follows:[/quote]
&lt;p&gt;&amp;nbsp;Ok, and you&amp;#39;re not seeing the LED light up? Is the same GPIO that is connected to the LED used in the applicaiton? Could it be that the jump from bootloader to application happens so fast that you&amp;#39;re not able to register it ? If so you should be able to check this with a logic analyzer or oscilloscope.&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU linker settings in gcc</title><link>https://devzone.nordicsemi.com/thread/211980?ContentTypeID=1</link><pubDate>Thu, 26 Sep 2019 08:37:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c2ea32c7-5e2a-4c6b-b52c-1d2cbfa22a2f</guid><dc:creator>bilenemek</dc:creator><description>&lt;p&gt;Thanks a lot for the clear explanation! Which part/command is writing the bootloader start address to the UICR? Is it the app (itself or its linker file) or flashing bootloader+settings? As the first time after flashing bootloader starts, I assume that the app is deleting this information or erase the whole uicr. Is there any way to erase uicr or bootloader address from it by using the app?&lt;/p&gt;
&lt;p&gt;I am using LEDs and not nrf logging (if I want to enable logging in the sdk, the linker complains that the size of the bootloader is bigger than the space reserved for it). LED triggering is very basic and directly in the very beginning of the main in the bootloader, please ignore the MBR part, now I know that I can clean it up, as follows:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;int main(void)
{

    nrf_gpio_cfg_output(RGB_BLUE_PIN);
    nrf_gpio_pin_write(RGB_BLUE_PIN, HIGH);

    uint32_t ret_val;

    // Write bootloader start address to the MBR
    ret_val = nrf_bootloader_write_bl_addr_to_mbr();
    APP_ERROR_CHECK(ret_val);
    // Protect MBR and bootloader code from being overwritten.
    ret_val = nrf_bootloader_flash_protect(0, MBR_SIZE, false);
    APP_ERROR_CHECK(ret_val);
    ret_val = nrf_bootloader_flash_protect(BOOTLOADER_START_ADDR, BOOTLOADER_SIZE, false);
    APP_ERROR_CHECK(ret_val);

    (void) NRF_LOG_INIT(app_timer_cnt_get);
    NRF_LOG_DEFAULT_BACKENDS_INIT();
    

    ret_val = nrf_bootloader_init(dfu_observer);
    APP_ERROR_CHECK(ret_val);

    // Either there was no DFU functionality enabled in this project or the DFU module detected
    // no ongoing DFU operation and found a valid main application.
    // Boot the main application.
    nrf_bootloader_app_start();

    // Should never be reached.
    NRF_LOG_INFO(&amp;quot;After main&amp;quot;);
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU linker settings in gcc</title><link>https://devzone.nordicsemi.com/thread/211971?ContentTypeID=1</link><pubDate>Thu, 26 Sep 2019 08:14:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a37a7bf3-ff96-4029-a78c-feca3126ed7b</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;[quote user="bilenemek"][/quote]&lt;/p&gt;
&lt;p&gt;Now I have this issue. After merging and flashing app+bootloader, the chip resets by opening first the boatloader and then starting the app, exactly as it should be. Then I use reset, but the bootloader never starts and it jumps directly to the app. I know this simply by using LEDs.&lt;/p&gt;
&lt;p&gt;I use the following restart methods (all not working):&lt;/p&gt;
&lt;p&gt;1. Hard reset, simply cutting off the power and back.&lt;/p&gt;
&lt;p&gt;2. Soft device reset, sd_nvic_SystemReset();&lt;/p&gt;
&lt;p&gt;3. Setting gp register and soft reset&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;The MBR will __always__&amp;nbsp; jump to the bootloader if the bootloader start address is written to UICR. So in all the above scenarios you should enter the bootloaders main(). Where in the bootloader code are you setting the LED?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="bilenemek"]--Apparently bootloader is a bit different than in a PC, it is not always starting, but we need to trigger it. Which part is doing this, may be MBR, then is the procedure above (please see the first post) somehow wrong that I overwrite MBR or some other part?[/quote]
&lt;p&gt;&amp;nbsp;As written above, the MBR will always jump to the bootloader&amp;#39;s vector table when the bootloader start address is written to UICR.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="bilenemek"]--App&amp;#39;s linker file has only the info of bootloader settings page, is this really enough? I wonder how the app knows the bootloader start address, here is the part from the nrf_bootloader_info.h that I am using[/quote]
&lt;p&gt;&amp;nbsp;The application does not need to know the bootloader start address as its the MBR that performs the jump on boot. The only thing the application needs to do is to signal the bootloader to stay in the bootloader and not jump to the application when&amp;nbsp; you nwat to update the firmware, e.g. by writting to the GPREGRET registers.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;[quote user="bilenemek"][/quote]&lt;/p&gt;
&lt;p&gt;--Is it possible to check the restart method 3 above? There are several different posts suggesting&lt;/p&gt;
&lt;p&gt;nrf_power_gpregret_set() over the sd_power_gpregret_set() or setting gpregret2 instead of gpregret.&lt;/p&gt;
&lt;p&gt;Which one is relly true or does it matter? I am using sdk 15.0 (with the patch you mentioned for 15.3 in the above link) and soft device s140 version 6.0.0 on a 52840 chip.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Yes, you should be able to run the bootloader in a debug session when you have the applicaiton and bl settings file flashed. Pressing start execution should cause the BL to jump to the application. After you can see the nRF advertising as the applicaiton you can then set a breakpoint in the BL main and then trigger the jump from app to bootloader. You should then see that you enter the bootloader main and dfu_enter_check() should evaluate to true.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The bootloader only checks GPREGRET, not GPREGRET2. Make sure that the GPREGRET enter mode is enabled in the sdk_config.h file in the bootloader, e.g.&amp;nbsp;NRF_BL_DFU_ENTER_METHOD_GPREGRET&lt;/p&gt;
&lt;p&gt;The patch for SDK v15.3.0 does not need to be applied in SDK v15.0.0 as the bootloader does not write the mbr params page address and the bootloader start address to the MBR region, only the UICR registers.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Best regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU linker settings in gcc</title><link>https://devzone.nordicsemi.com/thread/211923?ContentTypeID=1</link><pubDate>Wed, 25 Sep 2019 20:38:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d59521f6-ea20-4991-836e-406d257e605e</guid><dc:creator>bilenemek</dc:creator><description>&lt;p&gt;Hi Bj&amp;oslash;rn&lt;/p&gt;
&lt;p&gt;I did solve the mergehex problem by using some help from:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/IOsonata/IOsonata/blob/master/ARM/Nordic/nRF52/nRF52840/ldscript/"&gt;https://github.com/IOsonata/IOsonata/blob/master/ARM/Nordic/nRF52/nRF52840/ldscript/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;and now I am using the following in the linker file of the app:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;MEMORY
{
	FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0xda000
	RAM (rwx) :  ORIGIN = 0x20002220, LENGTH = 0x3DDE0
	NOINIT (rwx) :  ORIGIN = 0x20007F80, LENGTH = 0x80
	BOOTLOADER_SETTINGS (rw) : ORIGIN = 0x000FF000, LENGTH = 0x1000
}


SECTIONS
{
	.bootloaderSettings(NOLOAD) :
	{

	} &amp;gt; BOOTLOADER_SETTINGS
	.noinit(NOLOAD) :
	{

	} &amp;gt; NOINIT
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The mergehex is not complaining anymore and I can flash as expected.&lt;/p&gt;
&lt;p&gt;Now I have this issue. After merging and flashing app+bootloader, the chip resets by opening first the boatloader and then starting the app, exactly as it should be. Then I use reset, but the bootloader never starts and it jumps directly to the app. I know this simply by using LEDs.&lt;/p&gt;
&lt;p&gt;I use the following restart methods (all not working):&lt;/p&gt;
&lt;p&gt;1. Hard reset, simply cutting off the power and back.&lt;/p&gt;
&lt;p&gt;2. Soft device reset, sd_nvic_SystemReset();&lt;/p&gt;
&lt;p&gt;3. Setting gp register and soft reset&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;ret_code_t status = sd_power_gpregret_clr(0, 0xFF);

    if (status == NRF_SUCCESS)
     {
          status = sd_power_gpregret_set(0, BOOTLOADER_DFU_START);
     }

    if (status == NRF_SUCCESS)
     {
        nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_DFU);
     }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here are my concerns:&lt;/p&gt;
&lt;p&gt;--Apparently bootloader is a bit different than in a PC, it is not always starting, but we need to trigger it. Which part is doing this, may be MBR, then is the procedure above (please see the first post) somehow wrong that I overwrite MBR or some other part?&lt;/p&gt;
&lt;p&gt;--App&amp;#39;s linker file has only the info of bootloader settings page, is this really enough? I wonder how the app knows the bootloader start address, here is the part from the nrf_bootloader_info.h that I am using&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define BOOTLOADER_DFU_GPREGRET_MASK            (0xF8)      /**&amp;lt; Mask for GPGPREGRET bits used for the magic pattern written to GPREGRET register to signal between main app and DFU. */
#define BOOTLOADER_DFU_GPREGRET                 (0xB0)      /**&amp;lt; Magic pattern written to GPREGRET register to signal between main app and DFU. The 3 lower bits are assumed to be used for signalling purposes.*/
#define BOOTLOADER_DFU_START_BIT_MASK           (0x01)      /**&amp;lt; Bit mask to signal from main application to enter DFU mode using a buttonless service. */

#define BOOTLOADER_DFU_GPREGRET2_MASK           (0xF8)      /**&amp;lt; Mask for GPGPREGRET2 bits used for the magic pattern written to GPREGRET2 register to signal between main app and DFU. */
#define BOOTLOADER_DFU_GPREGRET2                (0xA8)      /**&amp;lt; Magic pattern written to GPREGRET2 register to signal between main app and DFU. The 3 lower bits are assumed to be used for signalling purposes.*/
#define BOOTLOADER_DFU_SKIP_CRC_BIT_MASK        (0x01)      /**&amp;lt; Bit mask to signal from main application that CRC-check is not needed for image verification. */


#define BOOTLOADER_DFU_START    (BOOTLOADER_DFU_GPREGRET | BOOTLOADER_DFU_START_BIT_MASK)      /**&amp;lt; Magic number to signal that bootloader should enter DFU mode because of signal from Buttonless DFU in main app.*/
#define BOOTLOADER_DFU_SKIP_CRC (BOOTLOADER_DFU_GPREGRET2 | BOOTLOADER_DFU_SKIP_CRC_BIT_MASK)  /**&amp;lt; Magic number to signal that CRC can be skipped due to low power modes.*/
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;--Is it possible to check the restart method 3 above? There are several different posts suggesting&lt;/p&gt;
&lt;p&gt;nrf_power_gpregret_set() over the sd_power_gpregret_set() or setting gpregret2 instead of gpregret.&lt;/p&gt;
&lt;p&gt;Which one is relly true or does it matter? I am using sdk 15.0 (with the patch you mentioned for 15.3 in the above link) and soft device s140 version 6.0.0 on a 52840 chip.&lt;/p&gt;
&lt;p&gt;Best, Emek&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU linker settings in gcc</title><link>https://devzone.nordicsemi.com/thread/211777?ContentTypeID=1</link><pubDate>Wed, 25 Sep 2019 11:08:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a5d06f9-e160-4b4b-9b40-d90cceef2c3d</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Bilen,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I apologize for not replying sooner.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So the application will occupy the area from&amp;nbsp;&lt;span&gt;0x26000 to&amp;nbsp;0xF0000 as&amp;nbsp;&lt;/span&gt;0x26000+0xCA000 = 0xF0000&lt;/p&gt;
&lt;p&gt;The bootloader starts at 0xF4000 and ends at 0xFE000, so there should not be any overlap between the the application and bootloader + settings page hex as there&amp;nbsp;are four 4kB flashpages in between&amp;nbsp;&lt;span&gt;0xF4000-&amp;nbsp;&lt;/span&gt;&lt;span&gt;0xF0000 = 0x4000 (16384bytes).&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So unless the application specifically places data above&amp;nbsp;0xF4000, then I dont see why mergehex complains about overlapping regions. I guess the only way to check is to look at the .map files for the compiled application and bootloader.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Bjørn&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU linker settings in gcc</title><link>https://devzone.nordicsemi.com/thread/211373?ContentTypeID=1</link><pubDate>Mon, 23 Sep 2019 18:00:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:06fd85d5-82c0-4958-9c17-f5081379eec6</guid><dc:creator>bilenemek</dc:creator><description>&lt;p&gt;Hi Bj&amp;oslash;rn&lt;/p&gt;
&lt;p&gt;Many thanks for your prompt reply.&lt;/p&gt;
&lt;p&gt;Merging bootloader with settings work fine. The problem is in merging bootloder_and_settings with the app. In this case I am using the generic_gcc...ld file (see above) with the flash&lt;/p&gt;
&lt;p&gt;FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0xca000&lt;/p&gt;
&lt;p&gt;such that it ends at 155648+827392 = 983040 byte, if I understand it correctly. Then the bootloader shall start, from secure_bootloader.ld (see above)&lt;/p&gt;
&lt;p&gt;FLASH (rx) : ORIGIN = 0xf4000, LENGTH = 0xa000&lt;/p&gt;
&lt;p&gt;meaning that it starts at 0xf4000 meaning 999424 byte of length 40960 byte. Is this way of thinking correct by simply converting hex/decimal?&lt;/p&gt;
&lt;p&gt;Here is the full linker file for app, we use :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;
SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)

MEMORY
{
  FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0xca000
  RAM (rwx) :  ORIGIN = 0x20002220, LENGTH = 0x3dde0
  uicr_bootloader_start_address (r) : ORIGIN = 0x00000FF8, LENGTH = 0x4
}

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 = .);
  } &amp;gt; uicr_bootloader_start_address
}

SECTIONS
{
  . = ALIGN(4);
  .mem_section_dummy_ram :
  {
  }
  .cli_sorted_cmd_ptrs :
  {
    PROVIDE(__start_cli_sorted_cmd_ptrs = .);
    KEEP(*(.cli_sorted_cmd_ptrs))
    PROVIDE(__stop_cli_sorted_cmd_ptrs = .);
  } &amp;gt; RAM
  .fs_data :
  {
    PROVIDE(__start_fs_data = .);
    KEEP(*(.fs_data))
    PROVIDE(__stop_fs_data = .);
  } &amp;gt; RAM
  .log_dynamic_data :
  {
    PROVIDE(__start_log_dynamic_data = .);
    KEEP(*(SORT(.log_dynamic_data*)))
    PROVIDE(__stop_log_dynamic_data = .);
  } &amp;gt; RAM
  .log_filter_data :
  {
    PROVIDE(__start_log_filter_data = .);
    KEEP(*(SORT(.log_filter_data*)))
    PROVIDE(__stop_log_filter_data = .);
  } &amp;gt; RAM

} INSERT AFTER .data;

SECTIONS
{
  .mem_section_dummy_rom :
  {
  }
  .sdh_ble_observers :
  {
    PROVIDE(__start_sdh_ble_observers = .);
    KEEP(*(SORT(.sdh_ble_observers*)))
    PROVIDE(__stop_sdh_ble_observers = .);
  } &amp;gt; FLASH
  .sdh_soc_observers :
  {
    PROVIDE(__start_sdh_soc_observers = .);
    KEEP(*(SORT(.sdh_soc_observers*)))
    PROVIDE(__stop_sdh_soc_observers = .);
  } &amp;gt; FLASH
  .sdh_stack_observers :
  {
    PROVIDE(__start_sdh_stack_observers = .);
    KEEP(*(SORT(.sdh_stack_observers*)))
    PROVIDE(__stop_sdh_stack_observers = .);
  } &amp;gt; FLASH
  .sdh_req_observers :
  {
    PROVIDE(__start_sdh_req_observers = .);
    KEEP(*(SORT(.sdh_req_observers*)))
    PROVIDE(__stop_sdh_req_observers = .);
  } &amp;gt; FLASH
  .sdh_state_observers :
  {
    PROVIDE(__start_sdh_state_observers = .);
    KEEP(*(SORT(.sdh_state_observers*)))
    PROVIDE(__stop_sdh_state_observers = .);
  } &amp;gt; FLASH
    .nrf_queue :
  {
    PROVIDE(__start_nrf_queue = .);
    KEEP(*(.nrf_queue))
    PROVIDE(__stop_nrf_queue = .);
  } &amp;gt; FLASH
    .nrf_balloc :
  {
    PROVIDE(__start_nrf_balloc = .);
    KEEP(*(.nrf_balloc))
    PROVIDE(__stop_nrf_balloc = .);
  } &amp;gt; FLASH
    .cli_command :
  {
    PROVIDE(__start_cli_command = .);
    KEEP(*(.cli_command))
    PROVIDE(__stop_cli_command = .);
  } &amp;gt; FLASH
  .crypto_data :
  {
    PROVIDE(__start_crypto_data = .);
    KEEP(*(SORT(.crypto_data*)))
    PROVIDE(__stop_crypto_data = .);
  } &amp;gt; FLASH
  .pwr_mgmt_data :
  {
    PROVIDE(__start_pwr_mgmt_data = .);
    KEEP(*(SORT(.pwr_mgmt_data*)))
    PROVIDE(__stop_pwr_mgmt_data = .);
  } &amp;gt; FLASH
  .log_const_data :
  {
    PROVIDE(__start_log_const_data = .);
    KEEP(*(SORT(.log_const_data*)))
    PROVIDE(__stop_log_const_data = .);
  } &amp;gt; FLASH
  .log_backends :
  {
    PROVIDE(__start_log_backends = .);
    KEEP(*(SORT(.log_backends*)))
    PROVIDE(__stop_log_backends = .);
  } &amp;gt; FLASH

} INSERT AFTER .text

INCLUDE &amp;quot;nrf_common.ld&amp;quot;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;For merging and then flashing, we use the following lines:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfutil settings generate --family NRF52840 --application _build/nrf52840_xxaa.hex --application-version 2 --bootloader-version 1 --bl-settings-version 1 bootsettings.hex
mergehex -m _bootloader/nrf52840_xxaa.hex bootsettings.hex -o bootloader_and_settings.hex
mergehex -m _build/nrf52840_xxaa.hex bootloader_and_settings.hex -o app_firmware.hex

nrfjprog --family nrf52 --recover
nrfjprog --family nrf52 --program sdk/nRF5SDK_15.0.0/components/softdevice/s140/hex/s140_nrf52_6.0.0_softdevice.hex --sectorerase
nrfjprog --family nrf52 --program app_firmware.hex --sectoranduicrerase --reset&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU linker settings in gcc</title><link>https://devzone.nordicsemi.com/thread/211305?ContentTypeID=1</link><pubDate>Mon, 23 Sep 2019 13:46:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed0b2eac-2bb3-46a6-8dce-a9379476e62a</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Bilen,&amp;nbsp;&lt;/p&gt;
[quote user=""]1. According to the memory map, MBR starts at 0, is the statement correct: mbr_params_page (r) : ORIGIN = 0x000FE000, LENGTH = 0x1000[/quote]
&lt;p&gt;&amp;nbsp;It is correct that the MBR starts at 0x0000, but it also needs a flash page to store some magic numbers and keep track of pending bootloader copy operations. This flash page is placed at the end of flash, above the bootloader it self at 0x000FE000.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]2. Is including in the app linker file: uicr_bootloader_start_address (r) : ORIGIN = 0x00000FF8, LENGTH = 0x4 immportant?[/quote]
&lt;p&gt;&amp;nbsp;Yes, this&amp;nbsp;places the bootloader start address within the MBR, i.e. tells the MBR where to jump to on boot if a BL is present.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;[quote user=""][/quote]&lt;/p&gt;
&lt;p&gt;Bootloader DFU Settings:&lt;br /&gt;* File:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bootsettings.hex&lt;br /&gt;* Family:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NRF52840&lt;br /&gt;* Start Address:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x000FF000&lt;br /&gt;* CRC:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x5593BD4D&lt;br /&gt;* Settings Version:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00000001 (1)&lt;br /&gt;* App Version:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00000002 (2)&lt;br /&gt;* Bootloader Version:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00000001 (1)&lt;br /&gt;* Bank Layout:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00000000&lt;br /&gt;* Current Bank:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00000000&lt;br /&gt;* Application Size:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x0002785C (161884 bytes)&lt;br /&gt;* Application CRC:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x55A80F33&lt;br /&gt;* Bank0 Bank Code:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00000001&lt;br /&gt;* Softdevice Size:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00000000 (0 bytes)&lt;br /&gt;* Boot Validation CRC:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00000000&lt;br /&gt;* SD Boot Validation Type:&amp;nbsp; 0x00000000 (0)&lt;br /&gt;* App Boot Validation Type: 0x00000000 (0)&lt;/p&gt;
&lt;p&gt;Any idea why the mergehex complains about possible region overlapping when app and bootloader (and settings) are merged?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;So are you getting complaints about overlapping sections when you merge the bootloader and bootloader settings OR when you merge the app with the already merged bootloader + bootlaoder settings hex? If its the latter, then can you post the linker script for your application? I would like to check if you have adjusted the application flash region to allow enough space for the bootloader.&amp;nbsp;&lt;/p&gt;
[quote user=""]4. What are the changes regarding DFU and bootloader from 15.0 to 15.3, would changing to 15.3 resolve these issues?[/quote]
&lt;p&gt;&amp;nbsp;I think the biggest change we did is that we&amp;#39;re&amp;nbsp;placing&amp;nbsp;the bootloader start address and MBR params page address&amp;nbsp;inside the MBR&amp;nbsp;in addition to writing them to the UICR registers, see this&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/47651/uicr_mbr_params_page-and-uicr_bootloader_start_address-overwrite-the-beginning-of-the-softdevice"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/47651/uicr_mbr_params_page-and-uicr_bootloader_start_address-overwrite-the-beginning-of-the-softdevice&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>