<?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>Erasing Flash memory with application loaded via open serial bootloader</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/80205/erasing-flash-memory-with-application-loaded-via-open-serial-bootloader</link><description>Hello, 
 we are using an nRF52833 for our application with the open serial uart bootloader and MBR programmed in it. What we would like to do is: 
 1) program the application via serial bootloader with a temporary firmware (the firmware uses soft device</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 04 Oct 2021 05:31:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/80205/erasing-flash-memory-with-application-loaded-via-open-serial-bootloader" /><item><title>RE: Erasing Flash memory with application loaded via open serial bootloader</title><link>https://devzone.nordicsemi.com/thread/332239?ContentTypeID=1</link><pubDate>Mon, 04 Oct 2021 05:31:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a13ab7ee-8e2e-449c-b4e7-074887162f0a</guid><dc:creator>Dimitris</dc:creator><description>&lt;p&gt;Ok, I see. Thank you for the response!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Erasing Flash memory with application loaded via open serial bootloader</title><link>https://devzone.nordicsemi.com/thread/332172?ContentTypeID=1</link><pubDate>Fri, 01 Oct 2021 13:47:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28b08a0f-d948-4418-8297-82e4464099d8</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Yes, it may behave differently in debug mode.&lt;/p&gt;
&lt;p&gt;1) 2) There is no way to disable the protection after it has been enabled by the bootloader, so the MBR, bootloader, param page, and settings page cannot be erased.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Erasing Flash memory with application loaded via open serial bootloader</title><link>https://devzone.nordicsemi.com/thread/332170?ContentTypeID=1</link><pubDate>Fri, 01 Oct 2021 13:44:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b090cd57-2ba6-4741-bc27-e6574d7d1fc3</guid><dc:creator>Dimitris</dc:creator><description>&lt;p&gt;To my understanding the Access control list is configured at startup by the bootloader and cannot be modified afterwards, only after a reset. Since a reset starts again from the bootloader I suppose there is no way to bypass this...&lt;/p&gt;
&lt;p&gt;I suppose when we tried to program the erasing firmware with the Segger Embedded Studio and the J-Link, the bootloader was bypassed somehow and the code ran directly from the erasing firmware without setting the Access Control List after the reset(?) That is why the erasing firmware works then.&lt;/p&gt;
&lt;p&gt;So my questions are these:&lt;/p&gt;
&lt;p&gt;1) Is there a way to modify the Access Control List when the bootloader is used?&lt;/p&gt;
&lt;p&gt;2) If there is no way to modify it, then the following cannot be implemented, correct?&lt;/p&gt;
[quote userid="77759" url="~/f/nordic-q-a/80205/erasing-flash-memory-with-application-loaded-via-open-serial-bootloader"]program an application via uart bootloader to erase anything but the bootloader and MBR[/quote]&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Erasing Flash memory with application loaded via open serial bootloader</title><link>https://devzone.nordicsemi.com/thread/332166?ContentTypeID=1</link><pubDate>Fri, 01 Oct 2021 13:29:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43ea92f6-9347-45cf-803a-8a836cb252bb</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Yes, the bootloader will protect these pages through the &lt;span class="item"&gt;&lt;a title="ACL &amp;mdash; Access control lists" href="https://infocenter.nordicsemi.com/topic/ps_nrf52833/acl.html?cp=4_1_0_5_2"&gt;ACL &amp;mdash; Access control lists&lt;/a&gt;&lt;/span&gt;, so you should not attempt to erase those.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Erasing Flash memory with application loaded via open serial bootloader</title><link>https://devzone.nordicsemi.com/thread/332165?ContentTypeID=1</link><pubDate>Fri, 01 Oct 2021 13:28:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:39acdfdf-0290-4a37-aebf-a2da07b93958</guid><dc:creator>Dimitris</dc:creator><description>[quote userid="4240" url="~/f/nordic-q-a/80205/erasing-flash-memory-with-application-loaded-via-open-serial-bootloader/332145#332145"]&lt;p&gt;It guess it should work if you erase that page last. Is the code that erase the chip is running from RAM?&lt;/p&gt;
&lt;div class="quote-header"&gt;&lt;/div&gt;&lt;blockquote class="quote"&gt;&lt;div class="quote-content"&gt;&lt;/div&gt;&lt;/blockquote&gt;[/quote]
&lt;p&gt;In this test we tried two firmware versions:&amp;nbsp;One with the code running from Flash and one from RAM. It worked in both cases.&amp;nbsp;This is the last page erased as you mentioned.&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/80205/erasing-flash-memory-with-application-loaded-via-open-serial-bootloader/332145#332145"]Is the application start address set to 0x1000 and ram to 0x20000008 in your linker configuration so it doesn&amp;#39;t overlap with the MBR?[/quote]
&lt;p&gt;Yes, the linker configuration&amp;nbsp;is like&amp;nbsp;the one you mentioned.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;After some more experimentation it seems that the firmware is able to delete most of the pages (soft device, old firmware) but it gets stuck when trying to delete any of the following pages (probably a hard fault):&lt;br /&gt;&lt;br /&gt;- The page starting from 0x1000 (where the erasing firmware is programmed): this is odd because the function that erases it runs from the RAM.&lt;br /&gt;- The page that starts from 0x7F000 and 0x7E000 (which as I can understand are the MBR parameters, and Bootloader Settings Pages)&lt;/p&gt;
&lt;p&gt;More specifically&amp;nbsp;the&amp;nbsp;problem happens&amp;nbsp;when writing those addresses in the NVMC ERASE register (either one of them, we tried them all).&lt;/p&gt;
&lt;p&gt;Is it possible&amp;nbsp;that the bootloader &amp;quot;locks&amp;quot; those pages? Is there a way to bypass this lock?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Erasing Flash memory with application loaded via open serial bootloader</title><link>https://devzone.nordicsemi.com/thread/332145?ContentTypeID=1</link><pubDate>Fri, 01 Oct 2021 12:24:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:80c27d8f-1db7-47d1-9816-26fcee493ea2</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""]&amp;nbsp;3.1)&amp;nbsp;We programmed an empty device without a bootloader with the erasing firmware (Flash set to start at address 0x0) to test if it could erase itself and it could. &lt;span&gt;The erasing function was set to run from RAM. We also tried it with the erasing function&amp;nbsp;&lt;/span&gt;not run from RAM and it also worked,&amp;nbsp;which is a bit confusing, we expected this not to work since when the page was erased, it was in use(?)&amp;nbsp;[/quote]
&lt;p&gt;It guess it should work if you erase that page last. Is the code that erase the chip is running from RAM?&lt;/p&gt;
[quote user=""]The function to erase firmware was set to run from RAM again. When the device is loaded with MBR, bootloader and the temporary firmware:&lt;br /&gt;- if we program the erasing firmware via a J-Link debugger through embedded studio, the memory (soft device etc, previous application and the erasing firmware) is erased, leaving the bootloader intact. (in other words it works as it should)&lt;br /&gt;- When the device is programmed via uart using the bootloader, it does not work (it seems to stop when writing to NVMC erase register.[/quote]
&lt;p&gt;Is the application start address set to 0x1000 and ram to 0x20000008 in your linker configuration so it doesn&amp;#39;t overlap with the MBR?&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;Vidar&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>