<?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>S132 and custom application start address</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/17317/s132-and-custom-application-start-address</link><description>Hello,
I would like to use a custom flash memory layout for the flash memory of nrf52: 
 
 I thought that I should be able to use the UICR.NRFFW[0] - if I set to the start address of my application, SD should jump there (instead of bootloader, for</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 25 Oct 2016 11:52:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/17317/s132-and-custom-application-start-address" /><item><title>RE: S132 and custom application start address</title><link>https://devzone.nordicsemi.com/thread/66531?ContentTypeID=1</link><pubDate>Tue, 25 Oct 2016 11:52:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d139f9a0-2570-49e3-b294-98e495eb7f18</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;If the MBR detects that there is a bootloader or in this cas an application present ( if there is an address in the bootloader address location in UICR) it will not initialize the SoftFevice, but forward all interrupt to the bootloader and it is the bootloader that is responsible to initialize the softdevice or not.&lt;/p&gt;
&lt;p&gt;I dont know how you&amp;#39;re writing the address to the UICR register, but I added the following snippet to the top of my main.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include &amp;quot;nrf_mbr.h&amp;quot;

#define NRF_UICR_BOOTLOADER_START_ADDRESS       (NRF_UICR_BASE + 0x14)
#define APP_START_ADDR                          0x20000

#if defined (__CC_ARM )
    #pragma push
    #pragma diag_suppress 1296
    uint32_t  m_uicr_bootloader_start_address __attribute__((at(NRF_UICR_BOOTLOADER_START_ADDRESS)))
                                                    = APP_START_ADDR;
    #pragma pop
#elif defined ( __GNUC__ )
    volatile uint32_t m_uicr_bootloader_start_address  __attribute__ ((section(&amp;quot;.uicrBootStartAddress&amp;quot;)))
                                            = BOOTLOADER_START_ADDR;
#elif defined ( __ICCARM__ )
    __root    const uint32_t m_uicr_bootloader_start_address @ NRF_UICR_BOOTLOADER_START_ADDRESS
                                            = BOOTLOADER_START_ADDR;
#endif
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add this function before &lt;code&gt;ble_stack_init()&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint32_t nrf_dfu_mbr_init_sd(void)
{
    uint32_t ret_val;

    sd_mbr_command_t command =
    {
        .command = SD_MBR_COMMAND_INIT_SD
    };

    ret_val = sd_mbr_command(&amp;amp;command);

    return ret_val;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and  add the following code snippet in &lt;code&gt;ble_stack_init()&lt;/code&gt; before the &lt;code&gt;SOFTDEVICE_HANDLER_INIT&lt;/code&gt; macro&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;err_code = nrf_dfu_mbr_init_sd();
APP_ERROR_CHECK(err_code);

err_code = sd_softdevice_vector_table_base_set(APP_START_ADDR);
APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>