<?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>Error when trying to move NV storage partition to external flash</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/100526/error-when-trying-to-move-nv-storage-partition-to-external-flash</link><description>Hello, 
 I&amp;#39;m trying the configuration described below to move the NVS Storage to an external flash memory. 
 I&amp;#39;m using zephyr version v3.1.99-ncs1, nrf v2.1.0, mbedtls-nrf v3.1.0-ncs1 in a Linux development environment. 
 
 
 but enabling the CONFIG_PM_PARTITION_REGION_SETTINGS_STORAGE_EXTERNAL</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 31 Jul 2023 15:04:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/100526/error-when-trying-to-move-nv-storage-partition-to-external-flash" /><item><title>RE: Error when trying to move NV storage partition to external flash</title><link>https://devzone.nordicsemi.com/thread/439087?ContentTypeID=1</link><pubDate>Mon, 31 Jul 2023 15:04:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3febf69-b24a-4ff5-9529-cabd24ec5d0d</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Happy to hear it works.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error when trying to move NV storage partition to external flash</title><link>https://devzone.nordicsemi.com/thread/435294?ContentTypeID=1</link><pubDate>Fri, 07 Jul 2023 14:37:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:272320b0-c2d9-4c1b-84e9-607c89c12e48</guid><dc:creator>GBDVE</dc:creator><description>&lt;p&gt;Hi Amanda,&lt;/p&gt;
&lt;p&gt;Thank you for the suggested configuration.&lt;/p&gt;
&lt;p&gt;With the debug enabled, I&amp;#39;ve finally found the solution.&lt;/p&gt;
&lt;p&gt;The problem was that I&amp;#39;d also moved the secondary partition on the external flash,&lt;/p&gt;
&lt;p&gt;so the primary partition increased in size up to 959kB.&lt;/p&gt;
&lt;p&gt;In the mcuboot.conf I&amp;#39;ve added the line&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BOOT_MAX_IMG_SECTORS=256
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;After this, the app started to work.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error when trying to move NV storage partition to external flash</title><link>https://devzone.nordicsemi.com/thread/431564?ContentTypeID=1</link><pubDate>Fri, 16 Jun 2023 16:57:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e83d8fe-fd5b-4615-b4bf-dd352925cc8b</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
[quote user="GBDVE"]Is it possible to redirect the mcuboot debug on jlink RTT?[/quote]
&lt;p&gt;You can add the following configs to mcuboot.conf&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;# Disable UART Console and enable the RTT console
CONFIG_UART_CONSOLE=n
CONFIG_RTT_CONSOLE=y
CONFIG_USE_SEGGER_RTT=y

# Config logger
CONFIG_LOG=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n

