<?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 to jump from Bootloader to Application (nrf51822)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/23906/how-to-jump-from-bootloader-to-application-nrf51822</link><description>Currently, I am trying to develop nrf51822 ( MDBT40 ) using Nordic SDK v12 (S130). The programmer I used is DAPLink from RedBear . 
 I am wondering how to make program to jump from bootloader to application code. 
 This is what I have don: 
 
 
</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 10 Aug 2017 13:23:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/23906/how-to-jump-from-bootloader-to-application-nrf51822" /><item><title>RE: How to jump from Bootloader to Application (nrf51822)</title><link>https://devzone.nordicsemi.com/thread/94092?ContentTypeID=1</link><pubDate>Thu, 10 Aug 2017 13:23:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3656aa7-7e1c-49a8-a95c-5ef0217abaf0</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Chen Chen,&lt;/p&gt;
&lt;p&gt;Sorry for the late answer. Bjørn is on vacation.&lt;/p&gt;
&lt;p&gt;My suggestion is to test without any mergehex. I don&amp;#39;t see it&amp;#39;s a good idea to use mergehex before you test and make sure DFU works as it should.&lt;/p&gt;
&lt;p&gt;My suggestion for you is to follow this &lt;a href="https://devzone.nordicsemi.com/blogs/1085/getting-started-with-nordics-secure-dfu-bootloader/"&gt;guide&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Make sure everything works. Including jumping from the bootloader to application and vice versa.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to jump from Bootloader to Application (nrf51822)</title><link>https://devzone.nordicsemi.com/thread/94090?ContentTypeID=1</link><pubDate>Mon, 07 Aug 2017 15:07:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f11d313-4e0b-463b-86b0-47d6dc4d23a7</guid><dc:creator>Chen Chen</dc:creator><description>&lt;p&gt;hi Bjørn, thank you for your response. And sorry for reporting back slightly late.&lt;/p&gt;
&lt;p&gt;It looks like the device is still stuck at bootloading mode , i..e the application code is not executed..&lt;/p&gt;
&lt;p&gt;Here are the linker file I modified according to your suggestion.&lt;/p&gt;
&lt;p&gt;For bootloader part, same as before:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;MEMORY
{
     FLASH (rx) : ORIGIN = 0x3AC00, LENGTH = 0x5000
     RAM (rwx) :  ORIGIN = 0x20002C00, LENGTH = 0x5380
     NOINIT (rwx) :  ORIGIN = 0x20007F80, LENGTH = 0x80
     BOOTLOADER_SETTINGS (rw) : ORIGIN = 0x0003FC00, LENGTH = 0x0400
     UICR_BOOTLOADER (r) : ORIGIN = 0x10001014, LENGTH = 0x04
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For application code part, I did some modification on flash and ram size.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;MEMORY
{
    FLASH (rx) : ORIGIN = 0x1b000, LENGTH = 0x1FC00
    RAM (rwx) :  ORIGIN = 0x20002080, LENGTH = 0x5F00
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In addition, when I generating bootloader setting file using nrfutil, here are outputs I saw from console.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Bootloader DFU Settings:
  * File:                 bootloader_setting.hex
  * Family:               nRF51
  * CRC:                  0x40A061E4
  * Settings Version:     0x00000001 (1)
  * App Version:          0x00000000 (0)
  * Bootloader Version:   0x00000000 (0)
  * Bank Layout:          0x00000000
  * Current Bank:         0x00000000
  * Application Size:     0x0000BA24 (47652 bytes)
  * Application CRC:      0x1AF13B5F
  * Bank0 Bank Code:      0x00000001
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Do you have any thoughts on what the possible reason may be??&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to jump from Bootloader to Application (nrf51822)</title><link>https://devzone.nordicsemi.com/thread/94091?ContentTypeID=1</link><pubDate>Thu, 03 Aug 2017 07:33:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c1089db3-33c5-49c2-bafc-40bec2345d99</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;You need to adjust the size of the application flash section as &lt;code&gt;0x1B000 + 0x25000 = 0x40000 (256kB)&lt;/code&gt;, i.e. there is no room for the bootloader. Adjusting the size to 0x210000, i.e. &lt;code&gt;0x1B000 + 0x1FC00 = 0x3A000&lt;/code&gt;. Also, since you&amp;#39;re using the 32kB variant of the nRF51822 you can increase the RAM size to &lt;code&gt;0x5F00&lt;/code&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to jump from Bootloader to Application (nrf51822)</title><link>https://devzone.nordicsemi.com/thread/94093?ContentTypeID=1</link><pubDate>Wed, 02 Aug 2017 16:01:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c2a9b70-f36d-4c72-945b-19445e7f005b</guid><dc:creator>Chen Chen</dc:creator><description>&lt;p&gt;Thanks Bjørn, as your reference, after double checking the hardware specification an datasheet, the nrf51822 chip I used has 32kB RAM 256KB Flash (RedBear Nano V1.5).&lt;/p&gt;
&lt;p&gt;I used the default bootloader linker scripts in Nordic V12 SDK:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;MEMORY
{
    FLASH (rx) : ORIGIN = 0x3AC00, LENGTH = 0x5000
    RAM (rwx) :  ORIGIN = 0x20002C00, LENGTH = 0x5380
    NOINIT (rwx) :  ORIGIN = 0x20007F80, LENGTH = 0x80
    BOOTLOADER_SETTINGS (rw) : ORIGIN = 0x0003FC00, LENGTH = 0x0400
    UICR_BOOTLOADER (r) : ORIGIN = 0x10001014, LENGTH = 0x04
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And here are the linker scripts I used for application code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;MEMORY
{
    FLASH (rx) : ORIGIN = 0x1b000, LENGTH = 0x25000
    RAM (rwx) :  ORIGIN = 0x20002080, LENGTH = 0x1800
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Could you please help me confirming whether the parameters are correct? And thank you for helping me out these days!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to jump from Bootloader to Application (nrf51822)</title><link>https://devzone.nordicsemi.com/thread/94089?ContentTypeID=1</link><pubDate>Wed, 02 Aug 2017 09:17:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e65f4223-370e-4618-93ba-7eb30b2ad2c6</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;The length of the application flash section is incorrect, it should be 0x21000 if the bootloader starts at 0x3C000. Could you post the linker script for the bootloader you&amp;#39;re using?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to jump from Bootloader to Application (nrf51822)</title><link>https://devzone.nordicsemi.com/thread/94087?ContentTypeID=1</link><pubDate>Tue, 01 Aug 2017 19:29:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2a53efb-de3c-4c76-b5a7-3cebedadb81f</guid><dc:creator>Chen Chen</dc:creator><description>&lt;p&gt;After trying out many parameters, I think the reason is that the application code is flashed to wrong paces. Here is my modified linker file for application code, which I think it is correct for 16KB RAM:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;MEMORY
{
    FLASH (rx) : ORIGIN = 0x1b000, LENGTH = 0x25000
    RAM (rwx) :  ORIGIN = 0x20002080, LENGTH = 0x1800
}    
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;However, it looks like it still doesn&amp;#39;t work (the bootloader can be executed successfully, however the it cannot jump to application code). Could you please indicate where the problem might be? Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to jump from Bootloader to Application (nrf51822)</title><link>https://devzone.nordicsemi.com/thread/94085?ContentTypeID=1</link><pubDate>Tue, 01 Aug 2017 18:03:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:29d26fb8-1244-46f3-ae4d-a6f69e989bd2</guid><dc:creator>Chen Chen</dc:creator><description>&lt;p&gt;Thanks Bjørn, as you said, I have did following trials:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;merge outputapp.hex and outputbootloader.hex, for getting a single out.hex. The process of merge completed successfully! However when I flashed to device, only bootloader code can be executed with application code being ignored!&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The based on previous code, I flash outapp.hex (application code + softDevice) again, only application code works with bootloader being ignored..&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I am guessing the reason is that I didn&amp;#39;t configure the linker file. As your reference, here is the linker file of application code, and the device I used is 16KB RAM 256KB Flash nrf51822 chip. Could you please help me check whether this is correct? Thanks!&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;MEMORY
{
    FLASH (rx) : ORIGIN = 0x1b000, LENGTH = 0x25000
    RAM (rwx) :  ORIGIN = 0x200033b0, LENGTH = 0x4c50
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to jump from Bootloader to Application (nrf51822)</title><link>https://devzone.nordicsemi.com/thread/94086?ContentTypeID=1</link><pubDate>Tue, 01 Aug 2017 14:25:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a9548ff-2284-43c7-8e7c-01b8e38537e5</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Could you try to merge outputapp.hex and outputbootloader.hex using mergehex? If you get an error, then you&amp;#39;re most likely overwritting the bootloader when you&amp;#39;re flashing outputapp.hex&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to jump from Bootloader to Application (nrf51822)</title><link>https://devzone.nordicsemi.com/thread/94084?ContentTypeID=1</link><pubDate>Tue, 01 Aug 2017 14:02:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f6d3f472-9fde-4084-bc3b-ded82cd514b7</guid><dc:creator>Chen Chen</dc:creator><description>&lt;p&gt;Thanks Bjørn! However in this case, it looks like the code in bootloader is not executed at all.. I planned to put dfu OTA code in bootloader, such that during initial start-up, there are few seconds for users being able to update their firmware. That is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;execute bootloader code which contains DFU update code. In this stage users is able to do OTA&lt;/li&gt;
&lt;li&gt;jump to application if users are not doing anything during boot loading stage.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Would you mind indicating me how to do that?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to jump from Bootloader to Application (nrf51822)</title><link>https://devzone.nordicsemi.com/thread/94083?ContentTypeID=1</link><pubDate>Tue, 01 Aug 2017 13:48:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee5fbeff-0f7d-415a-840f-28601f9f2871</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;If you have flashed both outputapp.hex and outputbootloader.hex to the board and it is jumping to the application then that is the correct behaviour. The bootloader will check if the application CRC on the bootloader settings page matches the CRC of the application hex in flash. If this is the case, then it will jump to the application.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to jump from Bootloader to Application (nrf51822)</title><link>https://devzone.nordicsemi.com/thread/94088?ContentTypeID=1</link><pubDate>Mon, 31 Jul 2017 20:41:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4f6c8cad-ecb9-477c-9ae9-562c07988b03</guid><dc:creator>Chen Chen</dc:creator><description>&lt;p&gt;Thanks for your suggestion Bjørn. As the guide indicated by you. Currently I got 4 hex files, which are application.hex, bootloader.hex, bootloader_setting.hex, softdevice.hex. I am wondering how shall I merge them together.&lt;/p&gt;
&lt;p&gt;This is how I did currently, but it looks like it doesn&amp;#39;t work property. The device just step into application code directly with bootloading/secure DFU part being passed.. Could you please indicate me where the the mistake I made&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Merge bootloader.hex and bootloader_setting.hex using following command:&lt;/p&gt;
&lt;p&gt;./mergehex -m bootloader.hex bootloader_setting.hex -o outputbootloader.hex&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Merge application code and softdevice using following command:&lt;/p&gt;
&lt;p&gt;./mergehex -m application.hex s130_nrf51_2.0.1_softdevice.hex -o outputapp.hex&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Drag outputbootloader.hex into virtual file system generated by DAPLink. And wait until it is finished;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Drag outputapp.hex into virtual file system generated by DAPLink. Wait until it is finished.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to jump from Bootloader to Application (nrf51822)</title><link>https://devzone.nordicsemi.com/thread/94082?ContentTypeID=1</link><pubDate>Mon, 31 Jul 2017 14:38:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2c86296-4e82-4551-a384-eeef01a33ac3</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;You need to generate a bootloader settings page, please see Appendix 1 in &lt;a href="https://devzone.nordicsemi.com/blogs/1085/getting-started-with-nordics-secure-dfu-bootloader/"&gt;this&lt;/a&gt; blog post.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>