<?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 clash with USB Mass Device Littlefs Partition</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/97401/mcuboot-clash-with-usb-mass-device-littlefs-partition</link><description>Hi everyone, 
 I am trying to run a Zephyr application (NRF52833 device) which has external flash accessed via SPI. On the external flash, there is a second image (MCUboot) and a Littlefs partition. 
 The Zephyr application is configured to be a USB Mass</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 10 Mar 2023 16:02:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/97401/mcuboot-clash-with-usb-mass-device-littlefs-partition" /><item><title>RE: MCUboot clash with USB Mass Device Littlefs Partition</title><link>https://devzone.nordicsemi.com/thread/414713?ContentTypeID=1</link><pubDate>Fri, 10 Mar 2023 16:02:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8fe648a-5363-4093-83f6-6d68eac2c224</guid><dc:creator>DEng01</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi&amp;nbsp;&lt;/span&gt;&lt;span&gt;H&amp;aring;kon,&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;That has fixed it! Thank you very much!&amp;nbsp; While the work around is okay for the time being - I think a ticket should be raised against the bug in multi-image builds. How do you go about doing this? Or have you raised an internal ticket?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Where can I find the flash_disks file? I cannot seem to find it in the build folder.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;How did you know to look for this when debugging - I have tried looking in here&amp;nbsp;&lt;a id="" href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/index.html"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/index.html&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But I can&amp;#39;t seem to find the information.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks for all your help and support.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;David&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot clash with USB Mass Device Littlefs Partition</title><link>https://devzone.nordicsemi.com/thread/414638?ContentTypeID=1</link><pubDate>Fri, 10 Mar 2023 12:53:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a36ea541-b75e-46f5-beb6-1bbb55ae761d</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;My apologies for misunderstanding the scenario.&lt;/p&gt;
&lt;p&gt;I think I have replicated the issue and found the source.&lt;/p&gt;
&lt;p&gt;I have moved both DTS and PM declared partitions to match, and found that when not using mcuboot, this is the device that the flash disk subsys picks up this &amp;quot;dev&amp;quot;:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;(gdb) print flash_disks.info
$2 = {node = {{head = 0x20000dc4 &amp;lt;disk_access_list&amp;gt;, next = 0x20000dc4 &amp;lt;disk_access_list&amp;gt;}, {
      tail = 0x20000dc4 &amp;lt;disk_access_list&amp;gt;, prev = 0x20000dc4 &amp;lt;disk_access_list&amp;gt;}}, name = 0x22f59 &amp;quot;NAND&amp;quot;, 
  ops = 0x22680 &amp;lt;flash_disk_ops&amp;gt;, dev = 0x221c8 &amp;lt;__device_dts_ord_12&amp;gt;}
