<?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>nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/53522/nrf52832-custom-simple-bootloader-implementation</link><description>Hi everybody. I know that it is complete standart question, which has many asks and solutions here. I&amp;#39;m quite new to bootloader management stuff. So asking about some targeting recommendations and solutions, some custom examples to start with. My goal</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 29 Oct 2019 13:34:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/53522/nrf52832-custom-simple-bootloader-implementation" /><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/217346?ContentTypeID=1</link><pubDate>Tue, 29 Oct 2019 13:34:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e61362a-b2e6-4fc3-8d58-912141723a8f</guid><dc:creator>Ivan</dc:creator><description>&lt;p&gt;Looks like that program getting lost after FW rewrite, so the code after FW rewrite block is not working - actually no reset by &lt;span&gt;NVIC_SystemReset() or some other kind of stuff.&lt;br /&gt;Now only helps to send some signal before update and put it back to HW reset pin via some delay IC (3-4 seconds is enough)... This works fine, but really strange solution at the moment... :)&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/217204?ContentTypeID=1</link><pubDate>Mon, 28 Oct 2019 19:44:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b1ce422-e16c-42a5-9cd7-4540bc8856b1</guid><dc:creator>Ivan</dc:creator><description>&lt;p&gt;I think now is ok, I &amp;#39;ve write wrong amount of FW data.&lt;br /&gt;I get right image, right reset, but than my programs stops execution here, and when I run debug, I can run the program, or by doing a button reset...&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/stops-here.jpg" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/217203?ContentTypeID=1</link><pubDate>Mon, 28 Oct 2019 19:24:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be02dd0a-03f6-4c86-b2ea-e92d53378cd2</guid><dc:creator>Ivan</dc:creator><description>&lt;p&gt;I was lucky to analyze it via debugger still. Crap, looks like I &amp;#39;ve got strange zeroing from some address till end.&lt;br /&gt;Look. Upper is image flashed via debugger, down is copied one.&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/mem-compare.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;Looks like my RAM becomes corrupted from some address before copying of FW from it.&lt;br /&gt;Maybe there is some tricky way to place it to some safe place?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/217195?ContentTypeID=1</link><pubDate>Mon, 28 Oct 2019 18:33:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90b6ea62-5696-4326-95b3-331b2379d4a3</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;This sounds strange, if firmware is written correctly, it should work... try to download and compare images with nrfjprog.&amp;nbsp;&lt;/p&gt;
[quote userid="71428" url="~/f/nordic-q-a/53522/nrf52832-custom-simple-bootloader-implementation/217167"]I &amp;#39;ve taken this from standart implementation.[/quote]
&lt;p&gt;Is that implementation for nFR52? It breaks NVMC programming rules:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/11357/nrf52-flash-programming-writes-in-a-block-between-erase/42776#42776"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/11357/nrf52-flash-programming-writes-in-a-block-between-erase/42776#42776&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/217174?ContentTypeID=1</link><pubDate>Mon, 28 Oct 2019 16:12:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f5735eba-e560-48ac-a6e1-b92c328a5a61</guid><dc:creator>Ivan</dc:creator><description>&lt;p&gt;I check the flash via debugger, seems right fW is written by the function, but app can&amp;#39;t start and stay at reset handler.&lt;br /&gt;&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/0385.debug.jpg" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/217172?ContentTypeID=1</link><pubDate>Mon, 28 Oct 2019 15:58:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db425939-06f9-4a68-afbf-04c3c24cbece</guid><dc:creator>Ivan</dc:creator><description>&lt;p&gt;I &amp;#39;ve implemented flash program like on your example.&lt;br /&gt;But still bricked on 0x0 write.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/217167?ContentTypeID=1</link><pubDate>Mon, 28 Oct 2019 15:44:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e393ecb-5141-4916-8a35-be1b12222724</guid><dc:creator>Ivan</dc:creator><description>&lt;p&gt;I &amp;#39;ve taken this from standart implementation.&lt;br /&gt;Flash copy body is ok, cause as I said I &amp;#39;ve tested write to 0x5000.&lt;br /&gt;I get proper write and sw reset, and after reset I get same image to 0x0 at 0x5000.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/217164?ContentTypeID=1</link><pubDate>Mon, 28 Oct 2019 15:23:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0384d464-8b26-4ee1-b340-2bd329faa82b</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I didn&amp;#39;t understood meaning of this:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;uint32_t byte_shift = (dest + i) &amp;amp; (uint32_t)0x03;&lt;br /&gt;uint32_t address32 = (dest + i) &amp;amp; ~byte_shift; // Address to the word this byte is in.&lt;br /&gt;uint32_t value32 = (*(uint32_t*)address32 &amp;amp; ~((uint32_t)0xFF &amp;lt;&amp;lt; (byte_shift &amp;lt;&amp;lt; (uint32_t)3)));&lt;br /&gt;value32 = value32 + ((uint32_t)src[i] &amp;lt;&amp;lt; (byte_shift &amp;lt;&amp;lt; 3));&lt;/p&gt;
&lt;p&gt;The right way is to program flash word by word:&lt;/p&gt;
&lt;pre&gt;*(uint32_t*)dest = value;&lt;br /&gt;dest += 4;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can look in debugger what&amp;#39;s actually written at address 0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/216960?ContentTypeID=1</link><pubDate>Sun, 27 Oct 2019 10:57:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3e91be3-b0fe-4875-8ad6-236c95f5aad8</guid><dc:creator>Ivan</dc:creator><description>&lt;p&gt;all seems without some flash functions.&lt;br /&gt;&lt;br /&gt;But still get device bricked after usiing it for 0x0 program flash rewrite.&lt;br /&gt;Flash write working proper way, cause I &amp;#39;ve tested it on other region.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/216959?ContentTypeID=1</link><pubDate>Sun, 27 Oct 2019 10:56:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b4730f91-1c6c-451e-8ab4-a1173f749f93</guid><dc:creator>Ivan</dc:creator><description>&lt;p&gt;Here is my final code.&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;//execute FW update 
void execute_fw_update(uint8_t* fwData, uint32_t fwSize) { 
update_fw_proc updater = (update_fw_proc) (RAM_START + 1);
uint32_t src = (uint32_t)fw_copy_flash;

memcpy((void*)RAM_START, (void *)(src &amp;amp; ~1), FW_FLASH_FUNC_SIZE); */
__dsb(0xf);
__isb(0xf);
(updater)(FW_FLASH_START, fwData, fwSize);

}

