<?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>Bootloader via DFU</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/79585/bootloader-via-dfu</link><description>I have a few questions about the DFU: 
 Is it necessary to flash everything together (Bootloader, DFU, APP) for the initial programming when testing buttonless secure DFU without bonds? 
 In the sections that are about the “Buttonless DFU Template Application</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 24 Sep 2021 11:56:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/79585/bootloader-via-dfu" /><item><title>RE: Bootloader via DFU</title><link>https://devzone.nordicsemi.com/thread/331064?ContentTypeID=1</link><pubDate>Fri, 24 Sep 2021 11:56:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c22fdbb4-fce7-43b0-b85f-6aec0ff93742</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Wes,&lt;/p&gt;
[quote user="WesC"]Right now, it’s all about the bootloader and getting SES to debug the whole thing (MBR, Bootloader with settings page, SoftDevice, and my application.)[/quote]
&lt;p&gt;It depends on what you want to accomplish. You write &amp;quot;&lt;em&gt;debug the whole thing (MBR, Bootloader with settings page, SoftDevice, and my application.)&lt;/em&gt;&amp;quot;. Just to make it clear, you cannot easily debug the SoftDevice or MBR, as that is closed source. For the bootloader, you normally stick with debug logging. it is possible to build without optimization to do proper debugging also, but that normally not needed.&lt;/p&gt;
[quote user="WesC"]My original tests were done in the nRF52840 DK with my updated FW, and the SoftDevice – no bootloader. I learned from breakpoints, that I must have the bootloader or I’ll never get past the first DFU function call – ble_dfu_buttonless_async_svci_init().[/quote]
&lt;p&gt;Yes, that is correct. Alternatively you could comment out the call when debugging the application (as long as you don&amp;#39;t intend to test buttonless DFU, but that is not relevant anyway without a bootloader present).&lt;/p&gt;
[quote user="WesC"]Is this the “debug bootloader” they talk about on the DevZone, or do I need to do other stuff to it?[/quote]
&lt;p&gt;The debug bootloader both has changes in sdk_config.h and in which files are added in the project (for RTT logging). You can compare the differences by looking at all example bootloader under &amp;lt;SDK&amp;gt;\examples\dfu\secure_bootloader\. For every project, there is a corresponding _debug project ending with &amp;quot;_debug&amp;quot;. The difference is that it included extensive RTT logging. This increases the size, and thus decreases the start address. Except for the logging they are functionally the same as the &amp;quot;normal&amp;quot; bootloader example projects.&lt;/p&gt;
[quote user="WesC"]I didn’t find anything, but do I need to change anything in the Bootloader Settings Page?[/quote]
&lt;p&gt;That depends on what you want to do. If you make any changes to the application, you will always need to update the bootloader settings page with a updated hash of the application after building it so that the bootloader deems it valid. Alternatively, which I typically recommend when debugging an application with a bootloader present, modify the bootloader so that when testing it always assumes the application is valid. You can do this by modifying&amp;nbsp;app_is_valid() in&amp;nbsp;components\libraries\bootloader\nrf_bootloader.c so that it always returns true.&lt;/p&gt;
[quote user="WesC"]I can clear flash with nrfjprog, and use nRF Connect to program the SoftDevice and B/L (with settings page merged into it), but will SES&amp;nbsp; just erase what I just described?[/quote]
&lt;p&gt;Yes. When you program an application from SES is will only perform sector erase on the pages you are overwriting. So the rest will be left as is.&lt;/p&gt;
[quote user="WesC"]Do I need to manually program my buttonless DFU w/o bonds with nRF Connect too, and just tell the bootloader to debug?[/quote]
&lt;p&gt;No, SES will program for you when you start to debug.&lt;/p&gt;
[quote user="WesC"]Or is there something else needed to pull this off? Will SES agree to debug something it didn’t flash?[/quote]
&lt;p&gt;By default it will flash before debugging, and that is normally sensible. (You can debug without programming first as well by selecting Target -&amp;gt; Attach Debugger.)&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader via DFU</title><link>https://devzone.nordicsemi.com/thread/330922?ContentTypeID=1</link><pubDate>Thu, 23 Sep 2021 18:58:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:77856d40-b7c8-4130-9d3e-5513d81e127a</guid><dc:creator>WesC</dc:creator><description>&lt;p&gt;Thanks for the information.&amp;nbsp; I have a few more questions:&lt;/p&gt;
&lt;p&gt;I have questions, after reading on DevZone about debugging DFU. Right now, it&amp;rsquo;s all about the bootloader and getting SES to debug the whole thing (MBR, Bootloader with settings page, SoftDevice, and my application.)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;My original tests were done in the nRF52840 DK with my updated FW, and the SoftDevice &amp;ndash; no bootloader. I learned from breakpoints, that I must have the bootloader or I&amp;rsquo;ll never get past the first DFU function call &amp;ndash; ble_dfu_buttonless_async_svci_init().&lt;/li&gt;
&lt;li&gt;I read every related question on DevZone. So here&amp;rsquo;s what I have done, and then my questions:&lt;ol&gt;
&lt;li&gt;&lt;ol&gt;
&lt;li&gt;&lt;ol&gt;
&lt;li&gt;I know I need a bootloader with Buttonless DFU and Without Bonds, and in sdk_config.h I set:&lt;ol&gt;
&lt;li&gt;NRF_BL_DFU_ENTER_METHOD_BUTTON to Zero (0) because I have no buttons on the (eventual) target HW.&lt;/li&gt;
&lt;li&gt;NRF_BL_DFU_ENTER_METHOD_BUTTONLESS to one (1).&lt;/li&gt;
&lt;li&gt;NRF_DFU_APP_ACCEPT_SAME_VERSION to one (1).&lt;/li&gt;
&lt;li&gt;NRF_DFU_APP_DOWNGRADE_PREVENTION to zero (0).&lt;/li&gt;
&lt;li&gt;NRF_DFU_HW_VERSION 2 same as what I have been using successfully with BUTTON.&lt;/li&gt;
&lt;li&gt;NRF_DFU_BLE_REQUIRES_BONDS to zero (0).&lt;/li&gt;
&lt;li&gt;Nothing else in my config file version was changed relative to the example secure bootloader sdk_config.h file.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;Is this the &amp;ldquo;debug bootloader&amp;rdquo; they talk about on the DevZone, or do I need to do other stuff to it?&lt;/li&gt;
&lt;li&gt;I didn&amp;rsquo;t find anything, but do I need to change anything in the Bootloader Settings Page?&lt;/li&gt;
&lt;li&gt;I can clear flash with nrfjprog, and use nRF Connect to program the SoftDevice and B/L (with settings page merged into it), but will SES&amp;nbsp; just erase what I just described? Do I need to manually program my buttonless DFU w/o bonds with nRF Connect too, and just tell the bootloader to debug? Or is there something else needed to pull this off? Will SES agree to debug something it didn&amp;rsquo;t flash?&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader via DFU</title><link>https://devzone.nordicsemi.com/thread/329461?ContentTypeID=1</link><pubDate>Tue, 14 Sep 2021 13:36:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed9d6444-da23-4d80-933b-fbc58fbc5315</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Wes,&lt;/p&gt;
[quote user=""]Is it necessary to flash everything together (Bootloader, DFU, APP) for the initial programming when testing buttonless secure DFU without bonds?[/quote]
&lt;p&gt;No, In this case it is enough to flash the bootloader and SoftDevice (or only MBR would be sufficient if using another transport than BLE). In this case, the MBR will start the bootloader, and the bootloader will enter DFU mode as there is no valid application present.&lt;/p&gt;
[quote user=""]When I need to update that bootloader on all products, can I do it with one DFU image?[/quote]
&lt;p&gt;In theory yes, but in practice, no. It is probably not sensible to use the same bootloader on different products. This is because the bootloader can check if a upgrade image is suitable for itself or not, using&amp;nbsp;NRF_DFU_HW_VERSION. This is set in the bootloader&amp;#39;s sdk_config.h and is checked against the HW version that is specified when generating the .zip package using nrfutil. If those are not the same, upgrade will not be allowed. That way you ensure that only firmware suitable for the specific device can be used.&lt;/p&gt;
[quote user=""]If not, do I need a separate DFU image for every unique application?[/quote]
&lt;p&gt;Yes. There is no support for several applications in a single DFU image (though you can have both SoftDevice, application and bootloader in a single image).&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>