<?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>What is the proper way to generate an image that is confirmed with MCUBoot</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/92969/what-is-the-proper-way-to-generate-an-image-that-is-confirmed-with-mcuboot</link><description>Hei! 
 
 I am currently working on a project where we have implemented FOTA and I have had a lot of issues with flashing fresh boards with the complete firmware package. 
 
 Our project has a &amp;quot;self test&amp;quot; procedure, so it will check if the currently running</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 28 Oct 2022 11:59:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/92969/what-is-the-proper-way-to-generate-an-image-that-is-confirmed-with-mcuboot" /><item><title>RE: What is the proper way to generate an image that is confirmed with MCUBoot</title><link>https://devzone.nordicsemi.com/thread/393005?ContentTypeID=1</link><pubDate>Fri, 28 Oct 2022 11:59:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2a4d0d6e-132e-46f2-9542-4685ea7aa14b</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;That is great to hear! I will let the developers know.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the proper way to generate an image that is confirmed with MCUBoot</title><link>https://devzone.nordicsemi.com/thread/393002?ContentTypeID=1</link><pubDate>Fri, 28 Oct 2022 11:26:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c1079c19-def8-4143-80ee-5a208b4d2dbf</guid><dc:creator>Oskar</dc:creator><description>&lt;p&gt;The fix works, it no longer gets stuck in the reboot!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the proper way to generate an image that is confirmed with MCUBoot</title><link>https://devzone.nordicsemi.com/thread/392983?ContentTypeID=1</link><pubDate>Fri, 28 Oct 2022 10:14:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55660d0a-d248-4363-a070-b5ee0cb77833</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The developers have made a possible fix for the issue:&amp;nbsp;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/pull/51743/files"&gt;https://github.com/zephyrproject-rtos/zephyr/pull/51743/files&lt;/a&gt;. Can you try this and see if it fixes the issue?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the proper way to generate an image that is confirmed with MCUBoot</title><link>https://devzone.nordicsemi.com/thread/392829?ContentTypeID=1</link><pubDate>Thu, 27 Oct 2022 12:40:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3598595-82df-4a1c-ab12-861496f97ce9</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I agree that there seems to be some inconsistent behavior between&amp;nbsp;boot_write_img_confirmed and boot_is_img_confirmed. I have asked the development team about this, and I will let get back to you when I hear back from them.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the proper way to generate an image that is confirmed with MCUBoot</title><link>https://devzone.nordicsemi.com/thread/391932?ContentTypeID=1</link><pubDate>Fri, 21 Oct 2022 14:20:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9947c8c-6cf0-4eaa-8760-e0e1ee874811</guid><dc:creator>Oskar</dc:creator><description>&lt;p&gt;Having all the images confirmed is not very desirable as I still would like to have unconfirmed images for testing and the actual firmware update.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In my application the self-test is only run if the image is not confirmed. So when flashing the unconfirmed merged.hex image the following happens:&lt;/p&gt;