CONFIG_MULTITHREADING=y&lt;/pre&gt;&lt;/p&gt;
[quote user="GBDVE"]I tested the code on an nrf5340dk EVB, and in the 3rd serial port appears the following message:[/quote]
&lt;p&gt;Not sure how you set the configs for nRF53DK, but I have an example&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/hello_5F00_world_5F00_nrf53_5F00_qpsi.7z"&gt;devzone.nordicsemi.com/.../hello_5F00_world_5F00_nrf53_5F00_qpsi.7z&lt;/a&gt;&amp;nbsp;for NCS v2.1.0 which uses nRF5340 with external memory on DK. You can use it as a reference. If it cannot help, please provide the complete prj.conf and mcuboot.conf.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Beware that this code/configuration is not fully tested or qualified and should be considered provided “as-is”. Please test it with your application and let me know if you find any issues.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error when trying to move NV storage partition to external flash</title><link>https://devzone.nordicsemi.com/thread/431413?ContentTypeID=1</link><pubDate>Fri, 16 Jun 2023 07:16:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef2f4a3b-6ba1-4a6c-a643-46ec0cdb3608</guid><dc:creator>GBDVE</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Unfortunately, our hardware does not have an accessible UART port.&lt;/p&gt;
&lt;p&gt;Is it possible to redirect the mcuboot debug on jlink RTT?&lt;/p&gt;
&lt;p&gt;I tested the code on an nrf5340dk EVB, and in the 3rd serial port appears the following message:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting Zephyr OS build v3.1.99-ncs1  ***
I: Starting bootloader
W: Failed reading sectors; BOOT_MAX_IMG_SECTORS=128 - too small?
E: Image in the primary slot is not valid!
E: Unable to find bootable image
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;It doesn&amp;#39;t seem related to the external flash (on the EVB hardware is a different device), the primary image should be in the internal flash.&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;Gabriele.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error when trying to move NV storage partition to external flash</title><link>https://devzone.nordicsemi.com/thread/431080?ContentTypeID=1</link><pubDate>Wed, 14 Jun 2023 16:02:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90420dd2-2907-40db-b7c2-41e2e54023f8</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Because&amp;nbsp;mcuboot uses 0x10000 and&amp;nbsp;mcuboot_pad uses&amp;nbsp;mcuboot_pad, the app starts at&amp;nbsp;0x10200. That looks correct.&amp;nbsp;&lt;/p&gt;
[quote user="GBDVE"]but the generated code doesn&amp;#39;t work on the hardware.[/quote]
&lt;p&gt;Could you elaborate in more detail on how it doesn&amp;#39;t work? Could you provide the complete log? See&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/88933/mcuboot-logs/372395"&gt;this post&lt;/a&gt;&amp;nbsp;to enable mcuboot log.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error when trying to move NV storage partition to external flash</title><link>https://devzone.nordicsemi.com/thread/430645?ContentTypeID=1</link><pubDate>Tue, 13 Jun 2023 08:07:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b4ed8cbd-d026-41c9-95c1-47fedb53a9db</guid><dc:creator>GBDVE</dc:creator><description>&lt;p&gt;Hi Amanda,&lt;/p&gt;
&lt;p&gt;the modification you suggested did work, but now there is another big problem.&lt;/p&gt;
&lt;p&gt;As you can notice on the demo code I&amp;#39;ve sent, in the child_image directory, there is a mcuboot.conf with a configuration parameter to increase the bootloader size. Without this setting, the build fails with the following error:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;region `FLASH&amp;#39; overflowed by 5924 bytes
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;By adjusting the mcuboot size with the following line:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;span style="font-family:courier new, courier;"&gt;CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x10000&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;the build completes without errors, but the generated code doesn&amp;#39;t work on the hardware. I notice that the app code starts on a +0x200 byte offset in the internal flash, could this be the problem?&lt;/p&gt;
&lt;p&gt;This is the output of the &amp;quot;ninja partition_manager_report&amp;quot; command:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;  external_flash (0x2000000 - 32768kB): 
+-------------------------------------------------+
| 0x0: mcuboot_secondary (0xf0000 - 960kB)        |
| 0xf0000: settings_storage (0x2000 - 8kB)        |
| 0xf2000: littlefs_storage (0xf0e000 - 15416kB)  |
| 0x1000000: external_flash (0x1000000 - 16384kB) |
+-------------------------------------------------+

  flash_primary (0x100000 - 1024kB): 
+--------------------------------------------------+
| 0x0: mcuboot (0x10000 - 64kB)                    |
+---0x10000: mcuboot_primary (0xf0000 - 960kB)-----+
| 0x10000: mcuboot_pad (0x200 - 512B)              |
+---0x10200: mcuboot_primary_app (0xefe00 - 959kB)-+
| 0x10200: app (0xefe00 - 959kB)                   |
+--------------------------------------------------+

  otp (0x2fc - 764B): 
+------------------------------+
| 0xff8100: otp (0x2fc - 764B) |
+------------------------------+

  sram_primary (0x80000 - 512kB): 
+-----------------------------------------------+
| 0x20000000: pcd_sram (0x2000 - 8kB)           |
| 0x20002000: sram_primary (0x6e000 - 440kB)    |
| 0x20070000: rpmsg_nrf53_sram (0x10000 - 64kB) |
+-----------------------------------------------+

 CPUNET flash_primary (0x40000 - 256kB): 
+--------------------------------------------+
+---0x1000000: b0n_container (0x8800 - 34kB)-+
| 0x1000000: b0n (0x8600 - 33kB)             |
| 0x1008600: provision (0x200 - 512B)        |
+---0x1008800: app (0x37800 - 222kB)---------+
| 0x1008800: hci_rpmsg (0x37800 - 222kB)     |
+--------------------------------------------+

 CPUNET sram_primary (0x10000 - 64kB): 
