<?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>Manual firmware upload to trigger MCUBoot swap</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/87089/manual-firmware-upload-to-trigger-mcuboot-swap</link><description>Hey, 
 I have implemented BT FOTA process for my zephyr based application. DFU over Bluetooth works fine. But now I struggle to implement manual upload of image (it will be done via spi in future). 
 What I&amp;#39;m trying to do? I want to generate .hex or </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 20 Apr 2022 20:47:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/87089/manual-firmware-upload-to-trigger-mcuboot-swap" /><item><title>RE: Manual firmware upload to trigger MCUBoot swap</title><link>https://devzone.nordicsemi.com/thread/364041?ContentTypeID=1</link><pubDate>Wed, 20 Apr 2022 20:47:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3adbb274-c1ce-4a7f-9a81-0fc35daf8d4f</guid><dc:creator>Dymek117</dc:creator><description>&lt;p&gt;Hung,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Hex generated your way succesfully worked &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The problem was I didn&amp;#39;t called&amp;nbsp;&lt;span&gt;&lt;code&gt;boot_request_upgrade(BOOT_UPGRADE_TEST)&amp;nbsp;&lt;/code&gt;between transfer done and system reboot.&lt;br /&gt;After reboot&amp;nbsp;&lt;code&gt;boot_write_img_confirmed()&lt;/code&gt; should be called from freshly booted app to prevent revert.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&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;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Manual firmware upload to trigger MCUBoot swap</title><link>https://devzone.nordicsemi.com/thread/364003?ContentTypeID=1</link><pubDate>Wed, 20 Apr 2022 14:48:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0dbb11d8-6676-4195-9606-8af4f75fdb8f</guid><dc:creator>Dymek117</dc:creator><description>&lt;p&gt;OK, I did this and flash this either via nrfjprog and west, but after reboot still old image is loading.&lt;br /&gt;So, after your instructions I have .hex file signed and linked to SLOT1 address, but I still need to add trailer basing on&amp;nbsp;&lt;span&gt;smp_svr example?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In documentation i see that you use mcumgr tool like here:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre id="codecell15"&gt;&lt;span class="go"&gt;sudo mcumgr &amp;lt;connection string&amp;gt; image test &amp;lt;hash of slot-1 image&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span class="go"&gt;But how can I use mcumgr from my application? I mean marking new image for swap or rebooting?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Manual firmware upload to trigger MCUBoot swap</title><link>https://devzone.nordicsemi.com/thread/363979?ContentTypeID=1</link><pubDate>Wed, 20 Apr 2022 13:58:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f5a723a-5880-430c-944a-04eec1decc53</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Dymek,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;One of my coworkers successfully sign an image and put it to 2nd slot by these command (using the -x option in imgtool.py)&lt;/p&gt;
