<?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 DFU OTA Best way to obtain actions ( Hooks ) also Android vs iOS discrepancies.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/96399/mcuboot-dfu-ota-best-way-to-obtain-actions-hooks-also-android-vs-ios-discrepancies</link><description>Hi There, 
 Environment Description: 
 1. nRF Connect for VS Code v2023.1.44. 
 1. NCS Version v2.0.0. 
 2. Zephyr v3.0.99-ncs1. 
 3. MCUBoot v 1.9.99 
 4. NRF52840. 
 5. NRF Connect mobile app Android v 4.26.0 Mobile app IOS V 2.6. 
 I am currently working</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 14 Feb 2023 21:00:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/96399/mcuboot-dfu-ota-best-way-to-obtain-actions-hooks-also-android-vs-ios-discrepancies" /><item><title>RE: MCUBoot DFU OTA Best way to obtain actions ( Hooks ) also Android vs iOS discrepancies.</title><link>https://devzone.nordicsemi.com/thread/409957?ContentTypeID=1</link><pubDate>Tue, 14 Feb 2023 21:00:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d5d47cd3-f08c-4eb0-920e-10d677ec4a88</guid><dc:creator>  Curiosus</dc:creator><description>&lt;p&gt;Thanks hung , this has been quite helpful !&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot DFU OTA Best way to obtain actions ( Hooks ) also Android vs iOS discrepancies.</title><link>https://devzone.nordicsemi.com/thread/409843?ContentTypeID=1</link><pubDate>Tue, 14 Feb 2023 12:25:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:287c58f5-8caa-40f1-805b-304f332720bb</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Felipe,&amp;nbsp;&lt;br /&gt;I couldn&amp;#39;t find a clear definition on what exactly is done at step 2, from my understanding it&amp;#39;s how you define a customized library/driver in Zephyr. I believe that it should be in myboard because that&amp;#39;s how your CMakelist.txt will be included when MCUBoot is built (not the CMakelist in your project).&amp;nbsp;&lt;br /&gt;&lt;br /&gt;You can find the same method is used in this article in Zephyr:&amp;nbsp;&lt;a href="https://www.zephyrproject.org/how-to-build-drivers-for-zephyr-rtos/"&gt;https://www.zephyrproject.org/how-to-build-drivers-for-zephyr-rtos/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And you can find how this macro is defined inside&amp;nbsp;\zephyr\cmake\modules\extensions.cmake&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;macro(zephyr_library)
  zephyr_library_get_current_dir_lib_name(${ZEPHYR_BASE} lib_name)
  zephyr_library_named(${lib_name})
endmacro()

function(zephyr_library_sources source)
  target_sources(${ZEPHYR_CURRENT_LIBRARY} PRIVATE ${source} ${ARGN})
endfunction()&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Regarding the warning error in VS Code, I don&amp;#39;t have a solution for now. Most likely VSCode is not aware of the child image include folder. But I don&amp;#39;t think it would be a big issue.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot DFU OTA Best way to obtain actions ( Hooks ) also Android vs iOS discrepancies.</title><link>https://devzone.nordicsemi.com/thread/409450?ContentTypeID=1</link><pubDate>Sun, 12 Feb 2023 07:58:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:47c91032-6196-4dff-b9a2-dcee6d630ac9</guid><dc:creator>  Curiosus</dc:creator><description>&lt;p&gt;Hi Hung,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have migrated my application from ncs 2.0.0 to 2.2.0 in order to access the Mcuboot hooks functionality:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Steps followed:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1. In child_image/mcuboot.conf added:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_MCUBOOT_ACTION_HOOKS=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;2. Added a CMakeLists.txt file in boards/arm/my_board containing the following:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;if(CONFIG_MCUBOOT)

    zephyr_library()    
    zephyr_library_sources(mcuboot_hook.c)


endif()&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;3. in boards\arm\my_board added a mcuboot_hook.c file containing:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;
#include &amp;quot;bootutil/image.h&amp;quot;
#include &amp;quot;bootutil/fault_injection_hardening.h&amp;quot;
#include &amp;quot;bootutil/boot_hooks.h&amp;quot;
#include &amp;quot;bootutil/mcuboot_status.h&amp;quot;


