<?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>Start Bootloader From App</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/2906/start-bootloader-from-app</link><description>I&amp;#39;m trying to create a method so a users can initiate an OTA update from a paired device. To that end I&amp;#39;ve written something which is supposed to invalidate the data at the BOOTLOADER_SETTINGS_ADDRESS to invalidate the current app and then call a system</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 10 Jul 2015 12:46:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/2906/start-bootloader-from-app" /><item><title>RE: Start Bootloader From App</title><link>https://devzone.nordicsemi.com/thread/11068?ContentTypeID=1</link><pubDate>Fri, 10 Jul 2015 12:46:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6440097c-4c23-4c2a-893f-78a877a8c3f9</guid><dc:creator>ting&amp;#178;</dc:creator><description>&lt;p&gt;When I have a look in main of the dfu. I need to set &amp;quot;app_reset&amp;quot; to true in order to enter in the bootloader. If  &amp;quot;sd_power_gpregret_set(ENTER_BOOTLOADER_VALUE);&amp;quot; is not 0xB1. I will not have true for app_reset .&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; bool     app_reset= (NRF_POWER-&amp;gt;GPREGRET == BOOTLOADER_DFU_START); 
if (app_reset)
{
    NRF_POWER-&amp;gt;GPREGRET = 0;
}	
  
dfu_start  = app_reset;
if (dfu_start || (!bootloader_app_is_valid(DFU_BANK_0_REGION_START)))
{
    err_code = bootloader_dfu_start();
    APP_ERROR_CHECK(err_code);

}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start Bootloader From App</title><link>https://devzone.nordicsemi.com/thread/11065?ContentTypeID=1</link><pubDate>Tue, 26 May 2015 11:43:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5570f9c-47c3-4910-8c88-090a6a239df3</guid><dc:creator>John</dc:creator><description>&lt;p&gt;@kerem is correct. The value is arbitrary. I chose 0xA5 but it can be any non zero value.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start Bootloader From App</title><link>https://devzone.nordicsemi.com/thread/11066?ContentTypeID=1</link><pubDate>Mon, 25 May 2015 14:11:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ec0daea-d14a-4ccd-b4fc-2f9fcfbb380c</guid><dc:creator>kerem</dc:creator><description>&lt;p&gt;Since you define it as a macro prior to using it on the application side, I don&amp;#39;t think the value matters at all unless it&amp;#39;s invalid in terms of macro definition.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start Bootloader From App</title><link>https://devzone.nordicsemi.com/thread/11067?ContentTypeID=1</link><pubDate>Mon, 25 May 2015 14:06:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8a4e734-337f-4350-a90f-88a974d6f9c1</guid><dc:creator>ting&amp;#178;</dc:creator><description>&lt;p&gt;Hi,
Which value did you used for ENTER_BOOTLOADER_VALUE? Is it the same value as  BOOTLOADER_DFU_START(0xB1)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start Bootloader From App</title><link>https://devzone.nordicsemi.com/thread/11064?ContentTypeID=1</link><pubDate>Mon, 04 May 2015 14:25:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dda937b3-4de2-454d-8086-8a3865159203</guid><dc:creator>John</dc:creator><description>&lt;p&gt;That control snippet is part of my on_write event handler for my proprietary service and characteristic. The p_received_command points to the data portion of the event which contains my proprietary commands including a enter bootloader command. It is declared like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;	ble_gatts_evt_write_t	* p_evt_write = &amp;amp;p_ble_evt-&amp;gt;evt.gatts_evt.params.write;
onset_recv_command_t	* p_received_command = (onset_recv_command_t *)&amp;amp;p_evt_write-&amp;gt;data[0];
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start Bootloader From App</title><link>https://devzone.nordicsemi.com/thread/11063?ContentTypeID=1</link><pubDate>Sat, 02 May 2015 22:41:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ec83d65-fbbb-447b-847e-c244c6e46032</guid><dc:creator>kerem</dc:creator><description>&lt;p&gt;I can see that once the received command is ENTER_RADIO_BOOTLOADER, your snipper clears the GPREGRET register and writes ENTER_BOOTLOADER_VALUE on it, so that your bootloader who is checking the register&amp;#39;s value can go in DFU mode, that&amp;#39;s fine. But I could not understand where does that whole control snippet go in your application? How p_received_command is actually populated? Is there an example I can refer to in the SDK that does something similar?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start Bootloader From App</title><link>https://devzone.nordicsemi.com/thread/11062?ContentTypeID=1</link><pubDate>Fri, 17 Apr 2015 07:45:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3df32165-e4b3-4dde-be5b-69481302b514</guid><dc:creator>michaeld</dc:creator><description>&lt;p&gt;Smart! Thanks :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start Bootloader From App</title><link>https://devzone.nordicsemi.com/thread/11069?ContentTypeID=1</link><pubDate>Tue, 24 Jun 2014 22:41:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12fe8212-d828-43ff-9fe2-a66f2c554678</guid><dc:creator>Scott Buchanan</dc:creator><description>&lt;p&gt;Thanks so much, that works great!!!  I understand your comments about pstorage, at which I&amp;#39;m less of an expert, but I would like to understand that better but haven&amp;#39;t found any guide type documentation.&lt;/p&gt;
&lt;p&gt;Seems to me there should be some way of writing a value to a memory location :)  I know where the BOOT_SETTINGS are (0x3fc00) and their structure but, for now, your solution works great!!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start Bootloader From App</title><link>https://devzone.nordicsemi.com/thread/11061?ContentTypeID=1</link><pubDate>Tue, 24 Jun 2014 21:14:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9505762-deb2-49c0-a491-de396d4fd1cf</guid><dc:creator>John</dc:creator><description>&lt;p&gt;I&amp;#39;ll say up front that I am not a pstorage expert. That said, I believe that the bootloader application will allocate a pstorage area at the very top of memory. The bootloader is allocated the space right below its pstorage area. Then your application will create its own pstorage area beneath the bootloader. So it may be difficult for you to corrupt the bootloaders pstorage from the application FW.&lt;/p&gt;
&lt;p&gt;I have a bit simpler mechanism for entering the bootloader in my application. When I receive the go into bootloader command from my host application, I set a value in the general purpose RAM retention register (GPREGRET) and reset. The bootloader init code looks at the GPREGRET and if my enter bootloader value is present, the bootloader is invoked. I&amp;#39;ll put a code snippet from my applicaton below. Note, the reset is not performed in the command handler the command handler sets a flag that is checked elsewhere.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;	if (p_received_command-&amp;gt;parameters[0] == ENTER_RADIO_BOOTLOADER)
	{
		calc_response_length(O_CMD_SUCCESS);
		p_onset-&amp;gt;cmd_resp_ready = true;
		
		set_enter_bootloader(true);
		
		err_code = sd_power_gpregret_clr(0xFF);
		if (err_code != NRF_SUCCESS)
		{
			ASSERT(false);
		}
		
		err_code = sd_power_gpregret_set(ENTER_BOOTLOADER_VALUE);
		if (err_code != NRF_SUCCESS)
		{
			ASSERT(false);
		}
		
		return;
	}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>