//ram function code to update flash

static void fw_copy_flash(uint32_t dest, uint8_t *src, uint32_t size)
{
int i;
int pagesNum = FW_DATA_MAX_SIZE / NRF_FICR-&amp;gt;CODEPAGESIZE;

__disable_irq();

//erase number of pages needed
for (i = 0; i &amp;lt; pagesNum; i++) {
// Enable erase.
NRF_NVMC-&amp;gt;CONFIG = NVMC_CONFIG_WEN_Een;
__ISB();
__DSB();

// Erase the page
NRF_NVMC-&amp;gt;ERASEPAGE = i * NRF_FICR-&amp;gt;CODEPAGESIZE; 

while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy) {;}

NRF_NVMC-&amp;gt;CONFIG = NVMC_CONFIG_WEN_Ren;
__ISB();
__DSB();
}

for (i = 0; i &amp;lt; size; i++)
{
uint32_t byte_shift = (dest + i) &amp;amp; (uint32_t)0x03;
uint32_t address32 = (dest + i) &amp;amp; ~byte_shift; // Address to the word this byte is in.
uint32_t value32 = (*(uint32_t*)address32 &amp;amp; ~((uint32_t)0xFF &amp;lt;&amp;lt; (byte_shift &amp;lt;&amp;lt; (uint32_t)3)));
value32 = value32 + ((uint32_t)src[i] &amp;lt;&amp;lt; (byte_shift &amp;lt;&amp;lt; 3));

// Enable write.
NRF_NVMC-&amp;gt;CONFIG = (NVMC_CONFIG_WEN_Wen &amp;lt;&amp;lt; NVMC_CONFIG_WEN_Pos);
__ISB();
__DSB();

*(uint32_t*)address32 = value32;
while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy) {;}