+-------------------------------------------+
| 0x21000000: sram_primary (0x10000 - 64kB) |
+-------------------------------------------+
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;As you can see, the app starts at the address 0x10200.&lt;/p&gt;
&lt;p&gt;My question is: &lt;strong&gt;what is the correct way to increase the mcuboot sector?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;Gabriele.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error when trying to move NV storage partition to external flash</title><link>https://devzone.nordicsemi.com/thread/430249?ContentTypeID=1</link><pubDate>Fri, 09 Jun 2023 13:08:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:baff9014-9419-4c9c-ab34-958efc7ff701</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Looks like the last #endif in &lt;a title="https://github.com/nrfconnect/sdk-nrf/blob/main/subsys/partition_manager/pm.yml.settings" href="https://github.com/nrfconnect/sdk-nrf/blob/main/subsys/partition_manager/pm.yml.settings" rel="noopener noreferrer" target="_blank"&gt;pm.yml.settings&lt;/a&gt; is one line too low.&lt;/p&gt;
&lt;p&gt;From for example &lt;a title="https://github.com/nrfconnect/sdk-nrf/blob/main/subsys/partition_manager/pm.yml.file_system" href="https://github.com/nrfconnect/sdk-nrf/blob/main/subsys/partition_manager/pm.yml.file_system" rel="noopener noreferrer" target="_blank"&gt;pm.yml.file_system&lt;/a&gt;, we can see that &amp;quot;size&amp;quot; should be defined after the #endif. Try to move &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v2.1.0/subsys/partition_manager/pm.yml.settings#L13"&gt;this line&lt;/a&gt;&amp;nbsp;&lt;span&gt;after the &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v2.1.0/subsys/partition_manager/pm.yml.settings#L14"&gt;#endif&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;diff --git a/subsys/partition_manager/pm.yml.settings b/subsys/partition_manager/pm.yml.settings
index 5bbc9cc6c..798943908 100644
--- a/subsys/partition_manager/pm.yml.settings
+++ b/subsys/partition_manager/pm.yml.settings
@@ -10,5 +10,5 @@ settings_storage:
     align: {start: CONFIG_NRF_SPU_FLASH_REGION_SIZE}
 #endif
   inside: [nonsecure_storage]
-  size: CONFIG_PM_PARTITION_SIZE_SETTINGS_STORAGE
 #endif
+  size: CONFIG_PM_PARTITION_SIZE_SETTINGS_STORAGE&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Please let me know if this can help or not. Thanks.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error when trying to move NV storage partition to external flash</title><link>https://devzone.nordicsemi.com/thread/429996?ContentTypeID=1</link><pubDate>Thu, 08 Jun 2023 12:41:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c68f4fb-f64f-4e98-853b-d4ce6237a9aa</guid><dc:creator>GBDVE</dc:creator><description>&lt;p&gt;Hi Amanda,&lt;br /&gt;Please find the attachment containing a sample source code using the same configuration as our application.&lt;/p&gt;
&lt;p&gt;In the build directory, I use the following commands to populate the cmake project:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;$ cmake -B . -DBOARD=nrf5340dk_nrf5340_cpuapp -G&amp;quot;Eclipse CDT4 - Ninja&amp;quot; ../bs02_fw&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;after some computation, it fails with the following messages:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;  Eclipse CDT4 generator amendment mode:
   C and CXX includes, defines in .cproject without __cplusplus
   with project includes and defines