&lt;div&gt;
&lt;blockquote&gt;imgtool.py sign --header-size 0x200 --align 4 --slot-size 0x79e00 --version 1.0.0 --pad-header --key child_image/mcuboot/custom_priv.pem &lt;strong&gt;-x 0x86000 build/zephyr/zephyr.hex&lt;/strong&gt; app_manually_signed.hex&lt;/blockquote&gt;
&lt;blockquote&gt;nrfjprog --sectorerase --program app_manually_signed.hex&lt;/blockquote&gt;
&lt;blockquote&gt;The 2nd image will then be listed when you call mcumgr list.&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote&gt;&lt;/blockquote&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Manual firmware upload to trigger MCUBoot swap</title><link>https://devzone.nordicsemi.com/thread/363964?ContentTypeID=1</link><pubDate>Wed, 20 Apr 2022 13:27:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03019eb6-0050-476a-8625-5cc7fd39f0af</guid><dc:creator>Dymek117</dc:creator><description>&lt;p&gt;Address space actually don&amp;#39;t make a difference to me - I can easily remap hex from slot0 to slot1, then&amp;nbsp;&lt;span&gt;app_signed.hex will be saved to the proper slot. But this still wont make swap happen, right?&amp;nbsp;&lt;br /&gt;After saving&amp;nbsp;app_signed.hex in slot1 I should still add trailer at the end, right?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Manual firmware upload to trigger MCUBoot swap</title><link>https://devzone.nordicsemi.com/thread/363929?ContentTypeID=1</link><pubDate>Wed, 20 Apr 2022 12:45:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:039aa2eb-c77d-4b3e-8856-a38a23e2090d</guid><dc:creator>Hung Bui</dc:creator><description>[quote user="Dymek117"]I used app_update.bin with NSC iOS app and after upload mcuboot processed swap, so trailer was written rather by application or mcumgr and was not included during build process?[/quote]
&lt;p&gt;This is correct. MCUBoot will write to the trailer the progress of DFU update to continue if interrupted. It also write to the trailer the swap status of the image.&lt;/p&gt;
&lt;p&gt;In the list of the images in the link you provided, you can find that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;&lt;span&gt;app_signed.hex&lt;/span&gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;- Signed variant of the firmware in intelhex format. This HEX file is linked against the same address as the application. Programming this file to the device will overwrite the existing application. It will not trigger a DFU procedure.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So flashing app_signed.hex will just overwrite the current application and you won&amp;#39;t have the image in the secondary slot.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In the list of the files I think the&amp;nbsp;&lt;span&gt;app_moved_test_update.hex is the closest to what you want to do. But you may want to study the file to modify the trailer so that test won&amp;#39;t automatically performed on the next boot.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Manual firmware upload to trigger MCUBoot swap</title><link>https://devzone.nordicsemi.com/thread/363880?ContentTypeID=1</link><pubDate>Wed, 20 Apr 2022 11:18:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4dcedb78-3a68-4094-81cc-6836fe09a785</guid><dc:creator>Dymek117</dc:creator><description>&lt;p&gt;Thanks for quick reply.&lt;/p&gt;
&lt;p&gt;Basing on your answer I assume, that none of files listed here:&lt;br /&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/mcuboot/readme-ncs.html"&gt;Using MCUboot in nRF Connect SDK &amp;mdash; MCUboot 1.8.99 documentation (nordicsemi.com)&lt;/a&gt;&lt;br /&gt;Is containing proper trailer for mcuboot?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I used app_update.bin with NSC iOS app and after upload mcuboot processed swap, so trailer was written rather by application or mcumgr and was not included during build process? How is that possible if image trailer contains encryption key - image signing takes place after build on a PC.&lt;/p&gt;
&lt;p&gt;I was pretty sure that on of files listed in a link above contains proper trailer and is ready for mcuboot to trigger swap - could you clarify this&amp;nbsp;&lt;span&gt;ambiguity? :)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;br /&gt;Damian.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Manual firmware upload to trigger MCUBoot swap</title><link>https://devzone.nordicsemi.com/thread/363870?ContentTypeID=1</link><pubDate>Wed, 20 Apr 2022 11:00:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09c32df0-b87b-49bc-8f40-91c72bd4ee50</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Dymek,&amp;nbsp;&lt;br /&gt;For the MCUBoot to detect if there is an image in the secondary (or primary) slot , it needs an image trailer at the&amp;nbsp;end of the image&amp;#39;s flash area.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please have a look at the documentation &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/mcuboot/design.html?highlight=trailer#image-trailer"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t tried to write to the flash directly with the metadata but I would suggest to have a look at how we receive new image and store it to secondary slot and update image trailer in smp_svr example , the process is done most probably in img_mgmt.c file in&amp;nbsp;\zephyr\subsys\mgmt\mcumgr\lib\cmd\img_mgmt\src.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Another option which might be easier is to do a DFU update and get the image being written into secondary slot with SMP_SVR , then after that you can read flash and copy only the secondary slot (including the image trailer) into a hex file. From that you can write the hex file to a different board and should have the same result.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>