<?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>Why is MCUboot scratch algorithm disabled on Thingy:91?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/98440/why-is-mcuboot-scratch-algorithm-disabled-on-thingy-91</link><description>The original firmware for Thingy:91 in version 2019-11-29_d3130d77 and earlier, included MCUboot configured to use the scratch partition for swapping the firmware images. 
 Since version 2020-04-29_bc7ade8b, the default MCUboot version no longer does</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 13 Apr 2023 07:34:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/98440/why-is-mcuboot-scratch-algorithm-disabled-on-thingy-91" /><item><title>RE: Why is MCUboot scratch algorithm disabled on Thingy:91?</title><link>https://devzone.nordicsemi.com/thread/420106?ContentTypeID=1</link><pubDate>Thu, 13 Apr 2023 07:34:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f151db98-ecde-4262-940b-3446884fd649</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>[quote user="kFYatek"]commercially available Thingy:91 units are generally expected to be flashed with the latest firmware available at the time of manufacturing, is that right?[/quote]
&lt;p&gt;Generally, but there may be some lag here.&lt;/p&gt;
[quote user="kFYatek"]So I cannot assume that MCUboot on any unit straight from the factory will use either the &amp;quot;move&amp;quot; or &amp;quot;scratch&amp;quot; algorithm?[/quote]
&lt;p&gt;Correct.&lt;br /&gt;I guess this is also a bonus when the partitioning is the same, as you can treat both the same.&lt;/p&gt;
[quote user="kFYatek"]I can&amp;#39;t say that I&amp;#39;m particularly happy that the 120 KiB originally reserved for a scratch partition are now basically unusable without repartitioning the device, but if that&amp;#39;s intentional, then I guess it is what it is.[/quote]
&lt;p&gt;I understand that.&lt;/p&gt;
&lt;p&gt;If it is to some consolidation, you can use our nRF9160DK or nRF5340DK to program the Thingy91, which lets you repartition.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why is MCUboot scratch algorithm disabled on Thingy:91?</title><link>https://devzone.nordicsemi.com/thread/420009?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2023 14:34:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:147614b0-5d07-4dff-9457-e66047a65ccc</guid><dc:creator>kFYatek</dc:creator><description>&lt;p&gt;OK then. I can&amp;#39;t say that I&amp;#39;m particularly happy that the 120 KiB originally reserved for a scratch partition are now basically unusable without repartitioning the device, but if that&amp;#39;s intentional, then I guess it is what it is.&lt;/p&gt;
&lt;p&gt;Just to confirm: commercially available Thingy:91 units are generally expected to be flashed with the latest firmware available at the time of manufacturing, is that right? So I cannot assume that MCUboot on any unit straight from the factory will use either the &amp;quot;move&amp;quot; or &amp;quot;scratch&amp;quot; algorithm?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why is MCUboot scratch algorithm disabled on Thingy:91?</title><link>https://devzone.nordicsemi.com/thread/419997?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2023 14:00:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0534351-6d61-44a0-959e-7f8ed12707ef</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;The move algorithm has less flash wear than the skratch algorithm.&lt;/p&gt;
&lt;p&gt;See &lt;a href="https://www.youtube.com/watch?v=KFgK3TRDNR4"&gt;https://www.youtube.com/watch?v=KFgK3TRDNR4&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why is MCUboot scratch algorithm disabled on Thingy:91?</title><link>https://devzone.nordicsemi.com/thread/419936?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2023 11:41:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5bc82bd3-1c12-4fe9-b5fb-84bd1801a7e3</guid><dc:creator>kFYatek</dc:creator><description>&lt;p&gt;Yes, this makes perfect sense.&lt;/p&gt;
&lt;p&gt;However, what I still don&amp;#39;t understand is why did you change the algorithm from &amp;quot;scratch&amp;quot; to &amp;quot;move&amp;quot; between the 2019 and 2020 revisions of the original firmware? Since the scratch partition has been already reserved, it would make sense to keep using it. Was there some problem with the &amp;quot;scratch&amp;quot; algorithm?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why is MCUboot scratch algorithm disabled on Thingy:91?</title><link>https://devzone.nordicsemi.com/thread/419932?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2023 11:24:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bfbb0a0c-7462-4a61-9225-605eda01a452</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>[quote user="kFYatek"]..so I cannot be sure about what&amp;#39;s going on - but the PR also doesn&amp;#39;t seem to address the fact that the &lt;span style="font-family:courier new, courier;"&gt;mcuboot_scratch&lt;/span&gt; partition is there defined in &lt;span style="font-family:courier new, courier;"&gt;nrf/boards/arm/thingy91_nrf9160/thingy91_pm_static.yml&lt;/span&gt;, yet it is not used for anything - unless I&amp;#39;m missing something. It seems to me that it would make sense to either use the &amp;quot;scratch&amp;quot; algorithm, after all, or reallocate this space for other purposes.[/quote]
&lt;p&gt;Ah, I missed that part of the question.&lt;/p&gt;
&lt;p&gt;It is not clear in our bootloader docs, so I have both given internal feedback to add this there, and created a &lt;a href="https://github.com/nrfconnect/sdk-nrf/pull/10686"&gt;PR&lt;/a&gt; to give users a warning.&lt;br /&gt;But from our &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/scripts/partition_manager/partition_manager.html"&gt;partition manager docs&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&amp;quot;However, if you have a deployed product that consists of multiple images, where only a subset of the included images can be upgraded through a firmware update mechanism, the upgradable images must be statically configured.&amp;quot;&lt;/p&gt;
&lt;p&gt;To translate this, it means that if you use only MCUboot, you can not change partitioning between updates, as this may break DFU for future updates.&lt;br /&gt;This is because when the device is first flashed, MCUboot knows only the old partitioning and assumes that this is where all future partitions will be swapped from/to.&lt;br /&gt;So if the application then tries to write updates to other places in memory, things may break.&lt;/p&gt;
&lt;p&gt;If I were to guess, this is the reason for the static partitioning: So that the updates will be valid for both old and new versions of the thingy.&lt;/p&gt;
&lt;p&gt;If you want to update the partitioning, you must program the Thingy:91 with an external debugger (or DK).&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why is MCUboot scratch algorithm disabled on Thingy:91?</title><link>https://devzone.nordicsemi.com/thread/419926?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2023 11:15:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:677e5bf1-71f1-4c32-a7b1-0294ae192436</guid><dc:creator>kFYatek</dc:creator><description>&lt;p&gt;Hi Sigurd,&lt;/p&gt;
&lt;p&gt;Thanks for looking into this.&lt;/p&gt;
&lt;p&gt;The PR you mentioned indeed seems to address this issue, at least partially - I don&amp;#39;t fully understand it, but from the looks of it, it seems to force reserving an area within the primary partition to make sure that the firmware update procedure works, which is definitely a welcome change.&lt;/p&gt;
&lt;p&gt;I wasn&amp;#39;t able to test the effects myself, because after attempting to apply it, I got the following error when attempting to configure the project:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;-- Found partition manager static configuration: /home/kfyatek/nrf-zephyr/ncs/nrf/boards/arm/thingy91_nrf9160/thingy91_pm_static.yml
Partition &amp;#39;mcuboot&amp;#39; is not included in the dynamic resolving since it is statically defined.
Partition &amp;#39;mcuboot_pad&amp;#39; is not included in the dynamic resolving since it is statically defined.
Partition &amp;#39;mcuboot_primary&amp;#39; is not included in the dynamic resolving since it is statically defined.
Partition &amp;#39;mcuboot_primary_app&amp;#39; is not included in the dynamic resolving since it is statically defined.
Partition &amp;#39;mcuboot_secondary&amp;#39; is not included in the dynamic resolving since it is statically defined.
Partition &amp;#39;settings_storage&amp;#39; is not included in the dynamic resolving since it is statically defined.
Partition &amp;#39;nonsecure_storage&amp;#39; is not included in the dynamic resolving since it is statically defined.
Partition &amp;#39;tfm_secure&amp;#39; is not included in the dynamic resolving since it is statically defined.
Partition &amp;#39;tfm_nonsecure&amp;#39; is not included in the dynamic resolving since it is statically defined.
Partition &amp;#39;tfm&amp;#39; is not included in the dynamic resolving since it is statically defined.
Dropping partition &amp;#39;nrf_modem_lib_trace&amp;#39; since its size is 0.
Traceback (most recent call last):
  File &amp;quot;/home/kfyatek/nrf-zephyr/ncs/nrf/scripts/partition_manager.py&amp;quot;, line 1977, in &amp;lt;module&amp;gt;
    main()
  File &amp;quot;/home/kfyatek/nrf-zephyr/ncs/nrf/scripts/partition_manager.py&amp;quot;, line 1027, in main
    solution.update(solve_region(pm_config, region, region_config,
  File &amp;quot;/home/kfyatek/nrf-zephyr/ncs/nrf/scripts/partition_manager.py&amp;quot;, line 970, in solve_region
    get_region_config(partitions, region_config, static_partitions, system_reqs=pm_config)
  File &amp;quot;/home/kfyatek/nrf-zephyr/ncs/nrf/scripts/partition_manager.py&amp;quot;, line 758, in get_region_config
    solve_complex_region(pm_config, start, size, placement_strategy, region_name, device, static_conf, dp, system_reqs)
  File &amp;quot;/home/kfyatek/nrf-zephyr/ncs/nrf/scripts/partition_manager.py&amp;quot;, line 866, in solve_complex_region
    set_addresses_and_align(pm_config, sub_partitions, solution, free_size, dp, start=start, system_reqs=system_reqs)
  File &amp;quot;/home/kfyatek/nrf-zephyr/ncs/nrf/scripts/partition_manager.py&amp;quot;, line 417, in set_addresses_and_align
    reqs[dp][&amp;#39;size&amp;#39;] = dynamic_partitions_size(reqs, size, dp)
  File &amp;quot;/home/kfyatek/nrf-zephyr/ncs/nrf/scripts/partition_manager.py&amp;quot;, line 388, in dynamic_partitions_size
    size = total_size - sum([req[&amp;#39;size&amp;#39;] for name, req in reqs.items() if &amp;#39;size&amp;#39; in req.keys() and name != dp])
TypeError: unsupported operand type(s) for +: &amp;#39;int&amp;#39; and &amp;#39;str&amp;#39;
CMake Error at /home/kfyatek/nrf-zephyr/ncs/nrf/cmake/partition_manager.cmake:304 (message):
  Partition Manager failed, aborting.  Command:
  /usr/bin/python3.10;/home/kfyatek/nrf-zephyr/ncs/nrf/scripts/partition_manager.py;--input-files;/home/kfyatek/nrf-zephyr/ncs/build/mcuboot/zephyr/include/generated/pm.yml;/home/kfyatek/nrf-zephyr/ncs/build/zephyr/include/generated/pm.yml;/home/kfyatek/nrf-zephyr/ncs/build/modules/nrf/subsys/partition_manager/pm.yml.settings;/home/kfyatek/nrf-zephyr/ncs/build/modules/nrf/subsys/partition_manager/pm.yml.libmodem;/home/kfyatek/nrf-zephyr/ncs/build/modules/nrf/subsys/partition_manager/pm.yml.tfm;/home/kfyatek/nrf-zephyr/ncs/build/modules/nrf/subsys/partition_manager/pm.yml.trustzone;--regions;sram_primary;otp;flash_primary;--output-partitions;/home/kfyatek/nrf-zephyr/ncs/build/partitions.yml;--output-regions;/home/kfyatek/nrf-zephyr/ncs/build/regions.yml;--static-config;/home/kfyatek/nrf-zephyr/ncs/nrf/boards/arm/thingy91_nrf9160/thingy91_pm_static.yml;--sram_primary-size;0x40000;--sram_primary-base-address;0x20000000;--sram_primary-placement-strategy;complex;--sram_primary-dynamic-partition;sram_primary;--otp-size;756;--otp-base-address;0xff8108;--otp-placement-strategy;start_to_end;--flash_primary-size;0x100000;--flash_primary-base-address;0x0;--flash_primary-placement-strategy;complex;--flash_primary-device;flash_controller;--flash_primary-default-driver-kconfig;CONFIG_SOC_FLASH_NRF
Call Stack (most recent call first):
  /home/kfyatek/nrf-zephyr/ncs/zephyr/cmake/modules/kernel.cmake:246 (include)
  /home/kfyatek/nrf-zephyr/ncs/zephyr/cmake/modules/zephyr_default.cmake:117 (include)
  /home/kfyatek/nrf-zephyr/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /home/kfyatek/nrf-zephyr/ncs/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:7 (find_package)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;..so I cannot be sure about what&amp;#39;s going on - but the PR also doesn&amp;#39;t seem to address the fact that the &lt;span style="font-family:courier new, courier;"&gt;mcuboot_scratch&lt;/span&gt; partition is there defined in &lt;span style="font-family:courier new, courier;"&gt;nrf/boards/arm/thingy91_nrf9160/thingy91_pm_static.yml&lt;/span&gt;, yet it is not used for anything - unless I&amp;#39;m missing something. It seems to me that it would make sense to either use the &amp;quot;scratch&amp;quot; algorithm, after all, or reallocate this space for other purposes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why is MCUboot scratch algorithm disabled on Thingy:91?</title><link>https://devzone.nordicsemi.com/thread/419918?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2023 10:26:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:059c6420-4675-4331-a4ff-4ab9c4c176fc</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]Is it by design, or is this a bug? When distributing e.g. open source projects intended to run on the Thingy:91, it creates a problem - the&amp;nbsp;published application shouldn&amp;#39;t require an external debug probe to work, and if FOTA functionality is desired, then one would need to make sure that the application doesn&amp;#39;t fill up the entire partition, so that the &amp;quot;move&amp;quot; algorithm can work. And in either case, without modifying the partition layout (which I believe is discouraged for the Thingy), the 120 KiB of the flash memory just go to waste and are not used&amp;nbsp;for either MCUboot, the app image, or storage space.[/quote]
&lt;p&gt;The &amp;quot;move&amp;quot; algorith also needs a partition to do the move, but it is not included in the partitioning.&lt;br /&gt;This is a bug, and I believe &lt;a href="https://github.com/nrfconnect/sdk-mcuboot/pull/185"&gt;https://github.com/nrfconnect/sdk-mcuboot/pull/185&lt;/a&gt; fixes it.&lt;/p&gt;
&lt;p&gt;So your observation is correct, but it does not relate to the change of algorithm, but rather only to the &amp;quot;move&amp;quot; algorithm.&lt;/p&gt;
&lt;p&gt;Did I understand your report correctly?&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why is MCUboot scratch algorithm disabled on Thingy:91?</title><link>https://devzone.nordicsemi.com/thread/419276?ContentTypeID=1</link><pubDate>Wed, 05 Apr 2023 12:44:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:980a8c3a-596f-419e-ae44-26909ab53e3e</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I will look into this and return with more information next week.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>