&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;While this is the &amp;quot;dev&amp;quot; that is picked up when using multi-image build:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;(gdb) print flash_disks.info
$1 = {node = {{head = 0x20000dc4 &amp;lt;disk_access_list&amp;gt;, next = 0x20000dc4 &amp;lt;disk_access_list&amp;gt;}, {
      tail = 0x20000dc4 &amp;lt;disk_access_list&amp;gt;, prev = 0x20000dc4 &amp;lt;disk_access_list&amp;gt;}}, name = 0x22f59 &amp;quot;NAND&amp;quot;, 
  ops = 0x22680 &amp;lt;flash_disk_ops&amp;gt;, dev = 0x221b4 &amp;lt;__device_dts_ord_125&amp;gt;}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When we look at the very top of build-folder/zephyr/include/generated/devicetree_generated.h, we can see the device table:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt; * Node dependency ordering (ordinal and path):
 *   0   /
 *   1   /aliases
 *   2   /analog-connector
 *   3   /chosen
 *   4   /connector
 *   5   /entropy_bt_hci
 *   6   /soc
 *   7   /pin-controller
 *   8   /pin-controller/qspi_default
 *   9   /pin-controller/qspi_sleep
 *   10  /soc/interrupt-controller@e000e100
 *   11  /soc/qspi@40029000
 *   12  /soc/qspi@40029000/mx25r6435f@0
 *   13  /soc/qspi@40029000/mx25r6435f@0/partitions
 *   14  /soc/qspi@40029000/mx25r6435f@0/partitions/partition@0
 *   15  /msc_disk0
 *   16  /soc/timer@4000a000
 *   17  /sw-pwm
 *   18  /buttons
 *   19  /soc/gpio@50000000
 *   20  /buttons/button_0
 *   21  /buttons/button_1
 *   22  /buttons/button_2
 *   23  /buttons/button_3
 *   24  /cpus
 *   25  /cpus/cpu@0
 *   26  /cpus/cpu@0/itm@e0000000
 *   27  /leds
 *   28  /leds/led_0
 *   29  /leds/led_1
 *   30  /leds/led_2
 *   31  /leds/led_3
 *   32  /pin-controller/i2c0_default
 *   33  /pin-controller/i2c0_default/group1
 *   34  /pin-controller/i2c0_sleep
 *   35  /pin-controller/i2c0_sleep/group1
 *   36  /pin-controller/i2c1_default
 *   37  /pin-controller/i2c1_default/group1
 *   38  /pin-controller/i2c1_sleep
 *   39  /pin-controller/i2c1_sleep/group1
 *   40  /pin-controller/pwm0_default
 *   41  /pin-controller/pwm0_default/group1
 *   42  /pin-controller/pwm0_sleep
 *   43  /pin-controller/pwm0_sleep/group1
 *   44  /pin-controller/qspi_default/group1
 *   45  /pin-controller/qspi_sleep/group1
 *   46  /pin-controller/qspi_sleep/group2
 *   47  /pin-controller/spi0_default
 *   48  /pin-controller/spi0_default/group1
 *   49  /pin-controller/spi0_sleep
 *   50  /pin-controller/spi0_sleep/group1
 *   51  /pin-controller/spi1_default
 *   52  /pin-controller/spi1_default/group1
 *   53  /pin-controller/spi1_sleep
 *   54  /pin-controller/spi1_sleep/group1
 *   55  /pin-controller/spi2_default
 *   56  /pin-controller/spi2_default/group1
 *   57  /pin-controller/spi2_sleep
 *   58  /pin-controller/spi2_sleep/group1
 *   59  /pin-controller/spi3_default
 *   60  /pin-controller/spi3_default/group1
 *   61  /pin-controller/spi3_sleep
 *   62  /pin-controller/spi3_sleep/group1
 *   63  /pin-controller/uart0_default
 *   64  /pin-controller/uart0_default/group1
 *   65  /pin-controller/uart0_default/group2
 *   66  /pin-controller/uart0_sleep
 *   67  /pin-controller/uart0_sleep/group1
 *   68  /pin-controller/uart1_default
 *   69  /pin-controller/uart1_default/group1
 *   70  /pin-controller/uart1_default/group2
 *   71  /pin-controller/uart1_sleep
 *   72  /pin-controller/uart1_sleep/group1
 *   73  /pwmleds
 *   74  /soc/pwm@4001c000
 *   75  /pwmleds/pwm_led_0
 *   76  /soc/acl@4001e000
 *   77  /soc/adc@40007000
 *   78  /soc/ccm@4000f000
 *   79  /soc/clock@40000000
 *   80  /soc/comparator@40013000
 *   81  /soc/ecb@4000e000
 *   82  /soc/egu@40014000
 *   83  /soc/egu@40015000
 *   84  /soc/egu@40016000
 *   85  /soc/egu@40017000
 *   86  /soc/egu@40018000
 *   87  /soc/egu@40019000
 *   88  /soc/ficr@10000000
 *   89  /soc/gpiote@40006000
 *   90  /soc/i2c@40003000
 *   91  /soc/i2c@40004000
 *   92  /soc/i2s@40025000
 *   93  /soc/memory@20000000
 *   94  /soc/mwu@40020000
 *   95  /soc/nfct@40005000
 *   96  /soc/pdm@4001d000
 *   97  /soc/power@40000000
 *   98  /soc/ppi@4001f000
 *   99  /soc/pwm@40021000
 *   100 /soc/pwm@40022000
 *   101 /soc/pwm@4002d000
 *   102 /soc/qdec@40012000
 *   103 /soc/random@4000d000
 *   104 /soc/rtc@4000b000
 *   105 /soc/rtc@40011000
 *   106 /soc/rtc@40024000
 *   107 /soc/spi@40003000
 *   108 /soc/spi@40004000
 *   109 /soc/spi@40023000
 *   110 /soc/gpio@50000300
 *   111 /soc/spi@4002f000
 *   112 /soc/temp@4000c000
 *   113 /soc/timer@40008000
 *   114 /soc/timer@40009000
 *   115 /soc/timer@4001a000
 *   116 /soc/timer@4001b000
 *   117 /soc/timer@e000e010
 *   118 /soc/uart@40002000
 *   119 /soc/uart@40028000
 *   120 /soc/uicr@10001000
 *   121 /soc/usbd@40027000
 *   122 /soc/watchdog@40010000
 *   123 /soc/crypto@5002a000
 *   124 /soc/crypto@5002a000/crypto@5002b000
 *   125 /soc/flash-controller@4001e000
 *   126 /soc/flash-controller@4001e000/flash@0
 *   127 /soc/flash-controller@4001e000/flash@0/partitions
 *   128 /soc/flash-controller@4001e000/flash@0/partitions/partition@0
 *   129 /soc/flash-controller@4001e000/flash@0/partitions/partition@c000
 *   130 /soc/flash-controller@4001e000/flash@0/partitions/partition@73000
 *   131 /soc/flash-controller@4001e000/flash@0/partitions/partition@da000
 *   132 /soc/radio@40001000
 *   133 /soc/radio@40001000/ieee802154
 *
 * Definitions derived from these nodes in dependency order are next,
 * followed by /chosen nodes.
 */&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We are interested in these two:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;12  /soc/qspi@40029000/mx25r6435f@0
