<?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 with Custom DFU</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/98913/bootloader-with-custom-dfu</link><description>We have an existing DFU to deliver the pending firmware in flash. I need to develop a custom bootloader that copies the pending firmware and activates it. I am close but getting stuck. 
 Issue : 
 - When app_activate() is called, it just skips over it</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 27 Apr 2023 06:25:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/98913/bootloader-with-custom-dfu" /><item><title>RE: Bootloader with Custom DFU</title><link>https://devzone.nordicsemi.com/thread/422628?ContentTypeID=1</link><pubDate>Thu, 27 Apr 2023 06:25:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66d599ca-7f1f-47b0-9696-41fdc82185b5</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I am no IAR expert, but as long as you specify the start of a page as the application start address (see under&amp;nbsp;7. Change start addresses for the IAR h&lt;a href="https://devzone.nordicsemi.com/guides/short-range-guides/b/getting-started/posts/adjustment-of-ram-and-flash-memory"&gt;ere&lt;/a&gt;), then that should work (?).&lt;/p&gt;
&lt;p&gt;Regarding if you should be concerned I cannot recall ever dealing with an application that was not page aligned, but at the same time, I cannot immediately think of a reason why it should cause problems when using a bootloader (the address&amp;nbsp; should&amp;nbsp;be word aligned, though).&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader with Custom DFU</title><link>https://devzone.nordicsemi.com/thread/422577?ContentTypeID=1</link><pubDate>Wed, 26 Apr 2023 15:42:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0698d904-69c4-4ae0-a622-9f873b0eda02</guid><dc:creator>erk1313</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/eith"&gt;Einar Thorsrud&lt;/a&gt;&amp;nbsp;What are your thoughts on IAR compiling binary files that are not page aligned? Should I be concerned?&amp;nbsp; Is there a way to force it to be page aligned?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader with Custom DFU</title><link>https://devzone.nordicsemi.com/thread/422532?ContentTypeID=1</link><pubDate>Wed, 26 Apr 2023 13:00:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66f7c0ce-88e8-48b8-8c78-1b0a1a429806</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;As the nRF5 SDK bootloader only supports booting applications in slot 0 which start right after the SoftDevice (or MBR if no SoftDevice is used), there is also no support in the accompanying tools like nrfutil for other configurations. That said, the you can clone &lt;a href="https://github.com/NordicSemiconductor/pc-nrfutil"&gt;pc-nrfutil&lt;/a&gt; and modify it to your needs for your custom bootloader / DFU solution.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader with Custom DFU</title><link>https://devzone.nordicsemi.com/thread/422286?ContentTypeID=1</link><pubDate>Tue, 25 Apr 2023 12:26:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:217a9494-616f-4029-aecb-7ffdf94e58da</guid><dc:creator>erk1313</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/eith"&gt;Einar Thorsrud&lt;/a&gt;&amp;nbsp;Thank you for your help! Is there a way to create bootloader settings for bank1 using the NRF Utilities?&amp;nbsp; Our application requires a custom transport layer and I would like to create firmware offset for bank1 along with bootloader settings for bank1.&amp;nbsp; I understand this is usually handled in the DFU transport layer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader with Custom DFU</title><link>https://devzone.nordicsemi.com/thread/421773?ContentTypeID=1</link><pubDate>Fri, 21 Apr 2023 13:20:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:63d31e28-c072-47f0-8159-2a17d2a0623f</guid><dc:creator>erk1313</dc:creator><description>&lt;p&gt;For others, note that SDK15.3 places the bootloader start address elsewhere:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/53290/how-to-read-flash_start-address-of-bootloader-in-application"&gt;devzone.nordicsemi.com/.../how-to-read-flash_start-address-of-bootloader-in-application&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader with Custom DFU</title><link>https://devzone.nordicsemi.com/thread/421770?ContentTypeID=1</link><pubDate>Fri, 21 Apr 2023 13:15:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:77f184ce-e2aa-4a4d-8e9f-b5e528871d04</guid><dc:creator>erk1313</dc:creator><description>&lt;p&gt;I suppose an alternative would be to manually overwrite it using&amp;nbsp;&lt;/p&gt;
&lt;div class="content full threaded-reply-content user-defined-markup" data-replyid="103518" data-userid="7571" data-permalink="~/f/nordic-q-a/26300/how-to-use-nrfjprog-to-write-uicr-bootloaderaddr/103518"&gt;
&lt;div class="content"&gt;
&lt;div class="content-scrollable-wrapper"&gt;
&lt;pre&gt;&lt;code&gt;nrfjprog -f nrf52 --memwr 0x10001014 --val &amp;lt;value&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader with Custom DFU</title><link>https://devzone.nordicsemi.com/thread/421767?ContentTypeID=1</link><pubDate>Fri, 21 Apr 2023 13:07:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ba61049-1954-4011-8800-120567448021</guid><dc:creator>erk1313</dc:creator><description>&lt;p&gt;Success, with some manual manipulation.&lt;/p&gt;
&lt;p&gt;1. &lt;span style="text-decoration:underline;"&gt;Uploading pending FW update&lt;/span&gt;.&amp;nbsp; I place the pending FW update in Bank 2 and read the bootloader settings into a new structure &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;(s_dfu_settings&lt;/span&gt;) by calling&amp;nbsp;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;nrf_dfu_settings_init&lt;/span&gt;.&amp;nbsp; After updating the fields below, I call&amp;nbsp;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;nrf_dfu_settings_write() &lt;/span&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;to write the settings to Flash.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p dir="auto" data-sourcepos="17:1-17:18"&gt;&lt;strong&gt;s_dfu_settings&lt;/strong&gt;&lt;/p&gt;
&lt;div class="gl-relative markdown-code-block js-markdown-code"&gt;
&lt;pre id="code-12" class="code highlight js-syntax-highlight language-plaintext monokai" lang="plaintext" data-canonical-lang="" data-sourcepos="19:5-22:0"&gt;&lt;code&gt;&lt;span id="LC1" class="line" lang="plaintext"&gt;- Set bank-1.image size and .image_crc:&lt;/span&gt;
&lt;span id="LC2" class="line" lang="plaintext"&gt;- Set bank_1.bank_code to 1 to indicate the bank had valid firmware&lt;/span&gt;
&lt;span id="LC3" class="line" lang="plaintext"&gt;- Set .progress.update_start_address to the start address of bank-1&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;2. &lt;span style="text-decoration:underline;"&gt;On Bootloader Startup&lt;/span&gt;, I call &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;ret_nrf_bootloader_init(NULL)&lt;/span&gt;&amp;nbsp;which handles the update, eventually calling&amp;nbsp;&amp;nbsp;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;app_activate()&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;to copy the firmware to bank-0, then reset the device.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;&lt;strong&gt;~~~QUESTION~~~&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;To step through the code, I have to set optimization to NONE and enlarge the space allocated to the bootloader by one page.&amp;nbsp; This includes changing the ROM_region in the .icf&amp;nbsp; file and the definition of the&amp;nbsp;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;BOOTLOADER_START_ADDR:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;From: #define BOOTLOADER_START_ADDR (CODE_START)&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;To: #define BOOTLOADER_START_ADDR&amp;nbsp;0x000F7000&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;However, should I be modifying CODE_START instead?&amp;nbsp; How would one do that?&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;#define CODE_START ((uint32_t)&amp;amp;__vector_table)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Also, I&amp;#39;d like to avoid modifying the SDK, as it is a shared resource for other projects.&amp;nbsp; But when I define&amp;nbsp;&lt;span&gt;BOOTLOADER_START_ADDR, I receive the error &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;incompatible redefinition.&amp;nbsp; &lt;span style="font-family:arial, helvetica, sans-serif;"&gt;How can I define this without touching the SDK?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p dir="auto" data-sourcepos="17:1-17:18"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;code&gt;&lt;span id="LC3" class="line" lang="plaintext"&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;div class="gl-relative markdown-code-block js-markdown-code"&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader with Custom DFU</title><link>https://devzone.nordicsemi.com/thread/421472?ContentTypeID=1</link><pubDate>Thu, 20 Apr 2023 11:52:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14bbc3f9-8956-4488-9703-4b13671bdcea</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I do not have a full overview of your bootloader, but I will try to give some pointers and suggestions in hope that some may be useful.&lt;/p&gt;
&lt;p&gt;Debugging an application that is optimized is difficult, but the SDK bootloader (that you have based your on) use RTT loggign extensively if you build the debug variant, and you could add more logging relevant for what you are currently debugging. Enabling logging (which is done in the _debug sample bootloader projects) does increase the size though, so you need to be able to fit that while debugging. Another option could perhaps be to build the bootloader without optimization and accept that it is larger while debugging the bootloader, and use a simpler test application while&amp;nbsp;doing this if you are able to make it fit? (This would be just while working on the bootloader).&lt;/p&gt;
&lt;p&gt;Regarding removing the transports, the transports are quite decoupled from the rest of the bootloader, and are&amp;nbsp;registered build time via a section variable that holds the list of backends that is initialized one after another. You should not have to make many adjustments other than just remove all the files used for the transport (for instance serial UART if you based your bootloader on a project that used that).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader with Custom DFU</title><link>https://devzone.nordicsemi.com/thread/421335?ContentTypeID=1</link><pubDate>Wed, 19 Apr 2023 21:23:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2bdd7743-7a5f-443e-ae92-43678af7b1a7</guid><dc:creator>erk1313</dc:creator><description>&lt;p&gt;Hmm... That did copy the pending firmware update, but put it higher.&amp;nbsp; Need to look closer at the offset address.&amp;nbsp; Maybe I should create bootloader settings based on the app before offset.&amp;nbsp; Then load the pending update manually.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1681939357573v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader with Custom DFU</title><link>https://devzone.nordicsemi.com/thread/421333?ContentTypeID=1</link><pubDate>Wed, 19 Apr 2023 21:16:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:649468ce-ec2a-451b-b523-156a405c6085</guid><dc:creator>erk1313</dc:creator><description>&lt;p&gt;I just realized I need to set the address of the pending fw update.&amp;nbsp; It did not help though.&amp;nbsp; What other settings are normally handled by the DFU?&lt;/p&gt;
&lt;p&gt;- s_dfu_settings.progress.update_start_address = 0x85000&amp;nbsp; // Bank-1&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader with Custom DFU</title><link>https://devzone.nordicsemi.com/thread/421332?ContentTypeID=1</link><pubDate>Wed, 19 Apr 2023 21:08:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be7b7b0a-ec04-40f4-9f1e-7539373fd080</guid><dc:creator>erk1313</dc:creator><description>&lt;p&gt;I tried setting the optimization lower than &amp;quot;high&amp;quot; but the bootloader is too large.&amp;nbsp; That&amp;#39;s probably why I can&amp;#39;t follow it in the debugger. Is there an easy way to cut back on the bootloader, as I don&amp;#39;t need the transport functions?&lt;/p&gt;
&lt;p&gt;Disassembly of the app_activate() function responsible for copying the pending FW update.&amp;nbsp; It gets to 0xf&amp;#39;a164 ADDS, then jumps out of the function.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1681938370392v1.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>