<?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 Issues</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/104497/mcuboot-issues</link><description>Hi, 
 We were testing MCUboot uisng nRF52 Dev Kit and ran into an issue that updated firmware in slot1 couldn&amp;#39;t be booted: 
 Since we don&amp;#39;t need bootloader upgradability, CONFIG_SECURE_BOOT was not enabled. 
 After we used DFU subsystem API function flash_img_buffered_write</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 19 Sep 2024 07:28:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/104497/mcuboot-issues" /><item><title>RE: MCUBoot Issues</title><link>https://devzone.nordicsemi.com/thread/503045?ContentTypeID=1</link><pubDate>Thu, 19 Sep 2024 07:28:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d0a399d-9102-4aa9-85fd-29395710698e</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi kuchx&lt;/p&gt;
&lt;p&gt;Thank you for sharing&amp;nbsp;&lt;/p&gt;
[quote user="kuchx"]&lt;br /&gt;Edit: Sorry I misunderstood.&amp;nbsp;boot_request_upgrade sets only test or permanent run of FW. But still, how can I confirm image, if the MCUboot never runs slot 1 image?[/quote]
&lt;p&gt;No worries, to my understanding this API should help you&amp;nbsp;&lt;a href="https://docs.zephyrproject.org/apidoc/latest/group__mcuboot__api.html"&gt;https://docs.zephyrproject.org/apidoc/latest/group__mcuboot__api.html&lt;/a&gt;&amp;nbsp;:)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you have any additional follow ups that are urgent I would recommend you raise the questions as a new Devzone case, since the original question in this case has been resolved, so answer time might be shorter in a new case&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 Issues</title><link>https://devzone.nordicsemi.com/thread/502953?ContentTypeID=1</link><pubDate>Wed, 18 Sep 2024 13:43:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c4979514-de51-4ff3-8c22-a3a2b100a157</guid><dc:creator>kuchx</dc:creator><description>&lt;p&gt;Hello,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve basically stumbled upon the same issue as the original post, only for data transfer I am using CoAP blockwise. With&amp;nbsp;&lt;span&gt;flash_img_buffered_write() FW writes chunks in slot 1 and with&amp;nbsp;boot_request_upgrade(BOOT_UPGRADE_TEST) I set the flag that on next reset the slot 1 FW should be started and it should be running till next reset to flip back to the original, as I understood. And I am calling&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;sys_reboot&lt;/span&gt;&lt;span&gt;(SYS_REBOOT_COLD) for system reset (need a FW reset since button reset is not an option). Based on &lt;a href="https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-8-bootloaders-and-dfu-fota/topic/exercise-4-fota-over-lte-m-nb-iot/"&gt;this&lt;/a&gt;&amp;nbsp;exercise, I need to download app_update.bin to device, which is exactly what I do.&lt;br /&gt;&lt;br /&gt;After the reset I get this output:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I: Starting bootloader&lt;br /&gt;I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3&lt;br /&gt;I: Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3&lt;br /&gt;I: Boot source: none&lt;br /&gt;I: Image index: 0, Swap type: test&lt;br /&gt;I: Bootloader chainload address offset: 0x10000&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt; from MCUboot and device continues with slot 0 image. I tried to mark current running image (slot 0) as confirmed before DL thought that might help but the function returned error&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So can you clarify what do you mean by:&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Flag it for test as you already did&lt;/li&gt;
&lt;li&gt;Flag it with confirm&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I just need to set slot 1 fw as test using&amp;nbsp;&lt;span&gt;boot_request_upgrade() and immediately after set it as confirmed with the same function?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Edit: Sorry I misunderstood.&amp;nbsp;boot_request_upgrade sets only test or permanent run of FW. But still, how can I confirm image, if the MCUboot never runs slot 1 image?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot Issues</title><link>https://devzone.nordicsemi.com/thread/451246?ContentTypeID=1</link><pubDate>Thu, 19 Oct 2023 10:39:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0567507f-51af-4b9c-972e-ed5b833c3454</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Apologies for the long response time&lt;/p&gt;
[quote user="wliao"]I was able to update firmware by&amp;nbsp;calling&amp;nbsp;&lt;code&gt;boot_write_img_confirmed()&lt;/code&gt;&lt;span&gt;&amp;nbsp;when the image is booted and up running.&amp;nbsp;&lt;/span&gt;[/quote]
&lt;p&gt;Glad to hear that your firmware was up and running&lt;/p&gt;
[quote user="wliao"]In this case it seems like MCUBoot doesn&amp;#39;t care what firmware revision is and just swap the image from slot 1 to slot 0, correct? If we need to control which revision can be booted, what else needs to be done?[/quote]
&lt;p&gt;The firmware revision for the application is AFAIK mainly there for developers to keep track on the revisions, and as long as the firmware is different, i.e modified, flagged for confirm and has passed tests to check that it is running, then MCUboot simply swaps the image from slot 1 to slot 0 as you describe&lt;/p&gt;
&lt;p&gt;If you want, you can track the revision number by adding&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/index.html#CONFIG_FW_INFO_FIRMWARE_VERSION"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/index.html#CONFIG_FW_INFO_FIRMWARE_VERSION&lt;/a&gt;&amp;nbsp;and increment this as you go along&lt;/p&gt;
&lt;p&gt;In the case you have an updatable bootloader and want to update that, then the revision number is used to determine which of these bootloader images are the newest and which to boot from. See&amp;nbsp;&lt;a href="https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/updatable_bootloader/nsib_mcuboot_smp"&gt;https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/updatable_bootloader/nsib_mcuboot_smp&lt;/a&gt;&amp;nbsp;for a simple sample for how this is done&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 Issues</title><link>https://devzone.nordicsemi.com/thread/450330?ContentTypeID=1</link><pubDate>Fri, 13 Oct 2023 13:59:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3936931d-7f41-4a52-9d09-5885d154448e</guid><dc:creator>wliao</dc:creator><description>&lt;p&gt;Hi Andreas,&lt;/p&gt;
&lt;p&gt;I was able to update firmware by&amp;nbsp;calling&amp;nbsp;&lt;code&gt;boot_write_img_confirmed()&lt;/code&gt;&lt;span&gt;&amp;nbsp;when the image is booted and up running.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In this case it seems like MCUBoot doesn&amp;#39;t care what firmware revision is and just swap the image from slot 1 to slot 0, correct? If we need to control which revision can be booted, what else needs to be done?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot Issues</title><link>https://devzone.nordicsemi.com/thread/449593?ContentTypeID=1</link><pubDate>Tue, 10 Oct 2023 14:00:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:50532eed-9480-47a0-822d-31603afe3364</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Noted, thank you for clarifying! :)&lt;/p&gt;
&lt;p&gt;I found this case (which is from last year so there might be discrepancies with how it&amp;#39;s done her and in your firmware) that might give you a hint for the procedure&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/90561/dfu-sample-missing-boot_set_pending-or-boot_request_upgrade"&gt;DFU sample, missing boot_set_pending or boot_request_upgrade&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In the meanwhile I will do some digging around and see if I can find newer documentation that states how to do this . I will return to you with an answer as soon as I know more, and let me know if you&amp;#39;re able to resolve it using the case I mention while waiting&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 Issues</title><link>https://devzone.nordicsemi.com/thread/449586?ContentTypeID=1</link><pubDate>Tue, 10 Oct 2023 13:46:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c00ca74b-8ddf-43a2-8835-f3dd65052402</guid><dc:creator>wliao</dc:creator><description>&lt;p&gt;Hi Andreas,&lt;/p&gt;
&lt;p&gt;We are not using any Nordic DFU or SMP to do OTA transfer. We have our own protocol to transfer&amp;nbsp;the image from the server (PC) to the device, using BLE communication, like reading attributes. After a block of binary is received by the device, it is written into the flash by using&amp;nbsp;&lt;span&gt;API function&amp;nbsp;&lt;/span&gt;&lt;span&gt;flash_img_buffered_write().&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
[quote userid="107683" url="~/f/nordic-q-a/104497/mcuboot-issues/449559"]Flag it with confirm[/quote]
&lt;p&gt;&lt;span&gt;1. You mentioned to flag slot-1 image with confirm. How would I confirm it within my application? Any API function available to perform the confirmation? I only found API function to confirm currently running image or image at primary slot, but not for slot-1.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2. As we are not using SMP, can we still use Mcumgr tool? To be able to use Mcumgr tool, do we need to include&amp;nbsp;Mcumgr related code in our application?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The document states it is not for the production.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot Issues</title><link>https://devzone.nordicsemi.com/thread/449559?ContentTypeID=1</link><pubDate>Tue, 10 Oct 2023 12:25:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:578eec8b-9908-42a8-9f46-d3dc43c476aa</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Could you first explain what transport method you&amp;#39;re using for DFU? Is it by using BLE, mcumgr or other?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user=""]1. Why after the updated image was flashed to slot 1, it didn&amp;#39;t get swapped with slot 0 and ran at next reboot?[/quote]
&lt;p&gt;This is expected as you only flagged the image in slot1 for testing, meaning that the device performs one &amp;quot;test&amp;quot; of the firmware in image one to check if it is OK and then reverts back to the original firmware which were already residing in slot0 before you performed the test. If you wish to perform the update, you will need to&amp;nbsp;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Flag it for test as you already did&lt;/li&gt;
&lt;li&gt;Flag it with confirm&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Perform a pin-reset (reset the DK with the reset button or nrfjprog --reset)&lt;/li&gt;
&lt;/ol&gt;
[quote user=""]2. Which hex file should be used to flash slot1? Should app_signed.hex be used?[/quote]
&lt;p&gt;This page explains the various output files and how they can be used&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/config_and_build/config_and_build_system.html#output-build-files"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/config_and_build/config_and_build_system.html#output-build-files&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Depending on your DFU transport and the device you&amp;#39;re developing with you may be needing to use different files.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The Mcumgr documentation at&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/services/device_mgmt/mcumgr.html"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/services/device_mgmt/mcumgr.html&lt;/a&gt;&amp;nbsp;as well as these samples created by a colleague of mine are useful tools to see how you can use these files together with Mcumgr&amp;nbsp;&lt;a href="https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/smp"&gt;github.com/.../smp&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user=""]3. After the device was flashed with merged.hex and rebooted, there&amp;#39;s no indication that the bootloader was verifying the image at slot 0 which it&amp;#39;s trying to boot from. Is it normal?[/quote]
&lt;p&gt;Since you didn&amp;#39;t do any swap as I described in step 0, it is not needed to verify the image at slot 0&lt;/p&gt;
&lt;p&gt;Let me know if this clarifies things for you!&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>