void mcuboot_status_change(mcuboot_status_type_t status){

	LOG_INF(&amp;quot;mcuboot status: %d &amp;quot;, status);

}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;NB:I had to include some extra files here in order to be able to compile it as there was some types missing.&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Thank you very much for your help.&amp;nbsp;&lt;/p&gt;
&lt;h4 id="mcetoc_1gp2a2v7r0"&gt;Is there a reason for these files to be under my_board directory ?&amp;nbsp;&lt;/h4&gt;
&lt;h4 id="mcetoc_1gp2a2v7r1"&gt;Could you please elaborate on what was done on step 2 above ? , I know it works but I would like to understand it better.&lt;/h4&gt;
&lt;h4 id="mcetoc_1gp2a2v7s2"&gt;Lastly, How could I include the&amp;nbsp;mcuboot directory to my path so I can get rid off of these errors:&lt;/h4&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/pastedimage1676188614934v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot DFU OTA Best way to obtain actions ( Hooks ) also Android vs iOS discrepancies.</title><link>https://devzone.nordicsemi.com/thread/409143?ContentTypeID=1</link><pubDate>Thu, 09 Feb 2023 12:16:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:41000747-3819-46e1-98de-04e3230097d3</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi again Felipe,&amp;nbsp;&lt;br /&gt;I got the suggestion from our colleague on how to do it (still you need to update to v2.1 or newer)&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;em&gt;In CMakeLists.txt in boards/arm/your_board , you can add something like this:&lt;/em&gt;&lt;br /&gt;&lt;em&gt; if(CONFIG_MCUBOOT)&lt;/em&gt;&lt;br /&gt;&lt;em&gt; zephyr_library()&lt;/em&gt;&lt;br /&gt;&lt;em&gt; zephyr_library_sources(my_mcuboot_hook.c)&lt;/em&gt;&lt;br /&gt;&lt;em&gt; endif()&lt;/em&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;em&gt;Then place a my_mcuboot_hook.c, that has the mcuboot_status_change() function, in boards/arm/your_board&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;By doing this you don&amp;#39;t have to change mcuboot.&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot DFU OTA Best way to obtain actions ( Hooks ) also Android vs iOS discrepancies.</title><link>https://devzone.nordicsemi.com/thread/409078?ContentTypeID=1</link><pubDate>Thu, 09 Feb 2023 09:19:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:401474ea-5501-4b99-ab64-f77eec6581a0</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Felipe,&amp;nbsp;&lt;br /&gt;As far as I know&amp;nbsp;&lt;span&gt;mcuboot_status_change() and&amp;nbsp;&lt;/span&gt;CONFIG_MCUBOOT_ACTION_HOOKS was only added from NCS v2.1.0 .&lt;/p&gt;
&lt;p&gt;You may want to consider upgrading to newer SDK.&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I understand that you don&amp;#39;t want to modify the bootloader. I&amp;#39;m checking internally if we have an example that doesn&amp;#39;t need to do that. My understanding is that it should be possible to add the function in a file and then compile the mcuboot as childimage with the extra file.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot DFU OTA Best way to obtain actions ( Hooks ) also Android vs iOS discrepancies.</title><link>https://devzone.nordicsemi.com/thread/409002?ContentTypeID=1</link><pubDate>Wed, 08 Feb 2023 22:10:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7be8a9ba-ebc1-4787-b11f-8a91eee6bdf3</guid><dc:creator>  Curiosus</dc:creator><description>&lt;p&gt;Hi Hung,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I had a look at ncs/v2.0.0/bootloader/mcuboot/boot/zephyr/main.c and I &lt;strong&gt;find no references&lt;/strong&gt; to mcuboot_status_change() also line numbers do not match as shown below, we must be looking ad different versions of ncs.&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/pastedimage1675894065102v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Also, Is there any way this might be achieved without having to modify the bootloader ? otherwise the whole idea of mcuboot hooks is lost.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What is Nordic&amp;#39;s recommended way of achieving this indications from the bootloader ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Cheers,&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot DFU OTA Best way to obtain actions ( Hooks ) also Android vs iOS discrepancies.</title><link>https://devzone.nordicsemi.com/thread/408808?ContentTypeID=1</link><pubDate>Wed, 08 Feb 2023 10:13:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8aed73da-dcd6-439f-a41c-4e6d1609dc03</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Felipe,&amp;nbsp;&lt;br /&gt;I haven&amp;#39;t implemented the hooks myself but what I can see from the code is that you would need to add your own function&amp;nbsp;named&amp;nbsp;&amp;nbsp;&lt;span&gt;mcuboot_status_change() into mcuboot.&amp;nbsp;&lt;br /&gt;If you look into&amp;nbsp;\bootloader\mcuboot\boot\zephyr\main.c you can find that it will call&amp;nbsp;mcuboot_status_change() on each stage of the mcuboot process:&amp;nbsp;&lt;br /&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/pastedimage1675851183889v1.png" alt=" " /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;As far as I know this function should be implemented in mcuboot, not in your application because your application will not run when the Mcuboot is&amp;nbsp;doing its job.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot DFU OTA Best way to obtain actions ( Hooks ) also Android vs iOS discrepancies.</title><link>https://devzone.nordicsemi.com/thread/408685?ContentTypeID=1</link><pubDate>Tue, 07 Feb 2023 18:46:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01e3951f-aaa6-4804-b958-4fd45cb45ac3</guid><dc:creator>  Curiosus</dc:creator><description>&lt;p&gt;Hi Hung,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Thanks for your prompt response.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Awesome, So we should then wait for the mobile team to get back to us in regards to question 2 and 3.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In regards to the last question (Apologies for the typo) , since the answer in question 1 is that it may take reasonably long to perform these actions, I would want to be able to somehow ( Since at that instance the device will appear unresponsive to the user ) notify the user that the operation is happening i.e ( LCD Display&amp;nbsp; or a GPIO toggle etc. ) is this possible ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Cheers,&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot DFU OTA Best way to obtain actions ( Hooks ) also Android vs iOS discrepancies.</title><link>https://devzone.nordicsemi.com/thread/408542?ContentTypeID=1</link><pubDate>Tue, 07 Feb 2023 12:33:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aec78462-647c-4def-8a02-15bc98d49545</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Felipe,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;I will need help from our Mobile app team to answer most of your questions and get back to you.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I can try to answer question 1 though.&lt;/p&gt;
&lt;p&gt;At step 5 I would assume it&amp;#39;s when the MCUBoot start the swapping process. The process involve erasing page by page of both Primary Slot and Secondary Slot and copy the image page by page from one slot to another slot.&amp;nbsp;&lt;br /&gt;This actually can take a lot of time considering erasing one page would require up to 90ms. And this is not include the calculation time needed to verify the hash of the image. The larger the image the longer it takes.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;In the last question I assume you mean &amp;quot;your own code&amp;quot; not &amp;quot;won code&amp;quot; ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>