<?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 should only timeout after hardware reset</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/108213/mcuboot-should-only-timeout-after-hardware-reset</link><description>Hi there, 
 I&amp;#39;ve made MCUboot work, but it always timeouts before loading the application firmware. I only want it to timeout after resetting the SoC via its RESET pin. 
 I added CONFIG_BOOTLOADER_MCUBOOT=y to my prj.conf, and my mcuboot.conf contains</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 26 Feb 2024 11:18:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/108213/mcuboot-should-only-timeout-after-hardware-reset" /><item><title>RE: MCUboot should only timeout after hardware reset</title><link>https://devzone.nordicsemi.com/thread/470688?ContentTypeID=1</link><pubDate>Mon, 26 Feb 2024 11:18:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0eb81f21-d044-4c4a-9aa4-2bb91233180e</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Thanks for creating the PR. I think we can wait for feedback from the maintainers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot should only timeout after hardware reset</title><link>https://devzone.nordicsemi.com/thread/470327?ContentTypeID=1</link><pubDate>Thu, 22 Feb 2024 21:04:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c51fc5a8-dd94-4fcf-8a88-701fefc74b25</guid><dc:creator>mlac</dc:creator><description>&lt;p&gt;I&amp;#39;ve just submitted the PR. Would you take a look?&lt;/p&gt;
&lt;p&gt;&lt;a id="" href="https://github.com/mcu-tools/mcuboot/pull/1903"&gt;https://github.com/mcu-tools/mcuboot/pull/1903&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m unsure whether&amp;nbsp;BOOT_SERIAL_WAIT_FOR_DFU_ALWAYS should default to y or n.&lt;/p&gt;
&lt;p&gt;If you want to propose an alternative/extended help text for&amp;nbsp;BOOT_SERIAL_WAIT_FOR_DFU, feel free to do so.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot should only timeout after hardware reset</title><link>https://devzone.nordicsemi.com/thread/469112?ContentTypeID=1</link><pubDate>Thu, 15 Feb 2024 16:27:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de44b7a0-9003-4807-80a3-f711e2328840</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;It&amp;#39;s great if you want to make a PR based on this patch I&amp;#39;ve created. I recommend adding more descriptive text to the Kconfig symbols CONFIG_BOOT_SERIAL_WAIT_FOR_DFU and CONFIG_BOOT_SERIAL_WAIT_FOR_DFU_ALWAYS.&amp;nbsp; Especially for the CONFIG_BOOT_SERIAL_WAIT_FOR_DFU symbol, as this change will&amp;nbsp;affect how this configuration setting should be used.&lt;br /&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 should only timeout after hardware reset</title><link>https://devzone.nordicsemi.com/thread/469079?ContentTypeID=1</link><pubDate>Thu, 15 Feb 2024 15:03:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f601948a-024d-405e-9f28-21bb9c8b076b</guid><dc:creator>mlac</dc:creator><description>&lt;p&gt;Thank you so much for your help, Vidar!&amp;nbsp;It works perfectly, and&amp;nbsp;you also added a relevant Kconfig option, making it generally usable.&lt;/p&gt;
&lt;p&gt;May I create a MCUboot pull request based on your patch?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot should only timeout after hardware reset</title><link>https://devzone.nordicsemi.com/thread/468959?ContentTypeID=1</link><pubDate>Thu, 15 Feb 2024 08:57:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:303a9384-5d81-4a63-8c72-d37f10f68d8a</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Please try to apply the diff below, then test your project with the following kconfig settings:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BOOT_SERIAL_WAIT_FOR_DFU=y
CONFIG_BOOT_SERIAL_WAIT_FOR_DFU_ALWAYS=n
CONFIG_BOOT_SERIAL_WAIT_FOR_DFU_TIMEOUT=3000&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="diff"&gt;diff --git a/boot/zephyr/Kconfig.serial_recovery b/boot/zephyr/Kconfig.serial_recovery
index 52ec3b01..3487e37d 100644
--- a/boot/zephyr/Kconfig.serial_recovery
+++ b/boot/zephyr/Kconfig.serial_recovery
@@ -155,13 +155,17 @@ config BOOT_SERIAL_DETECT_DELAY
 	  the one used to place the device in bootloader mode.
 
 menuconfig BOOT_SERIAL_WAIT_FOR_DFU
-	bool &amp;quot;Wait a prescribed duration to see if DFU is invoked by receiving a MCUmgr comand&amp;quot;
+	bool &amp;quot;Wait a prescribed duration to see if DFU is invoked by receiving a MCUmgr command&amp;quot;
 	depends on BOOT_SERIAL_UART || BOOT_SERIAL_CDC_ACM
 	help
 	  If y, MCUboot waits for a prescribed duration of time to allow
 	  for DFU to be invoked. The serial recovery can be entered by receiving any
 	  mcumgr command.
 