...
125 /soc/flash-controller@4001e000&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now we can clearly see that the multi-image build selects the wrong device when trying to lookup the disk flash meta data, thus explaning why lfs does not work in combination with USB mass storage.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;How to work around this issue:&lt;/p&gt;
&lt;p&gt;By setting the settings partition at offset 0, this now seems to be picked up properly by the build system.&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s your project, with modifications:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/4666.mass_5F00_nrf52840_5F00_offset_5F00_0.zip"&gt;devzone.nordicsemi.com/.../4666.mass_5F00_nrf52840_5F00_offset_5F00_0.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try this and see if it now works on your side as well?&lt;/p&gt;
&lt;p&gt;I ran:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;sudo ./lfs --read_size=16 --prog_size=16 --block_size=4096 --block_count=32 --cache_size=64 --lookahead_size=32 /dev/sdX mount/
sudo touch mount/test&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s the output after I un-mounted the FS on my PC and rebooted the nRF:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting Zephyr OS build v3.2.99-ncs2 ***
*** Booting Zephyr OS build v3.2.99-ncs2 ***
[00:00:00.000,335] &amp;lt;inf&amp;gt; flashdisk: Initialize device NAND
[00:00:00.000,366] &amp;lt;inf&amp;gt; flashdisk: offset 0, sector size 512, page size 4096, volume size 131072
Area 0 at 0x0 on mx25r6435f@0 for 131072 bytes
[00:00:00.000,640] &amp;lt;inf&amp;gt; littlefs: LittleFS version 2.5, disk version 2.0
[00:00:00.000,701] &amp;lt;inf&amp;gt; littlefs: FS at mx25r6435f@0:0x0 is 32 0x1000-byte blocks with 512 cycle
[00:00:00.000,701] &amp;lt;inf&amp;gt; littlefs: sizes: rd 16 ; pr 16 ; ca 64 ; la 32
[00:00:00.002,044] &amp;lt;inf&amp;gt; littlefs: /lfs mounted
Mount /lfs: 0
/lfs: bsize = 16 ; frsize = 4096 ; blocks = 32 ; bfree = 30
/lfs opendir: 0
  F 0 test
