<?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>nrf5340 bootloader</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/123917/nrf5340-bootloader</link><description>Hi, 
 I am a bit stuck with configuring nrf5340 project to include the bootloader properly. 
 The SDK-toolchain I use is v3.0.2 
 What I need: 
 encrypted and signed update image. At least for the application core, as the network core FW comes from a</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 27 Aug 2025 13:04:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/123917/nrf5340-bootloader" /><item><title>RE: nrf5340 bootloader</title><link>https://devzone.nordicsemi.com/thread/546922?ContentTypeID=1</link><pubDate>Wed, 27 Aug 2025 13:04:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3822fa12-458d-4a3c-a5f4-273cd0d19c7e</guid><dc:creator>mke</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Ok, I understand.&lt;/p&gt;
&lt;p&gt;I figured out a solution: I enabled&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_MCUBOOT_ACTION_HOOKS&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;And provided the hook. In the hook, if the status is &amp;quot;IMAGE_FOUND&amp;quot;, which is reported just before booting the app, I set the &amp;quot;BOOT_MODE_TYPE_BOOTLOADER&amp;quot;. The retention mode boot then sees it next reboot, which might be caused by a system crash.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;This is good enough for now. Application is not supposed to reboot itself; there is no reason for that normally. But the boot mode can be changed in the application if required etc.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;I might enable timeout as well, will think about it. But setting the boot mode already in the bootloader is also satisfactory and pretty safe, I guess.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;BR, Madis&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340 bootloader</title><link>https://devzone.nordicsemi.com/thread/546906?ContentTypeID=1</link><pubDate>Wed, 27 Aug 2025 12:30:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f48d2458-5e53-4cf3-8bf0-7d71a53cc07e</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Ideally there should be a fallback method to enter serial mode if the updated app is not functional. For example, you can enable BOOT_SERIAL_WAIT_FOR_DFU to make the bootloader always enter serial recovery mode for a specified duration&amp;nbsp;on startup.&lt;/p&gt;
[quote user="mke"]So, the bootloader is capable of doing a swapping kind of update for the application image. The only thing I need is to disable the direct write to the primary partition.[/quote]
&lt;p&gt;I do not see any existing Kconfig config settings for serial recovery mode that can be applied to achieve this, so it seems like&amp;nbsp;thus would require you to patch the mcuboot code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340 bootloader</title><link>https://devzone.nordicsemi.com/thread/546874?ContentTypeID=1</link><pubDate>Wed, 27 Aug 2025 10:07:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05f9c839-6eb5-44c7-9b16-3b7e6c32f4ea</guid><dc:creator>mke</dc:creator><description>&lt;p&gt;Thank you for your comments.&lt;/p&gt;
&lt;p&gt;If the bootloader is configured to stay in recovery mode only when there is no application, or via the retention system, the bootloader will boot the image from the primary partition if one is there. Although if the image is wrong and was originally intended for the network core.&lt;/p&gt;
&lt;p&gt;Now the application crashes, naturally, and the same process repeats. So there is no way to enter the bootloader, and the device is bricked. As there is no application running capable of entering the bootloader, and bootloader thinks that there is a valid image and boots it. This can happen.&lt;/p&gt;
&lt;p&gt;If I use mcumgr image upload -n2, the application image is written to the secondary partition and swapped upon reboot, if requested by &amp;quot;test&amp;quot; or &amp;quot;confirm&amp;quot;,&lt;/p&gt;
&lt;p&gt;If I then write netcore image with -n2, the image is correctly identified to be for the netcore and updated to there. Although there are few things:-) But bricking the device is not foreseen.&lt;/p&gt;
&lt;p&gt;Using -n3 for netcore is the correct one, and writing the image works perfectly. Wrong image gets rejected etc.&lt;/p&gt;
&lt;p&gt;So, the bootloader is capable of doing a swapping kind of update for the application image. The only thing I need is to disable the direct write to the primary partition.&lt;/p&gt;
&lt;p&gt;Can you hint some configuration options for that, if possible?&lt;/p&gt;
&lt;p&gt;BR, Madis&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340 bootloader</title><link>https://devzone.nordicsemi.com/thread/546854?ContentTypeID=1</link><pubDate>Wed, 27 Aug 2025 08:04:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aec4c3f7-1dcf-43b0-90e3-a1cf3a7eaaaf</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;In serial recovery mode (dfu within the bootloader), you have the option to upload the image directly to the primary slot which removes the possibility to do any pre-validation. But you can always enter serial recovery mode again an reupload the correct image.&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><item><title>RE: nrf5340 bootloader</title><link>https://devzone.nordicsemi.com/thread/546737?ContentTypeID=1</link><pubDate>Tue, 26 Aug 2025 10:32:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7969d9c7-2a55-41b3-96ac-f5fd89e200cf</guid><dc:creator>mke</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Thank you for the hint. It is an elegant solution. Now I have only two partitions and can update both of the cores using the second flash partition.&lt;/p&gt;
&lt;p&gt;There is still something&amp;nbsp;that needs improvement, and I need to address it somehow.&lt;/p&gt;
&lt;p&gt;Currently, both images are written directly to the target slot after I upload the image using mcumgr, which is ok.&lt;/p&gt;
&lt;p&gt;But the problem is that if I write netcore image without using &amp;quot;-n 3&amp;quot; to indicate that the image is supposed to be for the netcore, the image gets written to the application image memory directly, mcuboot_primary.&lt;/p&gt;
&lt;p&gt;So there is no &amp;quot;swap/test&amp;quot; functionality in the bootloader. And that can potentially brick the product; if it is possible to brick it, it will happen sooner or later.&lt;/p&gt;
&lt;p&gt;So, is it possible to use configuration to force the mcuboot to verify the image before writing it to the final target partition, netcore or appcore main flash partition 1?&lt;/p&gt;
&lt;p&gt;The verification seems to be fine for netcore, if I upload&amp;nbsp;zephyr.signed.encrypted.bin image using -n 3, the b0n reports that it was unable to find a valid fw.&lt;/p&gt;
&lt;p&gt;In short: updating netcore with the wrong image gets rejected. But updating application core with netcore image is possible, image is directly written without any test/swap or something similar. And this is something I need to fix.&lt;/p&gt;
&lt;p&gt;I tried playing with &amp;quot;CONFIG_MCUMGR=y&amp;quot; and its dependencies, but the build fails because of nrf53 hooks get multiple definitions.&lt;/p&gt;
&lt;p&gt;BR, Madis&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340 bootloader</title><link>https://devzone.nordicsemi.com/thread/546611?ContentTypeID=1</link><pubDate>Mon, 25 Aug 2025 11:25:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05b6e538-53ad-4dae-8123-562c1ddd1ba7</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello Madis,&lt;/p&gt;
&lt;p&gt;Please have a look at the sample I posted here:&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/119315/bug-in-secure-boot-b0n-related-partition-configuration-for-nrf5340-under-sysbuild-in-sdk-v2-9-0/525315"&gt;RE: Bug in Secure Boot / b0n related partition configuration for nRF5340 under sysbuild in SDK v2.9.0?&lt;/a&gt;&amp;nbsp;&amp;nbsp;&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/pastedimage1756121094656v1.png" alt=" " /&gt;&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>