+config BOOT_SERIAL_WAIT_FOR_DFU_ALWAYS
+	bool &amp;quot;Always enter serial recovery mode upon startup&amp;quot;
+	depends on BOOT_SERIAL_WAIT_FOR_DFU
+
 config BOOT_SERIAL_WAIT_FOR_DFU_TIMEOUT
 	int &amp;quot;Duration to wait for the serial DFU timeout in ms&amp;quot;
 	default 500
diff --git a/boot/zephyr/main.c b/boot/zephyr/main.c
index 27039700..4364ea67 100644
--- a/boot/zephyr/main.c
+++ b/boot/zephyr/main.c
@@ -559,8 +559,12 @@ static void boot_serial_enter()
     BOOT_LOG_INF(&amp;quot;Enter the serial recovery mode&amp;quot;);
     rc = boot_console_init();
     __ASSERT(rc == 0, &amp;quot;Error initializing boot console.\n&amp;quot;);
+#ifdef CONFIG_BOOT_SERIAL_WAIT_FOR_DFU
+    boot_serial_check_start(&amp;amp;boot_funcs, CONFIG_BOOT_SERIAL_WAIT_FOR_DFU_TIMEOUT);
+#else
     boot_serial_start(&amp;amp;boot_funcs);
     __ASSERT(0, &amp;quot;Bootloader serial process was terminated unexpectedly.\n&amp;quot;);
+#endif 
 }
 #endif
 
@@ -649,7 +653,7 @@ int main(void)
     }
 #endif
 
