<?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 build numbers in ncs</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/102654/mcuboot-build-numbers-in-ncs</link><description>We want to use build numbers in our pipeline, like mentioned in your MCUBoot documentation: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/config_and_build/bootloaders_and_dfu/fw_update.html#software-based-downgrade-prevention The nRF</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 05 Sep 2023 08:20:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/102654/mcuboot-build-numbers-in-ncs" /><item><title>RE: MCUBoot build numbers in ncs</title><link>https://devzone.nordicsemi.com/thread/444430?ContentTypeID=1</link><pubDate>Tue, 05 Sep 2023 08:20:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ca01096-8b16-4ee4-ab42-e6ff2b619cba</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Public cases are not closed per se, but you can mark it as answered. Pleas see &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/73889/how-to-close-an-answered-ticket/304416"&gt;this post&lt;/a&gt; for details.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot build numbers in ncs</title><link>https://devzone.nordicsemi.com/thread/444425?ContentTypeID=1</link><pubDate>Tue, 05 Sep 2023 07:49:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72fd704f-9f3d-46b3-a050-037e4693e045</guid><dc:creator>KjellArne Amina</dc:creator><description>&lt;p&gt;I&amp;#39;d like to close this issue, but cannot seem to find any close button in the web interface. Would you mind closing it for me?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot build numbers in ncs</title><link>https://devzone.nordicsemi.com/thread/441837?ContentTypeID=1</link><pubDate>Thu, 17 Aug 2023 11:31:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c12d43a6-0694-46b0-afd0-98b333dc9266</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This is only tracked in our internal issue tracking system which is not externally available.&lt;/p&gt;
&lt;p&gt;Br,&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot build numbers in ncs</title><link>https://devzone.nordicsemi.com/thread/441121?ContentTypeID=1</link><pubDate>Mon, 14 Aug 2023 10:56:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12bf01ea-339f-4f9d-a927-8be6008866dd</guid><dc:creator>KjellArne Amina</dc:creator><description>&lt;p&gt;Great, then it all makes sense. I&amp;#39;ll take efforts to be more clear the next time i post.&lt;br /&gt;&lt;br /&gt;Thanks for the suggestion, I did some more changes to actually include the build number in the header, but the following struct packing puts the build number at the wrong position in the OTA image header. I&amp;#39;ll attach my code for reference, even though it is certainly not the best way to do it. &lt;br /&gt;&lt;br /&gt;Is there a link to an issue tracking that can be shared, or is it only used internally at Nordic?&lt;br /&gt;&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/zb_5F00_add_5F00_ota_5F00_header.py"&gt;devzone.nordicsemi.com/.../zb_5F00_add_5F00_ota_5F00_header.py&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot build numbers in ncs</title><link>https://devzone.nordicsemi.com/thread/440949?ContentTypeID=1</link><pubDate>Fri, 11 Aug 2023 12:01:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:206c0834-ad14-411e-b858-54825faffb45</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Ah! By &amp;quot;does not take build number into account&amp;quot; I thought you meant that it just ignored the build number, not that it didn&amp;#39;t build.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Try this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="python"&gt;def convert_version_string_to_int(s):
    &amp;quot;&amp;quot;&amp;quot;Convert from semver string &amp;quot;1.2.3&amp;quot;, to integer 1020003&amp;quot;&amp;quot;&amp;quot;
    head, sep, tail = s.partition(&amp;#39;+&amp;#39;)
    numbers = head.split(&amp;#39;.&amp;#39;)
    if len(numbers) != 3:
        raise ValueError(&amp;#39;application-version-string parameter must be on the format x.y.z&amp;#39;)
    js = [0x100*0x10000, 0x10000, 1]
    return sum([js[i] * int(numbers[i]) for i in range(3)])&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I will report it to our SDK team, so hopefully it will be fixed in a future release.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know if this is the best way to do it in python, but it looks like it is working, at least.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot build numbers in ncs</title><link>https://devzone.nordicsemi.com/thread/440876?ContentTypeID=1</link><pubDate>Fri, 11 Aug 2023 07:01:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1bee85f6-cb44-4515-82af-03402c08f8b6</guid><dc:creator>KjellArne Amina</dc:creator><description>&lt;p&gt;I mean that downgrade prevention and semantic versioning is nice and all, but what we want to use and need help with is that the build fails when we use build number.&lt;br /&gt;&lt;br /&gt;As for the problem we&amp;#39;re having, please refer to my original post:&lt;/p&gt;
[quote userid="126530" url="~/f/nordic-q-a/102654/mcuboot-build-numbers-in-ncs"]The nRF Connect SDK seems to handle this in &amp;quot;convert_version_string_to_int()&amp;quot; in &amp;quot;zb_add_ota_header.py&amp;quot;, but this function does not take build number into account. Could you please patch this, and preferably share the code if the release of the fix takes a long time?[/quote]
&lt;p&gt;&lt;br /&gt;The error message we see when trying to use build number looks something like this:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:courier new, courier;"&gt;FAILED: modules/mcuboot/CMakeFiles/zigbee_ota_image &lt;br /&gt;cd /home/username/code/product/build/modules/mcuboot &amp;amp;&amp;amp; /home/username/util/ncs/toolchains/1f9b40e71a/usr/local/bin/python3.8 /home/username/util/ncs/v2.4.1/nrf/scripts/bootloader/zb_add_ota_header.py --application /home/username/code/product/build/zephyr/dfu_multi_image.bin --application-version-string 0.3.2+10 --zigbee-manufacturer-id 0xDEAD --zigbee-image-type 0xCAFE --zigbee-comment company_OTA_image --zigbee-ota-min-hw-version --zigbee-ota-max-hw-version --out-directory /home/username/code/product/build/zephyr&lt;br /&gt;invalid literal for int() with base 10: &amp;#39;2+10&amp;#39;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot build numbers in ncs</title><link>https://devzone.nordicsemi.com/thread/440864?ContentTypeID=1</link><pubDate>Fri, 11 Aug 2023 06:20:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a182610c-c993-4520-9f53-0daf65fdef8d</guid><dc:creator>Edvin</dc:creator><description>[quote user="KjellArne"]We aren&amp;#39;t concerned about downgrade prevention when we want to use build number, but rather traceability of the.[/quote][quote user="KjellArne"]What is the intended way to use build number, if not for traceability?[/quote]
&lt;p&gt;I am not sure what you mean. If you are not concerned with downgrade protection, then what is the issue with the build number? Are you struggling to set it? Are you struggling to read it?&lt;/p&gt;
&lt;p&gt;BR,&lt;br /&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot build numbers in ncs</title><link>https://devzone.nordicsemi.com/thread/440769?ContentTypeID=1</link><pubDate>Thu, 10 Aug 2023 13:41:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6316029-13c2-4adc-bd5f-adaab6610a1e</guid><dc:creator>KjellArne Amina</dc:creator><description>&lt;p&gt;We aren&amp;#39;t concerned about downgrade prevention when we want to use build number, but rather traceability of the. We could of course add the build number to the filename, but that is too easily changed.&lt;br /&gt;&lt;br /&gt;What is the intended way to use build number, if not for traceability?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot build numbers in ncs</title><link>https://devzone.nordicsemi.com/thread/440731?ContentTypeID=1</link><pubDate>Thu, 10 Aug 2023 12:25:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97e7da85-2a22-4c52-8ea4-1e0a6ac65885</guid><dc:creator>Edvin</dc:creator><description>[quote user="KjellArne"]My bad, it did not work with west build, zb_add_ota_header.py is used there as well[/quote]
&lt;p&gt;That makes sense, since VS Code is just a GUI wrapped around west.&lt;/p&gt;
&lt;p&gt;You can do that, but as it states, it is a downgrade protection, which means that you can&amp;#39;t DFU back to a lower version, but you can DFU within the same version. Therefore it makes sense to only publically release one image per revision, I guess.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;br /&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot build numbers in ncs</title><link>https://devzone.nordicsemi.com/thread/440699?ContentTypeID=1</link><pubDate>Thu, 10 Aug 2023 10:45:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84a7e1f3-3bdd-4bc5-8e2a-23b6ff91337f</guid><dc:creator>KjellArne Amina</dc:creator><description>&lt;p&gt;My bad, it did not work with west build, zb_add_ota_header.py is used there as well.&lt;br /&gt;&lt;br /&gt;The plan was to use the following way, again from your docs in &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/config_and_build/bootloaders_and_dfu/fw_update.html#software-based-downgrade-prevention"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/config_and_build/bootloaders_and_dfu/fw_update.html#software-based-downgrade-prevention&lt;/a&gt; &lt;/p&gt;
&lt;pre class="highlight literal-block"&gt;west build -b &lt;em&gt;board&lt;/em&gt; &lt;em&gt;application&lt;/em&gt; -- \
-DCONFIG_MCUBOOT_IMAGE_VERSION=\&amp;quot;0.1.2\+3\&amp;quot; &lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot build numbers in ncs</title><link>https://devzone.nordicsemi.com/thread/440625?ContentTypeID=1</link><pubDate>Thu, 10 Aug 2023 06:42:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d93e236e-fa7d-40d1-bd34-d1b5badae24c</guid><dc:creator>Edvin</dc:creator><description>[quote user="KjellArne"]It works using west build, but does not work in the VS Code NCS plugin.[/quote]
&lt;p&gt;What do you mean by this? Are you able to include the build number in the version check using west build, but not in VS Code? If so, how do you do that?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot build numbers in ncs</title><link>https://devzone.nordicsemi.com/thread/440512?ContentTypeID=1</link><pubDate>Wed, 09 Aug 2023 13:13:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d698106-93ee-407c-9120-f256f0a8e8dd</guid><dc:creator>KjellArne Amina</dc:creator><description>&lt;p&gt;Thanks for your reply. Great, then I understood correctly how major, minor, revision and build number works, but it was courteous of you to ensure we are both on the same page.&lt;br /&gt;&lt;br /&gt;We simply read your documentation and wanted to use the build number as described, see for instance the MCUBoot image format documentation: &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/mcuboot/design.html#image-format"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/mcuboot/design.html#image-format&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It works using west build, but does not work in the VS Code NCS plugin. I assumed this was a simple oversight on Nordic&amp;#39;s end, but should probably have been more clear in my original question.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot build numbers in ncs</title><link>https://devzone.nordicsemi.com/thread/440450?ContentTypeID=1</link><pubDate>Wed, 09 Aug 2023 09:30:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae44fa2a-1015-44e2-88f5-40dbed3c36a3</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I see. Basically, everything after + will be ignored.&lt;/p&gt;
&lt;p&gt;This means that if I build two different applications, both with image version &amp;quot;1.2.3&amp;quot;, then I will be able to do DFU between these, back and forth.&lt;/p&gt;
&lt;p&gt;However, I will not be able to DFU to an image version lower than the one that it is already on, e.g. &amp;quot;1.2.2&amp;quot;. This is to prevent possible bugs and loopholes in earlier versions of the firmware. Therefore it is important that if you fix bugs and possible security holes, you need to increase the image version, so that it is no longer possible to DFU to the version that contains the security risk.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;For your request to make sense, you would have to implement something that doesn&amp;#39;t accept the same image version, but requires a strict increase. Without this feature, it doesn&amp;#39;t really make sense to separate on the build numbers.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;That being said, I don&amp;#39;t really see the need for taking the build number into account (and personally I have never used it). From a security perspective, it doesn&amp;#39;t really make any difference. For you as a company, as long as you keep your keys secret, you only need to make sure to increase the version number by at least one every time you roll out an update. You will still have a lot (!) of update numbers, so you probably won&amp;#39;t run out during the lifetime of the product.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot build numbers in ncs</title><link>https://devzone.nordicsemi.com/thread/440314?ContentTypeID=1</link><pubDate>Tue, 08 Aug 2023 12:52:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d060e09-d194-46a9-a0ab-1f17bc494abb</guid><dc:creator>KjellArne Amina</dc:creator><description>&lt;p&gt;Yes, that is correct. The note in &amp;quot;Software based downgrade prevention&amp;quot; (see previous link) calls the &amp;quot;+3&amp;quot; a &amp;quot;label or build number&amp;quot;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;The optional label or build number specified after the &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;+&lt;/span&gt;&lt;/code&gt; character is ignored when evaluating the version. An existing application image with version &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;0.1.2+3&lt;/span&gt;&lt;/code&gt; can be overwritten by an uploaded image with &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;0.1.2+2&lt;/span&gt;&lt;/code&gt;, but not by one with &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;0.1.1+2&lt;/span&gt;&lt;/code&gt;.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;It is not stored anywhere as such, but we provide it our prj.conf file as a config parameter:&lt;/p&gt;
&lt;div style="background-color:#272822;color:#f8f8f2;font-family:&amp;#39;Droid Sans Mono&amp;#39;, &amp;#39;monospace&amp;#39;, monospace;font-size:14px;font-weight:normal;line-height:19px;white-space:pre;"&gt;
&lt;div&gt;&lt;span style="color:#f92672;"&gt;CONFIG_MCUBOOT_IMAGE_VERSION&lt;/span&gt;&lt;span style="color:#f8f8f2;"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74;"&gt;&amp;quot;1.2.3&amp;quot;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot build numbers in ncs</title><link>https://devzone.nordicsemi.com/thread/440299?ContentTypeID=1</link><pubDate>Tue, 08 Aug 2023 12:18:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0fe76772-0c61-458c-99c5-4d5cb3ea0a57</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;What do you mean by build number, and where is it stored? Do you refer to the &amp;quot;+3&amp;quot; in the section you linked to?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>