&lt;p&gt;1. MCUBoot boots and loads the image in slot 1(which is unconfirmed and has no image trailed)&lt;/p&gt;
&lt;p&gt;2. The application boots and checks if the running image is confirmed.&lt;/p&gt;
&lt;p&gt;3. Since the image is not confirmed a self-test is run. The application calls boot_write_img_confirmed.&lt;/p&gt;
&lt;p&gt;4. After the self-test is completed the application reboots.&lt;/p&gt;
&lt;p&gt;5. MCUBoot boots back up after the reset and loads application in slot 1(which for some reason is still not confirmed).&lt;/p&gt;
&lt;p&gt;6. Go to step 2.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have confirmed that the image does indeed call boot_write_img_confirmed and the call does not fail.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have found out, from the zephyr implementation, that if the image magic is unset it counts the image as already confirmed if you are trying to write the image confirmed, but when your read out the boot_is_img_confirmed, no such check is done, so an image that does not have the image trailer cannot be confirmed.&lt;/p&gt;
&lt;p&gt;So having a way to have a confirmed image built would really help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the proper way to generate an image that is confirmed with MCUBoot</title><link>https://devzone.nordicsemi.com/thread/391904?ContentTypeID=1</link><pubDate>Fri, 21 Oct 2022 13:07:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4b09af3-5798-4e60-9e34-b0b9b5df6fc5</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;One option that is similar to what you are doing originally is to use &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.1.0/kconfig/index.html#CONFIG_MCUBOOT_EXTRA_IMGTOOL_ARGS"&gt;CONFIG_MCUBOOT_EXTRA_IMGTOOL_ARGS&lt;/a&gt; to add --confirm as an argument. Then you do not have to change different SDK CMake files. However, you should be careful with this approach, as this will cause it to skip testing even if you are using app_update.bin, which is unsigned, later.&lt;/p&gt;
&lt;p&gt;If the image is not confirmed, MCUboot should hang, and not reboot, so the question is what in the application is causing the reboot. Can you enable more logging, and try to debug to see where it fails?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the proper way to generate an image that is confirmed with MCUBoot</title><link>https://devzone.nordicsemi.com/thread/391784?ContentTypeID=1</link><pubDate>Fri, 21 Oct 2022 07:14:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cbd589a1-eac0-4cec-b74c-08d745868456</guid><dc:creator>Oskar</dc:creator><description>&lt;p&gt;We connect&amp;nbsp; to LTE, read some data from MQTT, and call the `boot_write_img_confirmed`, when all functionality is verified.&lt;/p&gt;
&lt;p&gt;The `boot_write_img_confirmed` call never fails, but an image without the image trailer seems to not be able to write this flag properly.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The functionality works as expected, as long as the mcuboot image trailer is present in flash.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the proper way to generate an image that is confirmed with MCUBoot</title><link>https://devzone.nordicsemi.com/thread/391462?ContentTypeID=1</link><pubDate>Wed, 19 Oct 2022 14:03:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b016e45f-83ba-4770-b329-3623fb9b0991</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;How are you confirming the image with your self test procedure? Can you share your implementation?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the proper way to generate an image that is confirmed with MCUBoot</title><link>https://devzone.nordicsemi.com/thread/391440?ContentTypeID=1</link><pubDate>Wed, 19 Oct 2022 13:07:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9ec9799-377c-43c3-9752-567ff3f2550e</guid><dc:creator>Oskar</dc:creator><description>&lt;p&gt;This is the output from MCUBoot after flashing merged.hex, then app_signed.hex:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting Zephyr OS build v2.7.99-ncs1-1  ***
[00:00:00.226,409] &amp;lt;inf&amp;gt; mcuboot: Starting bootloader
[00:00:00.227,630] &amp;lt;inf&amp;gt; mcuboot: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[00:00:00.228,118] &amp;lt;inf&amp;gt; mcuboot: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[00:00:00.228,546] &amp;lt;inf&amp;gt; mcuboot: Boot source: none
[00:00:00.228,942] &amp;lt;inf&amp;gt; mcuboot: Swap type: none
[00:00:00.622,161] &amp;lt;inf&amp;gt; mcuboot: Bootloader chainload address offset: 0x10000
[00:00:00.622,497] &amp;lt;inf&amp;gt; mcuboot: Jumping to the first image slot
*** Booting Zephyr OS build v2.7.99-ncs1-1  ***
[00:00:00.226,409] &amp;lt;inf&amp;gt; mcuboot: Starting bootloader
[00:00:00.227,630] &amp;lt;inf&amp;gt; mcuboot: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[00:00:00.228,118] &amp;lt;inf&amp;gt; mcuboot: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[00:00:00.228,546] &amp;lt;inf&amp;gt; mcuboot: Boot source: none
[00:00:00.228,942] &amp;lt;inf&amp;gt; mcuboot: Swap type: none
[00:00:00.622,100] &amp;lt;inf&amp;gt; mcuboot: Bootloader chainload address offset: 0x10000
[00:00:00.622,467] &amp;lt;inf&amp;gt; mcuboot: Jumping to the first image slot
*** Booting Zephyr OS build v2.7.99-ncs1-1  ***
[00:00:00.226,379] &amp;lt;inf&amp;gt; mcuboot: Starting bootloader
[00:00:00.227,600] &amp;lt;inf&amp;gt; mcuboot: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[00:00:00.228,088] &amp;lt;inf&amp;gt; mcuboot: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[00:00:00.228,515] &amp;lt;inf&amp;gt; mcuboot: Boot source: none
[00:00:00.228,881] &amp;lt;inf&amp;gt; mcuboot: Swap type: none
[00:00:00.621,673] &amp;lt;inf&amp;gt; mcuboot: Bootloader chainload address offset: 0x10000
[00:00:00.622,039] &amp;lt;inf&amp;gt; mcuboot: Jumping to the first image slot
*** Booting Zephyr OS build v2.7.99-ncs1-1  ***
[00:00:00.226,440] &amp;lt;inf&amp;gt; mcuboot: Starting bootloader
[00:00:00.227,661] &amp;lt;inf&amp;gt; mcuboot: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[00:00:00.228,149] &amp;lt;inf&amp;gt; mcuboot: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[00:00:00.228,576] &amp;lt;inf&amp;gt; mcuboot: Boot source: none
[00:00:00.228,942] &amp;lt;inf&amp;gt; mcuboot: Swap type: none
[00:00:00.621,673] &amp;lt;inf&amp;gt; mcuboot: Bootloader chainload address offset: 0x10000
[00:00:00.622,009] &amp;lt;inf&amp;gt; mcuboot: Jumping to the first image slot
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This is the output using my generated image:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting Zephyr OS build v2.7.99-ncs1-1  ***
[00:00:00.362,670] &amp;lt;inf&amp;gt; mcuboot: Starting bootloader
[00:00:00.363,891] &amp;lt;inf&amp;gt; mcuboot: Primary image: magic=good, swap_type=0x1, copy_done=0x3, image_ok=0x1
[00:00:00.364,379] &amp;lt;inf&amp;gt; mcuboot: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[00:00:00.364,807] &amp;lt;inf&amp;gt; mcuboot: Boot source: primary slot
[00:00:00.368,591] &amp;lt;inf&amp;gt; mcuboot: Swap type: none
[00:00:00.761,627] &amp;lt;inf&amp;gt; mcuboot: Bootloader chainload address offset: 0x10000
[00:00:00.761,993] &amp;lt;inf&amp;gt; mcuboot: Jumping to the first image slot&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the proper way to generate an image that is confirmed with MCUBoot</title><link>https://devzone.nordicsemi.com/thread/391439?ContentTypeID=1</link><pubDate>Wed, 19 Oct 2022 13:03:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5811c677-bc17-48fa-bfd1-218f5e26dcd0</guid><dc:creator>Oskar</dc:creator><description>&lt;p&gt;MCUBoot does not write the image trailer either, so using the app_signed.hex still causes the same issues as I described in the original post.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the proper way to generate an image that is confirmed with MCUBoot</title><link>https://devzone.nordicsemi.com/thread/391436?ContentTypeID=1</link><pubDate>Wed, 19 Oct 2022 13:00:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:39880e35-6814-445f-9b93-abcaac454bdf</guid><dc:creator>Oskar</dc:creator><description>&lt;p&gt;Hmm, but the app_signed.hex is still not a confirmed image?&lt;/p&gt;
&lt;p&gt;It is signed, yes, but the image trailer is still not included so the image is not set as confirmed by MCUBoot.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have managed to create the confirmed image manually, using this script:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;python ../bootloader/mcuboot/scripts/imgtool.py sign \
		--key path/to/signing_key.pem \
		--header-size 0x200 \
		--align 4 --version x.y.z+0 \
		--pad-header --slot-size 0x70000 --confirm \
		build/zephyr/mcuboot_primary_app.hex \
		build/zephyr/app_confirmed.hex