-#ifdef CONFIG_BOOT_SERIAL_WAIT_FOR_DFU
+#ifdef CONFIG_BOOT_SERIAL_WAIT_FOR_DFU_ALWAYS
     /* Initialize the boot console, so we can already fill up our buffers while
      * waiting for the boot image check to finish. This image check, can take
      * some time, so it&amp;#39;s better to reuse thistime to already receive the
@@ -674,7 +678,7 @@ int main(void)
     }
 #endif
 
-#ifdef CONFIG_BOOT_SERIAL_WAIT_FOR_DFU
+#ifdef CONFIG_BOOT_SERIAL_WAIT_FOR_DFU_ALWAYS
     timeout_in_ms -= (k_uptime_get_32() - start);
     if( timeout_in_ms &amp;lt;= 0 ) {
         /* at least one check if time was expired */
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot should only timeout after hardware reset</title><link>https://devzone.nordicsemi.com/thread/468895?ContentTypeID=1</link><pubDate>Wed, 14 Feb 2024 16:47:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02f477a3-4588-4414-b412-a1b31d72f7fd</guid><dc:creator>mlac</dc:creator><description>&lt;p&gt;For some reason, I believed that the suggested MCUboot modification worked, but when testing it again, I&amp;nbsp;realized that the bootloader still always timeouts, not only when the board has been hardware-reset.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m surprised that there&amp;#39;s no relevant MCUboot option because my use case shouldn&amp;#39;t be unusual; I want the board to boot up as quickly as possible, but I also want to be able to manually trigger the bootloader even if the application firmware is broken. There are plenty of unanswered issues and pull requests in the MCUboot repo, so my hopes are not high, but I&amp;#39;ll open an issue nevertheless.&lt;/p&gt;
&lt;p&gt;Do you have further ideas for achieving what I&amp;#39;m after? If my goal requires custom development that is outside the scope of this support, I understand. I can probably figure this out, but it may be time-consuming. Alternatively, I&amp;#39;d be glad to pay to get this done.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot should only timeout after hardware reset</title><link>https://devzone.nordicsemi.com/thread/468817?ContentTypeID=1</link><pubDate>Wed, 14 Feb 2024 13:07:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9c38369-2415-4d07-8a8d-a0454c147ac3</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I&amp;#39;m glad to hear that it worked.&lt;/p&gt;
[quote user="mlac"]Now, I&amp;#39;m only puzzled about how to integrate the modified mcuboot into my project. My best idea is forking&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-mcuboot"&gt;https://github.com/nrfconnect/sdk-mcuboot&lt;/a&gt;&amp;nbsp;on GitHub and adding my fork to west.yml to override the stock mcuboot repo. Do you know of a better way?[/quote]
&lt;p&gt;Creating a fork might be the more appropriate way to handle this. However, I would likely have opted for creating a local patch that I apply manually with each new release.&amp;nbsp;A third option is to submit a PR to propose this change upstream.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot should only timeout after hardware reset</title><link>https://devzone.nordicsemi.com/thread/468717?ContentTypeID=1</link><pubDate>Tue, 13 Feb 2024 22:25:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:52442e8b-0153-4076-945d-b8a6276a46b6</guid><dc:creator>mlac</dc:creator><description>&lt;p&gt;Thanks so&amp;nbsp;much for your help, Vidar! Your suggestion&amp;nbsp;of putting mcuboot.conf into the child_image directory and modifying mcuboot/boot/zephyr/main.c worked perfectly.&lt;/p&gt;
&lt;p&gt;A little correction: The compiler complained that&amp;nbsp;&lt;span&gt;boot_serial_check_start() was given too few arguments. Actually, boot_serial_check_start(&amp;amp;boot_funcs,timeout_in_ms) had to be&amp;nbsp;called, and the definition of&amp;nbsp;timeout_in_ms had to be moved before the call.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Now, I&amp;#39;m only puzzled about how to integrate the modified mcuboot into my project. My best idea is forking&amp;nbsp;&lt;a id="" href="https://github.com/nrfconnect/sdk-mcuboot"&gt;https://github.com/nrfconnect/sdk-mcuboot&lt;/a&gt;&amp;nbsp;on GitHub and adding my fork to west.yml to override the stock mcuboot repo. Do you know of a better way?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot should only timeout after hardware reset</title><link>https://devzone.nordicsemi.com/thread/468595?ContentTypeID=1</link><pubDate>Tue, 13 Feb 2024 12:39:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c2d61611-e541-47e2-a959-5c7bd2f18cec</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Laci,&lt;/p&gt;
[quote user="mlac"]I understand that I should remove&amp;nbsp;CONFIG_BOOT_SERIAL_WAIT_FOR_DFU to avoid the initial timeout, but I still want the bootloader to timeout when the SoC is restarted via hardware reset. How can I achieve it?[/quote]
&lt;p&gt;My apologies. I was under the impression that the CONFIG_BOOT_SERIAL_WAIT_FOR_DFU_TIMEOUT applied to all serial entry methods, but I now realize that this is not the case. However, from looking at the main.c implementation for mcuboot, it seems like you can achieve this by simply replacing&amp;nbsp;boot_serial_enter() with&amp;nbsp;boot_serial_check_start() at this line:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-mcuboot/blob/6902abba270c0fbcbe8ee3bb56fe39bc9acc2774/boot/zephyr/main.c#L545"&gt;https://github.com/nrfconnect/sdk-mcuboot/blob/6902abba270c0fbcbe8ee3bb56fe39bc9acc2774/boot/zephyr/main.c#L545&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
[quote user="mlac"]Thank you for looking into the VS Code-related issue. I&amp;#39;ve checked the referenced project, but I can&amp;#39;t&amp;nbsp;build the MCUboot-related part of it, and I&amp;#39;d rather wait for your findings.[/quote]
&lt;p&gt;I was able to reproduce the same behavior here and have reported it to our VS Code extension team. While waiting for this to be fixed, please create the &amp;#39;child_image&amp;#39; folder as suggested earlier and place your &amp;#39;mcuboot.conf&amp;#39; file in this folder. The file will then be picked up by the build system the next time you perform a pristine build.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot should only timeout after hardware reset</title><link>https://devzone.nordicsemi.com/thread/468519?ContentTypeID=1</link><pubDate>Tue, 13 Feb 2024 07:37:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c09d626-5a00-4a3e-9521-3019ad153d00</guid><dc:creator>mlac</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;I understand that I should remove&amp;nbsp;CONFIG_BOOT_SERIAL_WAIT_FOR_DFU to avoid the initial timeout, but I still want the bootloader to timeout when the SoC is restarted via hardware reset. How can I achieve it?&lt;/p&gt;
&lt;p&gt;Thank you for looking into the VS Code-related issue. I&amp;#39;ve checked the referenced project, but I can&amp;#39;t&amp;nbsp;build the MCUboot-related part of it, and I&amp;#39;d rather wait for your findings.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot should only timeout after hardware reset</title><link>https://devzone.nordicsemi.com/thread/468439?ContentTypeID=1</link><pubDate>Mon, 12 Feb 2024 15:02:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ea15fe4-4ff0-457c-a921-fb3eca0ad4a5</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Laci,&lt;/p&gt;
&lt;p&gt;The&amp;nbsp;CONFIG_BOOT_SERIAL_WAIT_FOR_DFU option will make the bootloader always enter serial recovery upon startup. If you don&amp;#39;t want this, you should disable this option.&lt;/p&gt;
&lt;p&gt;With regards to issue where the VS code extension &amp;quot;forgets&amp;quot; the build setting, I will to try to reproduce it here. In the meantime, please consider creating a child image folder with your Kconfig file as I suggested in this post:&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/108203/issues-with-building-mcuboot-for-nrf7002dk-using-ncs-v2-5-2/468382"&gt;RE: Issues with Building MCUboot for nRF7002DK Using NCS V2.5.2&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>