<?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>MCUboot test and confirm with DFU Target library</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/118273/mcuboot-test-and-confirm-with-dfu-target-library</link><description>I&amp;#39;m adding MCUboot to my application and we&amp;#39;ll be using our own app to upload new firmware over BLE to the device over our custom comms protocol. I can use the DFU Target library to transfer the uploaded blocks into the second application slot, and it</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 11 Mar 2025 17:05:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/118273/mcuboot-test-and-confirm-with-dfu-target-library" /><item><title>RE: MCUboot test and confirm with DFU Target library</title><link>https://devzone.nordicsemi.com/thread/526812?ContentTypeID=1</link><pubDate>Tue, 11 Mar 2025 17:05:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8bc2c0ed-4e72-4515-b07f-2d7858c733b4</guid><dc:creator>BrianW</dc:creator><description>&lt;p&gt;just for info, because it took me a long time to find, make sure your primary and secondary partitions are aligned on your flash erase sector size boundary (0x1000 for me) for BOTH their start AND their size... (otherwise the mcuboot trailers are not updated during swap, and the confirmation doesn&amp;#39;t work)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot test and confirm with DFU Target library</title><link>https://devzone.nordicsemi.com/thread/520167?ContentTypeID=1</link><pubDate>Mon, 27 Jan 2025 12:51:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:603755c3-644d-4512-899c-a53ebbc4923d</guid><dc:creator>simonhwm</dc:creator><description>&lt;p&gt;In case it helps anyone else with the same question,&amp;nbsp;I searched the ncs 2.8.0 folder structure and found the following:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;dfu_target_schedule_update(img_num)&lt;/span&gt;, when used with MCUboot, internally calls &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;boot_request_upgrade_multi(img_num, BOOT_UPGRADE_TEST)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;So scheduling an update and rebooting will boot the new application code as test. It needs to be confirmed&amp;nbsp;in my application code after reboot and once I&amp;#39;ve established BLE connection again to to prove that the new code is working.&lt;/p&gt;
&lt;p&gt;In the LWM2M code I found this, which seems to be what I need for that task:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;__weak bool lwm2m_os_dfu_application_update_validate(void)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;#if defined(CONFIG_MCUBOOT_IMG_MANAGER)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;nbsp; int err;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;nbsp; bool img_confirmed;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;nbsp; img_confirmed = boot_is_img_confirmed();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;nbsp; if (!img_confirmed) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;nbsp; &amp;nbsp; err = boot_write_img_confirmed();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;nbsp; &amp;nbsp; if (err == 0) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; LOG_INF(&amp;quot;Marked running image as confirmed&amp;quot;);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; return true;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;nbsp; &amp;nbsp; LOG_WRN(&amp;quot;Failed to mark running image as confirmed&amp;quot;);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;#endif /* CONFIG_MCUBOOT_IMG_MANAGER */&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;nbsp; return false;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot test and confirm with DFU Target library</title><link>https://devzone.nordicsemi.com/thread/519945?ContentTypeID=1</link><pubDate>Fri, 24 Jan 2025 09:57:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0fd9d06-654b-4fc5-b67a-11b951d31ada</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;I see now I was a bit too quick in my reply yesterday as I mixed up two libraries, sorry for that. It is as you say, an overlap.&lt;/p&gt;
&lt;p&gt;MCUmgr and DFU target Lib are two separate methods to perform DFU. The _confirmed() function I referred to belongs to MCUmgr, while the&amp;nbsp;&lt;span&gt;dfu_target_schedule_update() belongs to DFU target lib and does the same thing as _confirmed(). AFAIK&amp;nbsp;dfu_target_schedule_update()&amp;#39;s main job is to mark the images as test or confirm.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;As for showing how to perform a test reboot and confirm, I recommend you to have a look at these two samples:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The Cellular HTTP full modem update sample .&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/cellular/http_update/modem_full_update/README.html#dependencies"&gt;https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/cellular/http_update/modem_full_update/README.html#dependencies&lt;/a&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;The LwM2M client sample&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/cellular/lwm2m_client/sample_description.html"&gt;https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/cellular/lwm2m_client/sample_description.html&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Let me know if these samples are enough to show you how to use the DFU target library for test and/or confirm&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot test and confirm with DFU Target library</title><link>https://devzone.nordicsemi.com/thread/519849?ContentTypeID=1</link><pubDate>Thu, 23 Jan 2025 16:32:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d05401a-5693-47eb-9b3d-6c9eb7393ab5</guid><dc:creator>simonhwm</dc:creator><description>&lt;p&gt;Thanks. In that case what does dfu_target_schedule_update() do? It seems like an overlap.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot test and confirm with DFU Target library</title><link>https://devzone.nordicsemi.com/thread/519818?ContentTypeID=1</link><pubDate>Thu, 23 Jan 2025 15:02:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:972e0fb0-2f34-4ede-ae02-3ab09d621b0b</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If you&amp;#39;re referring to &amp;quot;confirm&amp;quot; as in &amp;quot;marking an image as confirm for DFU&amp;quot;, then you can use&amp;nbsp;&lt;span&gt;boot_write_img_confirmed() as described here&lt;/span&gt;&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/applications/nrf_desktop/doc/dfu_mcumgr.html"&gt;https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/applications/nrf_desktop/doc/dfu_mcumgr.html&lt;/a&gt;. There is also the equivalent to mark it as test.&lt;/p&gt;
&lt;p&gt;However if you believe I&amp;#39;ve misunderstood your question, please feel free to fill in the gaps that you believe I&amp;#39;ve missed,&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>