python ../zephyr/scripts/mergehex.py -o build/zephyr/merged_and_confirmed.hex --overlap=replace \
		build/zephyr/merged.hex build/zephyr/app_confirmed.hex
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But this requires me to add additional steps to the build process, which is undesirable.&lt;/p&gt;
&lt;p&gt;Especially since there seems to be a flag that should do this automatically.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the proper way to generate an image that is confirmed with MCUBoot</title><link>https://devzone.nordicsemi.com/thread/391427?ContentTypeID=1</link><pubDate>Wed, 19 Oct 2022 12:44:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1180d9d6-f140-4166-b61d-e8e7649c2aad</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;When you build an application with MCUboot you will get an autogenerated signed image, app_signed.hex. So you can just program the chip with this instead of merged.hex. You can find an overview of the different files that are generated here: &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.1.0/mcuboot/readme-ncs.html"&gt;Using MCUboot in nRF Connect SDK&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the proper way to generate an image that is confirmed with MCUBoot</title><link>https://devzone.nordicsemi.com/thread/391207?ContentTypeID=1</link><pubDate>Tue, 18 Oct 2022 13:26:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca9a576b-4ac4-4ef3-a181-b8fd62512e97</guid><dc:creator>HuzefaST</dc:creator><description>&lt;p&gt;I have the same issue, and have tried using the `CONFIG_MCUBOOT_GENERATE_CONFIRMED_IMAGE` flag but the image still cannot be confirmed. It appears that the trailer magic is not set, and the `boot_write_img_confirmed()` API treats an unset magic as already confirmed.&lt;br /&gt;&lt;br /&gt;I had filed an MCUBoot issue to resolve this, but it hasn&amp;#39;t seen any action:&amp;nbsp;&lt;a href="https://github.com/mcu-tools/mcuboot/issues/1436"&gt;github.com/.../1436&lt;br /&gt;&lt;br /&gt;I&lt;/a&gt;&amp;nbsp;am using v2.0.0 SDK&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>