<?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>How do I change the application/bootloader start address?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/39033/how-do-i-change-the-application-bootloader-start-address</link><description>My ultimate issue is trying to get a bootloader working on custom hardware with an nRF52832. The bootloader is mostly the base UART DFU bootloader from the Nordic SDK, with a few customizations to work with our hardware. I&amp;#39;ve been able to get the bootloader</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 22 Oct 2018 18:39:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/39033/how-do-i-change-the-application-bootloader-start-address" /><item><title>RE: How do I change the application/bootloader start address?</title><link>https://devzone.nordicsemi.com/thread/153917?ContentTypeID=1</link><pubDate>Mon, 22 Oct 2018 18:39:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7795c6e7-3a51-4d43-ab09-267395371c46</guid><dc:creator>klockhart</dc:creator><description>&lt;p&gt;After looking into the allocation in the map file, it became apparent that the issue I was seeing was due to the bootloader sections not being allocated properly. While the sections in the linker script do need to be added, this is only part of what&amp;#39;s needed.&lt;/p&gt;
&lt;p&gt;As opposed to the examples given in the SDK, my build configuration file (CMakeLists.txt using cmake and ninja to build) was designed in a minimalistic way, including only bootloader_main.c and one support file, with the Nordic files available as a separate library. The bootloader sections are utilized in components/libraries/bootloader/dfu/nrf_dfu_settings.c and components/libraries/bootloader/nrf_bootloader_info.c. As bootloader_main.c was not referencing these files explicitly, they were not being included in the build and were not being given space in the bootloader map. Adding these files to the bootloader target explictly caused them to be allocated and enabled the bootloader to boot.&lt;/p&gt;
&lt;p&gt;So the change I needed to make to the project was to go from this executable setup:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;set (EXE_NAME &amp;quot;bootloader&amp;quot;)
add_executable(bootloader
    $&amp;lt;TARGET_OBJECTS:nrf5_sdk_retarget&amp;gt; # This allows linking in the &amp;quot;retargetted versions of _read and _write
                                        # for printf/scanf instead of linking the libnosys implementation.
    ${APP_ROOT}/bootloader_main.c
    ${APP_ROOT}/shipBoot.c
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;To this one:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;set (EXE_NAME &amp;quot;bootloader&amp;quot;)
add_executable(bootloader
    $&amp;lt;TARGET_OBJECTS:nrf5_sdk_retarget&amp;gt; # This allows linking in the &amp;quot;retargetted versions of _read and _write
                                        # for printf/scanf instead of linking the libnosys implementation.
    ${APP_ROOT}/bootloader_main.c
    ${APP_ROOT}/shipBoot.c
	# There are a few bootloader sections which need to be allocated in the
	# final build. The following files add variables in the given sections,
	# resulting in their allocation in the map file.
	${NRF5_SDK_ROOT}/components/libraries/bootloader/dfu/nrf_dfu_settings.c
	${NRF5_SDK_ROOT}/components/libraries/bootloader/nrf_bootloader_info.c
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I change the application/bootloader start address?</title><link>https://devzone.nordicsemi.com/thread/153652?ContentTypeID=1</link><pubDate>Fri, 19 Oct 2018 13:22:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:588b3536-1467-401d-9b85-635ea8fd504c</guid><dc:creator>klockhart</dc:creator><description>&lt;p&gt;I&amp;#39;ve got this line&amp;nbsp; under Memory Configuration:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;uicr_bootloader_start_address 0x10001014         0x00000004         r&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And this later on in the map file:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;.uicr_bootloader_start_address
                0x10001014        0x0
                [!provide]                PROVIDE (__start_uicr_bootloader_start_address = .)
 *(SORT_BY_NAME(.uicr_bootloader_start_address*))
                [!provide]                PROVIDE (__stop_uicr_bootloader_start_address = .)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I change the application/bootloader start address?</title><link>https://devzone.nordicsemi.com/thread/153647?ContentTypeID=1</link><pubDate>Fri, 19 Oct 2018 13:08:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c043f8d4-397c-45b1-be9e-5af6ec62fd6a</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Kathleen,&lt;br /&gt;as long as you have the following memory regions and sections set in your linker script&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;MEMORY
{
  FLASH (rx) : ORIGIN = 0x27000, LENGTH = 0x57000
  RAM (rwx) :  ORIGIN = 0x200057b8, LENGTH = 0xa848
  mbr_params_page (r) : ORIGIN = 0x0007E000, LENGTH = 0x1000
  bootloader_settings_page (r) : ORIGIN = 0x0007F000, LENGTH = 0x1000
  uicr_mbr_params_page (r) : ORIGIN = 0x10001018, LENGTH = 0x4
  uicr_bootloader_start_address (r) : ORIGIN = 0x10001014, LENGTH = 0x4
}

SECTIONS
{
  .mbr_params_page(NOLOAD) :
  {
    PROVIDE(__start_mbr_params_page = .);
    KEEP(*(SORT(.mbr_params_page*)))
    PROVIDE(__stop_mbr_params_page = .);
  } &amp;gt; mbr_params_page
  .bootloader_settings_page(NOLOAD) :
  {
    PROVIDE(__start_bootloader_settings_page = .);
    KEEP(*(SORT(.bootloader_settings_page*)))
    PROVIDE(__stop_bootloader_settings_page = .);
  } &amp;gt; bootloader_settings_page
  .uicr_mbr_params_page :
  {
    PROVIDE(__start_uicr_mbr_params_page = .);
    KEEP(*(SORT(.uicr_mbr_params_page*)))
    PROVIDE(__stop_uicr_mbr_params_page = .);
  } &amp;gt; uicr_mbr_params_page
  .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
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;specifically the uicr_bootloader_start_address section, then you should be fine. Could you search through your .map file and see if uicr_bootloader_start_address section is included in the generated binary?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I change the application/bootloader start address?</title><link>https://devzone.nordicsemi.com/thread/153339?ContentTypeID=1</link><pubDate>Wed, 17 Oct 2018 17:57:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c00911f5-1d4f-4fcf-b62d-049933140821</guid><dc:creator>klockhart</dc:creator><description>&lt;p&gt;I&amp;#39;ve noticed that my custom bootloader isn&amp;#39;t setting the bootloader start address in the UICR registers. Is there anything specific in the project setup that signals nrfjprog that a given application is a bootloader and thus that the UICR registers should be set? I&amp;#39;m using the same ld file for my bootloader as for the example in the SDK, so maybe I&amp;#39;m missing something in the makefile?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I change the application/bootloader start address?</title><link>https://devzone.nordicsemi.com/thread/151263?ContentTypeID=1</link><pubDate>Tue, 02 Oct 2018 13:49:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f657a1b7-2a14-48fd-8dc4-3e14bd80aeb4</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;I think the issue is that the length value is to large as ORIGIN+LENGTH is 0x81000. The bootloader should stop at the start of the MBR Params page at 0x7E000, i.e. LENGTH = 0x78000 - ORIGIN = 0x57000.&lt;/p&gt;
&lt;p&gt;I tested the following setting with the bootlaoder in SDK v15.2.0 and I had no issues.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;FLASH (rx) : ORIGIN = 0x27000, LENGTH = 0x57000&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I change the application/bootloader start address?</title><link>https://devzone.nordicsemi.com/thread/151253?ContentTypeID=1</link><pubDate>Tue, 02 Oct 2018 13:23:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a68e23bc-0c21-4055-bb36-2eb2538edba5</guid><dc:creator>klockhart</dc:creator><description>&lt;p&gt;No, I am not able to debug with that configuration. I have been able to debug the bootloader with the&amp;nbsp;&lt;strong&gt;FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0x5a000&amp;nbsp;&lt;/strong&gt;configuration.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I change the application/bootloader start address?</title><link>https://devzone.nordicsemi.com/thread/151106?ContentTypeID=1</link><pubDate>Tue, 02 Oct 2018 06:42:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:76c6746b-22bd-4547-a283-f6c708479921</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Yes, you understanding is correct.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Are you able to debug the bootloader when you use&amp;nbsp;the&amp;nbsp;&lt;strong&gt;FLASH (rx) : ORIGIN = 0x27000, LENGTH = 0x59000 configuration?&lt;/strong&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><item><title>RE: How do I change the application/bootloader start address?</title><link>https://devzone.nordicsemi.com/thread/151034?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 15:22:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d575e893-45ce-4413-88f8-af31a9f4a574</guid><dc:creator>klockhart</dc:creator><description>&lt;p&gt;So if I&amp;#39;m understanding you right, the blinky application isn&amp;#39;t working at another address because it has to be located immediately after the softdevice (i.e. 0x26000.) But the bootloader should be able to be placed pretty much anywhere in flash where&amp;#39;s it&amp;#39;s not overwriting the softdevice as the its start location is saved in the UICR registers.&lt;/p&gt;
&lt;p&gt;When I switch over to using our custom bootloader, I&amp;#39;m seeing that when I set the flash configuration to&amp;nbsp;&lt;strong&gt;FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0x5a000&lt;/strong&gt;, the bootloader boots up and prints to the debug port successfully, but when I set the flash configuration to&amp;nbsp;&lt;strong&gt;FLASH (rx) : ORIGIN = 0x27000, LENGTH = 0x59000&lt;/strong&gt;&lt;strong&gt;,&amp;nbsp;&lt;/strong&gt;I don&amp;#39;t see any output on the debug port, leading me to believe the bootloader is never being run. As part of my programming procedure I&amp;#39;m running an eraseall, which should make sure the UICR registers get reprogrammed and I&amp;#39;m also making sure to reset the board after programming everything. What am I missing&amp;nbsp;here?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I change the application/bootloader start address?</title><link>https://devzone.nordicsemi.com/thread/151029?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 15:05:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:508cab6a-5ef3-4b98-94dd-863dd058af74</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;&lt;a title="Interrupt forwarding to the application" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.sds/dita/softdevices/s130/processor_avail_interrupt_latency/interrupt_forwarding_to_application.html?cp=2_3_1_0_15_0_0"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The SoftDevice will forward interrupts/events&amp;nbsp; to the application&amp;nbsp;&lt;span&gt;and for the SoftDevice to locate the application interrupt vectors, the application must define its interrupt vector table at the bottom of the Application Flash Region illustrated in&amp;nbsp;&lt;/span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.sds/dita/softdevices/s130/mem_usage/mem_resource_map_usage.html#mem_resource_map_usage__fig_tjt_thp_3r"&gt;Memory resource map&lt;/a&gt;&lt;span&gt;. When the base address of the application code is directly after the top address of the SoftDevice, the code can be developed as a standard ARM&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/00ae.svg" title="Registered"&gt;&amp;#x00ae;&lt;/span&gt; Cortex&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/00ae.svg" title="Registered"&gt;&amp;#x00ae;&lt;/span&gt; -&lt;/span&gt;&lt;span&gt;&lt;span&gt;M4&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&amp;nbsp;application project with the compiler creating the interrupt vector table, see&amp;nbsp;&lt;/span&gt;&lt;a title="Interrupt forwarding to the application" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.sds/dita/softdevices/s130/processor_avail_interrupt_latency/interrupt_forwarding_to_application.html?cp=2_3_1_0_15_0_0"&gt;Interrupt forwarding to the application&lt;/a&gt;&amp;nbsp;for more information.&lt;/p&gt;
&lt;p&gt;In other words, the application must start right after the SoftDevice. The bootloader can be placed anywhere above the application as the MBR will find the bootloader start address in the UICR registers and then forward interrupts to that address, see&amp;nbsp;&lt;a title="The SoftDevice supports the use of a bootloader. A bootloader may be used to update the firmware on the ." href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.sds/dita/softdevices/s130/mbr_bootloader/mbr_bootloader.html#mbr_bootloader"&gt;Master boot record and bootloader&lt;/a&gt;&amp;nbsp;for more information.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I change the application/bootloader start address?</title><link>https://devzone.nordicsemi.com/thread/151010?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 14:14:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fbfddd60-0e18-4022-a6b2-c0395d398e64</guid><dc:creator>klockhart</dc:creator><description>&lt;p&gt;So that explains why 0x25000 won&amp;#39;t work as a start address, but I also can&amp;#39;t run the blinky example with the following configuration:&amp;nbsp;&lt;strong&gt;FLASH (rx) : ORIGIN = 0x27000, LENGTH = 0x59000.&amp;nbsp;&lt;/strong&gt;Any idea what might be going on here?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I change the application/bootloader start address?</title><link>https://devzone.nordicsemi.com/thread/150978?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 13:01:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:29911e75-a720-4229-9819-6b1474254fa7</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Kathleen,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;the S132 v6.1.0 SoftDevice requires&amp;nbsp;152 kB (0x26000 bytes) of program memory, starting from 0x0000 ( This is included the MBR, see&amp;nbsp;&lt;a title="Memory resource map and usage" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.sds/dita/softdevices/s130/mem_usage/mem_resource_map_usage.html?cp=2_3_1_0_13_0"&gt;Memory resource map and usage&lt;/a&gt;&amp;nbsp;for the memory layout). So when you are setting the application or bootloader start address to 0x25000, you are effectively overwritting the SoftDevice. Hence setting any start address higher than 0x26000 should work fine for both the bootloader and the application.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Bjørn&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>