End of files
[00:00:00.054,962] &amp;lt;inf&amp;gt; main: The device is put in USB mass storage mode.
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot clash with USB Mass Device Littlefs Partition</title><link>https://devzone.nordicsemi.com/thread/414467?ContentTypeID=1</link><pubDate>Thu, 09 Mar 2023 16:55:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef082aa7-a6c3-4cb3-bcd4-1440a334e3c8</guid><dc:creator>DEng01</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;H&amp;aring;kon,&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;you have raised some very good points.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I have looked at the log for the build with MUBoot and I have noticed that&amp;nbsp;&lt;strong&gt;flashdisk: offset e0000&amp;nbsp;&lt;/strong&gt;and&amp;nbsp;&lt;strong&gt;FS at mx25r6435f@0:0xf0000&amp;nbsp;&lt;/strong&gt;. I thought maybe there was an address mismatch causing the littlefs_fuse to fail.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I modified the following:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;storage_partition: partition@f0000 {
			label = &amp;quot;lfs_storage&amp;quot;;
			reg = &amp;lt;0x000f0000 0x00020000&amp;gt;;
		};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The device still cannot connect to littlefs_fuse.&lt;/p&gt;
&lt;p&gt;Here are the logs:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;00&amp;gt; *** Booting Zephyr OS build v3.2.99-ncs1 ***00&amp;gt; [00:00:00.000,335] &amp;lt;inf&amp;gt; flashdisk: Initialize device NAND00&amp;gt; [00:00:00.000,335] &amp;lt;inf&amp;gt; flashdisk: offset f0000, sector size 512, page size 4096, volume size 13107200&amp;gt; Area 6 at 0xf0000 on mx25r6435f@0 for 24576 bytes00&amp;gt; [00:00:00.000,488] &amp;lt;inf&amp;gt; littlefs: LittleFS version 2.5, disk version 2.000&amp;gt; [00:00:00.000,732] &amp;lt;inf&amp;gt; littlefs: FS at mx25r6435f@0:0xf0000 is 6 0x1000-byte blocks with 512 cycle00&amp;gt; [00:00:00.000,732] &amp;lt;inf&amp;gt; littlefs: sizes: rd 16 ; pr 16 ; ca 64 ; la 3200&amp;gt; [00:00:00.001,281] &amp;lt;inf&amp;gt; littlefs: /lfs mounted00&amp;gt; Mount /lfs: 000&amp;gt; /lfs: bsize = 16 ; frsize = 4096 ; blocks = 6 ; bfree = 400&amp;gt; /lfs opendir: 000&amp;gt; End of files00&amp;gt; [00:00:00.053,039] &amp;lt;inf&amp;gt; main: The device is put in USB mass storage mode.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I have tried plugging and unplugging the device to make sure the machine enumerated with the nrf52 device with fs already formatted to no success.&lt;/p&gt;
&lt;p&gt;Do you have any more suggestions that I could try?&lt;/p&gt;
&lt;p&gt;Have you tried littlefs_fuse on your end?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;David&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot clash with USB Mass Device Littlefs Partition</title><link>https://devzone.nordicsemi.com/thread/414439?ContentTypeID=1</link><pubDate>Thu, 09 Mar 2023 15:20:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71abbf0c-c8d3-4568-8fe5-2a53388a4ca4</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi David,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you share the logs of each case?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Your pm_static.yml will offset your application now, and in the case where mcuboot image is not present; you will never go to your application.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="DEng01"]unable to connect (partition looks corrupted?).[/quote]
&lt;p&gt;This is always expected the very first time you boot up with an empty storage area, as it needs to be formatted to littlefs.&lt;/p&gt;
&lt;p&gt;This indicates that you have two different areas where the littlefs_storage is located between the two builds.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Unmodified output, you can see that it selects 6 pages:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:00.000,335] &amp;lt;inf&amp;gt; flashdisk: Initialize device NAND                
[00:00:00.000,366] &amp;lt;inf&amp;gt; flashdisk: offset e0000, sector size 512, page size 4096, volume size 131072
Area 6 at 0xf0000 on mx25r6435f@0 for 24576 bytes
[00:00:00.000,610] &amp;lt;inf&amp;gt; littlefs: LittleFS version 2.5, disk version 2.0
[00:00:00.000,823] &amp;lt;inf&amp;gt; littlefs: FS at mx25r6435f@0:0xf0000 is 6 0x1000-byte blocks with 512 cycle
[00:00:00.000,854] &amp;lt;inf&amp;gt; littlefs: sizes: rd 16 ; pr 16 ; ca 64 ; la 32
[00:00:00.001,281] &amp;lt;err&amp;gt; littlefs: WEST_TOPDIR/modules/fs/littlefs/lfs.c:1234: Corrupted dir pair at {0x0, 0x1}
[00:00:00.001,281] &amp;lt;wrn&amp;gt; littlefs: can&amp;#39;t mount (LFS -84); formatting
[00:00:00.205,963] &amp;lt;inf&amp;gt; littlefs: /lfs mounted
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Removing all Partition Manager and mcuboot configs (ie. using the DTS definition), you can see that it selects 32 pages:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:00.405,639] &amp;lt;inf&amp;gt; flashdisk: Initialize device NAND
[00:00:00.405,639] &amp;lt;inf&amp;gt; flashdisk: offset e0000, sector size 512, page size 4096, volume size 131072
Area 0 at 0xe0000 on mx25r6435f@0 for 131072 bytes
[00:00:00.405,914] &amp;lt;inf&amp;gt; littlefs: LittleFS version 2.5, disk version 2.0
[00:00:00.406,158] &amp;lt;inf&amp;gt; littlefs: FS at mx25r6435f@0:0xe0000 is 32 0x1000-byte blocks with 512 cycle
[00:00:00.406,188] &amp;lt;inf&amp;gt; littlefs: sizes: rd 16 ; pr 16 ; ca 64 ; la 32
[00:00:00.406,616] &amp;lt;err&amp;gt; littlefs: WEST_TOPDIR/modules/fs/littlefs/lfs.c:1234: Corrupted dir pair at {0x0, 0x1}
[00:00:00.406,616] &amp;lt;wrn&amp;gt; littlefs: can&amp;#39;t mount (LFS -84); formatting
[00:00:00.611,297] &amp;lt;inf&amp;gt; littlefs: /lfs mounted
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you go back-and-forth between these two builds, it will continue to format your littlefs area(s).&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot clash with USB Mass Device Littlefs Partition</title><link>https://devzone.nordicsemi.com/thread/414362?ContentTypeID=1</link><pubDate>Thu, 09 Mar 2023 12:17:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d7f81c1f-6c60-4961-99a3-c9246a267e39</guid><dc:creator>DEng01</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi&amp;nbsp;H&amp;aring;kon,&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I have had a go at replicating my project with a NRF52840DK board (with MCUBoot second image and littlefs on the external flash), and I am able to replicate my error.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;MCUboot off -&amp;gt; littlefs_fuse (or windows&amp;nbsp;LittleFS-Explorer-for-Windows) - works fine&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;MCUboot on-&amp;gt; littlefs_fuse (or windows&amp;nbsp;LittleFS-Explorer-for-Windows) -&amp;nbsp;unable to connect (partition looks corrupted?).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I have also added a pm_static.yml file to see if that resolves the issue - but unfortunately&amp;nbsp;it does not.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I have attached the zip project if you could please have a look and point me in the right direction.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;David&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/mass_2D00_nrf52840_2D00_mcuboot.zip"&gt;devzone.nordicsemi.com/.../mass_2D00_nrf52840_2D00_mcuboot.zip&lt;/a&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;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot clash with USB Mass Device Littlefs Partition</title><link>https://devzone.nordicsemi.com/thread/414228?ContentTypeID=1</link><pubDate>Wed, 08 Mar 2023 17:47:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c9215e2-ef1f-4907-8be8-ddbc9a6acb99</guid><dc:creator>DEng01</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;H&amp;aring;kon,&lt;/p&gt;
&lt;p&gt;Thanks for your response, as you have mentioned - it has become clear to me that you will need a pm_static.yml if partition manager is used. For my original setup where the second mcuboot image and littlefs fs are placed on an external flash device, I have copied the compilation of partitions.tml and made it into a pm_static.yml file.&lt;/p&gt;
&lt;p&gt;One thing I don&amp;#39;t understand: is the external flash entry in the pm_static.yml a duplication?&lt;/p&gt;
&lt;p&gt;When I run&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;west build -t partition_manager_report&lt;/pre&gt;&lt;/p&gt;
&lt;div class="content full threaded-reply-content user-defined-markup" data-replyid="414169" data-userid="2115" data-permalink="~/f/nordic-q-a/97401/mcuboot-clash-with-usb-mass-device-littlefs-partition/414169"&gt;
&lt;div class="content"&gt;
&lt;div&gt;I get the following map:&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;external_flash (0x4000000 - 65536kB): 
+-----------------------------------------------------+
| 0x0: mcuboot_secondary (0x60000 - 384kB)            |
| 0x60000: littlefs_storage (0x3fa0000 - 65152kB)     |
| 0x4000000: external_flash (-0x3800000 - -58720256B) |
+-----------------------------------------------------+

  flash_primary (0x80000 - 512kB): 