Traceback (most recent call last):
  File &amp;quot;/opt/nordicsemi/ncs2/nrf/scripts/partition_manager.py&amp;quot;, line 1940, in &amp;lt;module&amp;gt;
    main()
  File &amp;quot;/opt/nordicsemi/ncs2/nrf/scripts/partition_manager.py&amp;quot;, line 1020, in main
    static_config, regions))
  File &amp;quot;/opt/nordicsemi/ncs2/nrf/scripts/partition_manager.py&amp;quot;, line 962, in solve_region
    get_region_config(partitions, region_config, static_partitions, system_reqs=pm_config)
  File &amp;quot;/opt/nordicsemi/ncs2/nrf/scripts/partition_manager.py&amp;quot;, line 735, in get_region_config
    static_conf, system_reqs)
  File &amp;quot;/opt/nordicsemi/ncs2/nrf/scripts/partition_manager.py&amp;quot;, line 782, in solve_simple_region
    address += pm_config[partition_name][&amp;#39;size&amp;#39;]
KeyError: &amp;#39;size&amp;#39;
CMake Error at /opt/nordicsemi/ncs2/nrf/cmake/partition_manager.cmake:290 (message):
  Partition Manager failed, aborting.  Command:
  /usr/bin/python3.7;/opt/nordicsemi/ncs2/nrf/scripts/partition_manager.py;--input-files;/home/dve/progetti/elettroprogetti/nexter/bs02/software/fw/ticket_nordic01/build/mcuboot/zephyr/include/generated/pm.yml;/home/dve/progetti/elettroprogetti/nexter/bs02/software/fw/ticket_nordic01/build/mcuboot/modules/nrf/subsys/partition_manager/pm.yml.pcd;/home/dve/progetti/elettroprogetti/nexter/bs02/software/fw/ticket_nordic01/build/zephyr/include/generated/pm.yml;/home/dve/progetti/elettroprogetti/nexter/bs02/software/fw/ticket_nordic01/build/modules/nrf/subsys/partition_manager/pm.yml.settings;/home/dve/progetti/elettroprogetti/nexter/bs02/software/fw/ticket_nordic01/build/modules/nrf/subsys/partition_manager/pm.yml.file_system;/home/dve/progetti/elettroprogetti/nexter/bs02/software/fw/ticket_nordic01/build/modules/nrf/subsys/partition_manager/pm.yml.rpmsg_nrf53;--regions;sram_primary;otp;flash_primary;external_flash;--output-partitions;/home/dve/progetti/elettroprogetti/nexter/bs02/software/fw/ticket_nordic01/build/partitions.yml;--output-regions;/home/dve/progetti/elettroprogetti/nexter/bs02/software/fw/ticket_nordic01/build/regions.yml;--sram_primary-size;0x80000;--sram_primary-base-address;0x20000000;--sram_primary-placement-strategy;complex;--sram_primary-dynamic-partition;sram_primary;--otp-size;764;--otp-base-address;0xff8100;--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;--external_flash-size;33554432;--external_flash-base-address;0;--external_flash-placement-strategy;start_to_end;--external_flash-device;/soc/peripheral@50000000/spi@b000/w25q256jveiq@0;--external_flash-default-driver-kconfig;CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK
Call Stack (most recent call first):
  /opt/nordicsemi/ncs2/zephyr/cmake/modules/kernel.cmake:244 (include)
  /opt/nordicsemi/ncs2/zephyr/cmake/modules/zephyr_default.cmake:130 (include)
  /opt/nordicsemi/ncs2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /opt/nordicsemi/ncs2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:12 (find_package)
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you comment the two lines relative to the external storage in the prj.conf, the project can be configured and built:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;
# External partitions
CONFIG_PM_PARTITION_REGION_LITTLEFS_EXTERNAL=y
#CONFIG_PM_PARTITION_REGION_SETTINGS_STORAGE_EXTERNAL=y
#CONFIG_PM_PARTITION_REGION_NVS_STORAGE_EXTERNAL=y
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your support.&lt;br /&gt;Gabriele.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/bs02_5F00_fw.zip"&gt;devzone.nordicsemi.com/.../bs02_5F00_fw.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Error when trying to move NV storage partition to external flash</title><link>https://devzone.nordicsemi.com/thread/429844?ContentTypeID=1</link><pubDate>Wed, 07 Jun 2023 18:55:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba7222ad-0d0c-4460-8066-6d5b9c4f5845</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t seen that error before, could you provide the project to reproduce the issue?&amp;nbsp;&lt;/p&gt;
[quote user=""]Is there a way to limit the external_flash region to a value different than 0x200000?[/quote]
&lt;p&gt;I need to check your overlay.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>