NRF_NVMC-&amp;gt;CONFIG = (NVMC_CONFIG_WEN_Ren &amp;lt;&amp;lt; NVMC_CONFIG_WEN_Pos);
__ISB();
__DSB();
}

//reset board
//NVIC_SystemReset();
__DSB(); /* Ensure all outstanding memory accesses included
buffered write are completed before reset */
SCB-&amp;gt;AIRCR = (uint32_t)((0x5FAUL &amp;lt;&amp;lt; SCB_AIRCR_VECTKEY_Pos) |
(SCB-&amp;gt;AIRCR &amp;amp; SCB_AIRCR_PRIGROUP_Msk) |
SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */
__DSB(); /* Ensure completion of memory access */

for(;;) /* wait until reset */
{
__NOP();
}
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/216952?ContentTypeID=1</link><pubDate>Sat, 26 Oct 2019 20:56:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:766097c5-cc39-4ba0-89ee-f8ba59cb8ff6</guid><dc:creator>Ivan</dc:creator><description>&lt;p&gt;I &amp;#39;ve tried all this together.&lt;br /&gt;Now I can wriite to some other king of &amp;#39;program&amp;#39; 0x0 flash address without any problem.&lt;br /&gt;But when I write to 0x0 then I got device bricked.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/216245?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2019 21:12:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e981eff6-ddf2-4e1c-afc5-e5b9630d5d78</guid><dc:creator>Ivan</dc:creator><description>&lt;p&gt;That I thought about. Right.&lt;br /&gt;Gonna try to implement and test all this stuff together.&lt;br /&gt;&amp;#39;ll ask if wanna clarify smth else.&lt;br /&gt;But, great thanks at all for such detailed help at all! : )&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/216244?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2019 21:06:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fca73d2b-b78a-44ae-a833-640a433c1621</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;You can use&amp;nbsp;&lt;em&gt;code&lt;/em&gt; from these functions, but not call them (they&amp;#39;re located in the flash that you&amp;#39;re overwriting). And you need to unroll their code to your single function that you can copy from start to end.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/216239?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2019 20:02:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6de4d10b-c9cc-4066-b763-7c83d81ac748</guid><dc:creator>Ivan</dc:creator><description>&lt;p&gt;perfect!&amp;nbsp;&lt;br /&gt;Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/216238?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2019 20:02:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46abffbc-13ae-49a9-977e-036cc5b6f2a0</guid><dc:creator>Ivan</dc:creator><description>&lt;p&gt;Perfect, thanx!&lt;br /&gt;Regarding to flash, can I use already exist functions from&amp;nbsp;&lt;strong&gt;nrf_nvmc.h ?&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;like:&amp;nbsp;&lt;br /&gt;&lt;code&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;nrf_nvmc_page_erase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt; &lt;span class="n"&gt;address&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;nrf_nvmc_write_bytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt;  &lt;span class="n"&gt;address&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;uint8_t&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;src&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;uint32_t&lt;/span&gt; &lt;span class="n"&gt;num_bytes&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/216234?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2019 19:23:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32fc8528-f6f5-407e-b9d0-27387a9a0eec</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;If dest points to RAM, yes&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/216233?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2019 19:21:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb778d37-65ee-4983-a8fe-db2468c445bb</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;Some points:&lt;/p&gt;
&lt;p&gt;1) start your update function with __disable_irq()&lt;/p&gt;
&lt;p&gt;2)&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/21734/c-implementation-for-writing-to-nvmc"&gt;here&lt;/a&gt;&amp;nbsp;you can find a code that writes to flash using NVMC, erasing is similar&lt;/p&gt;
&lt;p&gt;3) it&amp;#39;s better to explicitly inline an implementation of NVIC_SystemReset, different compilers may have different view about inlining&lt;/p&gt;
&lt;p&gt;4) The right way of copying function body:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint32_t src = (uint32_t) fw_copy_flash;
memcpy(ram_code_start, (void *)(src &amp;amp; ~1), ram_code_size);

