<?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>DFU Bootloader uploading smaller App</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/126525/dfu-bootloader-uploading-smaller-app</link><description>Hi, 
 we have a NRF52832 based project / product. We are using a DFU bootloader for application and SD update. The update is done from a master microcontroller using UART. 
 Our update packages are created using the Nordic Tools and uploaded to the master</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 16 Jan 2026 22:14:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/126525/dfu-bootloader-uploading-smaller-app" /><item><title>RE: DFU Bootloader uploading smaller App</title><link>https://devzone.nordicsemi.com/thread/558921?ContentTypeID=1</link><pubDate>Fri, 16 Jan 2026 22:14:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f3793cc-e73c-4888-9300-14531c4348cd</guid><dc:creator>MM-MUC</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;I tried to reproduce that behaviour today. However, in the meantime to much changed on the side of our master microcontroller and that code is no longer compatible with the bootloader. Rolling back all that would be to time consuming. Therefore I hope the problem was just an isolated incident.&lt;/p&gt;
&lt;p&gt;Marcus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU Bootloader uploading smaller App</title><link>https://devzone.nordicsemi.com/thread/558853?ContentTypeID=1</link><pubDate>Fri, 16 Jan 2026 07:06:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9060e551-9c0d-49ab-9be9-4efa14479966</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Marcus,&lt;/p&gt;
&lt;p&gt;Thank you for the update. I&amp;#39;m afraid&amp;nbsp;I can&amp;#39;t think of any&amp;nbsp;explanation for this either. Please update the ticket if you manage to reproduce this again and collect more debug more information.&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU Bootloader uploading smaller App</title><link>https://devzone.nordicsemi.com/thread/558837?ContentTypeID=1</link><pubDate>Thu, 15 Jan 2026 21:12:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38fc8b71-8150-47dc-8914-93eef3d9597e</guid><dc:creator>MM-MUC</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;very strange, I just tested it again. Now after the initial flash was done with the short version of the file, everything is fine I can flash short and long files back and forth without any problems.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;No idea what was happening before, when I initially installed (via nrfjprog) the file with the long application.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Marcus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU Bootloader uploading smaller App</title><link>https://devzone.nordicsemi.com/thread/558814?ContentTypeID=1</link><pubDate>Thu, 15 Jan 2026 14:24:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a2edc46-1653-40ef-b67d-aeeb2b78e14e</guid><dc:creator>MM-MUC</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;I agree, as the flash is written in 4096 Byte pages it&amp;#39;s really strange that this happens.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Usually that won&amp;#39;t even be a problem as the size of an application normally increases. I only came across the problem after removing some debug RTT_printfs.&lt;/p&gt;
&lt;p&gt;I will try reading the flash later today and let you know what I can see.&lt;/p&gt;
&lt;p&gt;Marcus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU Bootloader uploading smaller App</title><link>https://devzone.nordicsemi.com/thread/558812?ContentTypeID=1</link><pubDate>Thu, 15 Jan 2026 14:02:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09380124-9a50-4870-9693-e3f2696ffef0</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Marcus,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t recall seeing any issues like this before. The hash function should&amp;nbsp;accepts input of arbitrary length and handle any required padding internally.&lt;br data-start="172" data-end="175" /&gt;The flash is also erased progressively in 0x1000 byte sectors as the image is received by the bootloader, so any data following the application should still be&amp;nbsp;0xFFFF (until you reach the&amp;nbsp;next page aligned address). I still think it&amp;#39;s worth reading out the flash as suggested initially. Then you can easily compare what is actually different in the working&amp;nbsp;and &amp;nbsp;failing cases.&lt;/p&gt;
&lt;p&gt;Reading flash with nrfutil&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfutil device read --address 0x0 --bytes 0x80000 &amp;gt; flash_content.txt&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;With nrfjprog&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfjprog --memrd 0x0 --n 0x80000 &amp;gt; flash_content.txt&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU Bootloader uploading smaller App</title><link>https://devzone.nordicsemi.com/thread/558805?ContentTypeID=1</link><pubDate>Thu, 15 Jan 2026 13:13:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f53c7dd-1a16-482b-9036-aef68d74b2a5</guid><dc:creator>MM-MUC</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;the debug of the bootloader shows the image size when the CRC is computed. That is the size I upload in my code. As my master microcontroller doesn&amp;#39;t have code to unzip I have a tool that unzips the update package and packs everything into a single file with a header that contains the sizes of all parts of the update. Furthermore I do a CRC over this package so that I know that the data that has been uploaded to the master is correct.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I am sure that the correct code is written to the flash because exactly the same image file doesn&amp;#39;t fail when there hasn&amp;#39;t been a larger file on the nRF52 before. I did that some dozen times back and forth and it only and consistently fails when there has been a larger image in flash before.&lt;/p&gt;
&lt;p&gt;Furthermore before the signature is checked, a CRC is computed for the uploaded image by the bootloader. That CRC is correct (shown by the debugger). Only the ECDSA signature verification fails. My guess is, that the SHA256 that uses 512Bit/64 Byte blocks doesn&amp;#39;t have the correct padding if there is some old data in flash. The CRC in contrast is done byte by byte and doesn&amp;#39;t need any padding.&lt;/p&gt;
&lt;p&gt;Marcus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU Bootloader uploading smaller App</title><link>https://devzone.nordicsemi.com/thread/558799?ContentTypeID=1</link><pubDate>Thu, 15 Jan 2026 12:41:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4cd05c0-dd68-4205-95c6-b22347e90707</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote userid="150140" url="~/f/nordic-q-a/126525/dfu-bootloader-uploading-smaller-app/558797"]the debugger reports the correct image sizes.[/quote]
&lt;p&gt;can you show what you mean by this? Are you reading the image size from the settings struct, and does this match the size of the binary you uploaded?&lt;/p&gt;
[quote userid="150140" url="~/f/nordic-q-a/126525/dfu-bootloader-uploading-smaller-app/558797"]The code itself written to the flash is correct as well[/quote]
&lt;p&gt;Can you show me how you confirmed this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU Bootloader uploading smaller App</title><link>https://devzone.nordicsemi.com/thread/558797?ContentTypeID=1</link><pubDate>Thu, 15 Jan 2026 12:38:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:caac16be-2b2d-47e9-bd46-e2e02932d5e6</guid><dc:creator>MM-MUC</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;the debugger reports the correct image sizes. The code itself written to the flash is correct as well. Exactly the same image can be uploaded when there hasn&amp;#39;t been a larger image installed before. As soon as I increase the application size by using some const arrays the image installs fine.&lt;/p&gt;
&lt;p&gt;Please note that I am only using a single bank as my application might be too large for bank switching in the future.&lt;/p&gt;
&lt;p&gt;The app sizes are 159138 and 159432 bytes.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The bootloader is based on SDK 17.1.0.&lt;/p&gt;
&lt;p&gt;Marcus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU Bootloader uploading smaller App</title><link>https://devzone.nordicsemi.com/thread/558753?ContentTypeID=1</link><pubDate>Thu, 15 Jan 2026 08:00:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9e5ddcf-0db7-4988-be1c-0e84138e4466</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not aware of any known issues that could explain this. Some suggestions for troubleshooting this further:&lt;/p&gt;
&lt;p&gt;1. Attach a debugger and read out the bootloader settings page at the end of flash and check if the application size (&lt;a href="https://docs.nordicsemi.com/bundle/sdk_nrf5_v17.1.0/page/structnrf_dfu_settings_t_1.html"&gt;nrf_dfu_settings_t -&amp;gt; bank0 -&amp;gt; image_size&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;2. Read out the app image from bank0 and compare it to the original binary to see if there are any discrepancies.&lt;/p&gt;
&lt;p&gt;Please also let me know what SDK version your bootloader was based on, and what the exact size of the app image in the working and failing case.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>