+--------------------------------------------------+
| 0x0: mcuboot (0x20000 - 128kB)                   |
+---0x20000: mcuboot_primary (0x60000 - 384kB)-----+
| 0x20000: mcuboot_pad (0x200 - 512B)              |
+---0x20200: mcuboot_primary_app (0x5fe00 - 383kB)-+
| 0x20200: app (0x5fe00 - 383kB)                   |
+--------------------------------------------------+

  sram_primary (0x20000 - 128kB): 
+--------------------------------------------+
| 0x20000000: sram_primary (0x20000 - 128kB) |
+--------------------------------------------+&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;I don&amp;#39;t understand why&amp;nbsp;&lt;strong&gt;0x4000000: external_flash (-0x3800000 - -58720256B)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;is generated.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Do you know why this is?&lt;/div&gt;
&lt;div&gt;How would you modify the partitions.yml (or pm_static.yml) file?&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Thanks,&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;David&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 clash with USB Mass Device Littlefs Partition</title><link>https://devzone.nordicsemi.com/thread/414169?ContentTypeID=1</link><pubDate>Wed, 08 Mar 2023 14:36:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d593eb08-bbf8-4b8c-b413-bb3f52cdcdcd</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi David,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s with MCUBoot enabled:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting Zephyr OS build v3.2.99-ncs2 ***
I: Starting bootloader
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Boot source: none
I: Swap type: none
I: Bootloader chainload address offset: 0xc000
*** Booting Zephyr OS build v3.2.99-ncs2 ***
[00:00:00.000,183] &amp;lt;inf&amp;gt; flashdisk: Initialize device NAND
[00:00:00.000,213] &amp;lt;inf&amp;gt; flashdisk: offset 46000, sector size 512, page size 4096, volume size 237568
Area 6 at 0x7a000 on flash-controller@4001e000 for 24576 bytes
[00:00:00.000,549] &amp;lt;inf&amp;gt; littlefs: LittleFS version 2.5, disk version 2.0
[00:00:00.000,671] &amp;lt;inf&amp;gt; littlefs: FS at flash-controller@4001e000:0x7a000 is 6 0x1000-byte blocks with 512 cycle
[00:00:00.000,671] &amp;lt;inf&amp;gt; littlefs: sizes: rd 16 ; pr 16 ; ca 64 ; la 32
[00:00:00.000,793] &amp;lt;err&amp;gt; littlefs: WEST_TOPDIR/modules/fs/littlefs/lfs.c:1234: Corrupted dir pair at {0x0, 0x1}
[00:00:00.000,823] &amp;lt;wrn&amp;gt; littlefs: can&amp;#39;t mount (LFS -84); formatting
[00:00:00.175,415] &amp;lt;inf&amp;gt; littlefs: /lfs mounted
Mount /lfs: 0
/lfs: bsize = 16 ; frsize = 4096 ; blocks = 6 ; bfree = 4
/lfs opendir: 0
End of files
[00:00:00.226,379] &amp;lt;inf&amp;gt; main: The device is put in USB mass storage mode.
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And here&amp;#39;s with it disabled:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting Zephyr OS build v3.2.99-ncs2 ***
[00:00:00.345,581] &amp;lt;inf&amp;gt; flashdisk: Initialize device NAND
[00:00:00.345,581] &amp;lt;inf&amp;gt; flashdisk: offset 46000, sector size 512, page size 4096, volume size 237568
Area 0 at 0x46000 on flash-controller@4001e000 for 237568 bytes
[00:00:00.345,916] &amp;lt;inf&amp;gt; littlefs: LittleFS version 2.5, disk version 2.0
[00:00:00.346,069] &amp;lt;inf&amp;gt; littlefs: FS at flash-controller@4001e000:0x46000 is 58 0x1000-byte blocks with 512 cycle
[00:00:00.346,069] &amp;lt;inf&amp;gt; littlefs: sizes: rd 16 ; pr 16 ; ca 64 ; la 32
[00:00:00.346,191] &amp;lt;err&amp;gt; littlefs: WEST_TOPDIR/modules/fs/littlefs/lfs.c:1234: Corrupted dir pair at {0x0, 0x1}
[00:00:00.346,221] &amp;lt;wrn&amp;gt; littlefs: can&amp;#39;t mount (LFS -84); formatting
[00:00:00.520,935] &amp;lt;inf&amp;gt; littlefs: /lfs mounted
Mount /lfs: 0
/lfs: bsize = 16 ; frsize = 4096 ; blocks = 58 ; bfree = 56
/lfs opendir: 0
End of files
[00:00:00.571,899] &amp;lt;inf&amp;gt; main: The device is put in USB mass storage mode.
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The difference is that they pick different areas to use for the disk:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:00.346,069] &amp;lt;inf&amp;gt; littlefs: FS at flash-controller@4001e000:0x46000 is 58 0x1000-byte blocks with 512 cycle
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;vs:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:00.000,671] &amp;lt;inf&amp;gt; littlefs: FS at flash-controller@4001e000:0x7a000 is 6 0x1000-byte blocks with 512 cycle
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you have a single-image build, then partition manager is not invoked and the DTS &amp;quot;storage_partition&amp;quot; is used:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;					storage_partition: partition@46000 {
						label = &amp;quot;storage&amp;quot;;
						reg = &amp;lt; 0x46000 0x3a000 &amp;gt;;
						phandle = &amp;lt; 0x17 &amp;gt;;
					};
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If you have a multi-image build (ie. with mcuboot), then partition manager is invoked and pm_static.yml is used:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;littlefs_storage:
  address: 0x7a000
  end_address: 0x80000
  placement:
    align:
      start: 0x1000
    before:
    - end
  region: flash_primary
  size: 0x6000
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot clash with USB Mass Device Littlefs Partition</title><link>https://devzone.nordicsemi.com/thread/414064?ContentTypeID=1</link><pubDate>Wed, 08 Mar 2023 09:59:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d21397d9-ba28-4bca-a5ff-dbf467330ee3</guid><dc:creator>DEng01</dc:creator><description>&lt;p&gt;Hi &lt;span&gt;H&amp;aring;kon,&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you for responding, I have looked at the logs and frustratingly they look similar between working and non-working. I have created a NRF52833DK littlefs example project which demonstrate this issue (littlefs is in internal flash instead of external flash) - if have attached this project with this post. If you comment out CONFIG_BOOTLOADER_MCUBOOT the issue disappears. I will collate the logs in the meantime.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks,&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;David&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/mass_2D00_nrf52833_2D00_mcuboot.zip"&gt;devzone.nordicsemi.com/.../mass_2D00_nrf52833_2D00_mcuboot.zip&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot clash with USB Mass Device Littlefs Partition</title><link>https://devzone.nordicsemi.com/thread/413919?ContentTypeID=1</link><pubDate>Tue, 07 Mar 2023 15:42:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4fd470fd-f78d-4f5f-bde7-ba529b66fde2</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you share the serial log output of a working and a non-working scenario?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It looks like the external_flash area ranges up to 0x80_0000 (8MByte), while the SPI_NOR flash is 32 Mbit. Is there a typo here?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;On a separate note:&lt;/p&gt;
&lt;p&gt;You should select &amp;quot;compatible = &amp;quot;nordic,nrf-spi&lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;m&lt;/strong&gt;&lt;/span&gt;&amp;quot;;&amp;quot; to utilize DMA capabilities of the NRF_SPIM peripheral.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>