&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You can find size of your function in map file generated by linker.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/216229?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2019 17:59:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee77c33e-09fc-4347-8371-bcec0df9e537</guid><dc:creator>Ivan</dc:creator><description>&lt;p&gt;I find that read from flash is quite simple. Am I right, that regular memcpy can be used?&lt;br /&gt;&lt;br /&gt;memcpy(dest, FLASH_ADDR, size);&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/216228?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2019 17:42:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5828741e-4055-438e-bee4-e812c24e836f</guid><dc:creator>Ivan</dc:creator><description>&lt;p&gt;Thats fine, but how to actually set some function to this pointer?&lt;br /&gt;&lt;br /&gt;Does this correct?&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;typedef void (*update_fw_proc)(void *dest, void *src, u32 size);

//some flash write and reset manage function
static void fw_copy_flash(void *dest, void *src, uint32_t size)
{   
     //some flash copy stuff here via NVMC
     //...
     NVIC_SystemReset();
}

//actualy a function trigger
void execute_fw_update() 
{
    update_fw_proc updater = fw_copy_flash;
    memcpy((void*)(ram_code_start + 1), (update_fw_proc)updater, sizeof(updater)); 
    __dsb(0xf);
    __isb(0xf);
    (updater)(flash_start, new_fw_data, new_firmware_size);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;And how than after flash copy I can perform a reset, still in same function like&lt;br /&gt;&lt;span&gt;NVIC_SystemReset();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;??&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/216219?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2019 15:34:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d40ea012-a3df-48b4-8005-9effebaed4ae</guid><dc:creator>Ivan</dc:creator><description>&lt;p&gt;First, I was looking for FW placed on USB MSD based on FatFS, than my device can be recognized as mass storage, I can simply place .bin file, than read it inside and send over my ESB mesh network to next device and update FW there. But, nrf52832 has no USB, so the only way is to read it directly.&lt;br /&gt;But how in this case I can understand my FW size and how much data actually read from flash?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/216186?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2019 13:15:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b66d15e-18eb-43be-b74e-6955906166de</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;Yes you can, even without RAM routine, but I don&amp;#39;t understand the purpose.. to make a backup?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/216150?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2019 11:51:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5757630b-f870-4b86-b6f5-c0d2b4908860</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;Yes, I made such scheme in my project. The copying procedure should be position-independent and should not use library functions (it&amp;#39;s better to write it in assembly). One tricky thing is to properly jump to RAM address - you should increment address by 1 to ensure THUMB mode, and compiler may optimize this increment out.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The jump can be done this way:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;typedef void (*update_fw_proc)(void *dest, void *src, u32 size);

... copy procedure to ram_code_start ...

update_fw_proc updater = (update_fw_proc) (ram_code_start + 1);
__dsb(0xf);
__isb(0xf);
(updater)(flash_start_addr, new_firmware, new_firmware_size);
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/216142?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2019 11:37:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c23c87d9-33e5-4334-b37e-edec7a2a3d97</guid><dc:creator>Ivan</dc:creator><description>&lt;p&gt;And a more question. Can I do opposide procedure - read existing FW to some other part of flash, verify and than restart to main app again? As I understand it&amp;#39;s a same procedure - some small readout code in RAM?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/216137?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2019 11:33:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17dcc4a9-1410-4fba-b10f-572a0bfd3fd2</guid><dc:creator>Ivan</dc:creator><description>&lt;p&gt;So, you mean that I can handle this from one app.?&lt;br /&gt;Just on some trigger, start some other program in RAM with ability to FLASH to FLASH memory copying to main app start address, and after completing this procedure just reset and start main app again based on new FW now.&lt;br /&gt;&lt;br /&gt;Maybe you can give some advices how to place some extra app. copying code to RAM and tell program to start execution from that address?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 custom simple bootloader implementation.</title><link>https://devzone.nordicsemi.com/thread/216123?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2019 11:06:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90b8f58f-4185-40c8-9779-421f9d7f0d8a</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;there&amp;#39;s no need for bootloader in your case. Assuming you&amp;#39;re not concerned about troubles while updating (otherwise there should be full-featured bootloader with DFU), just write a short piece of code that can be copied to RAM and started by main firmware after disabling softdevice and interrupts. This code will copy firmware (using NVMC registers) and reboot device.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>