<?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>Partition conflict when enabling littlefs in both mcuboot and app simultaneously?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/112243/partition-conflict-when-enabling-littlefs-in-both-mcuboot-and-app-simultaneously</link><description>I successfully enabled littlefs in mcuboot and read/write it successfully (due to project requirements), and then tried to enable littlefs in both mcuboot and app, operating on the same lfs partition. However, I received an error message during the build</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 10 Jul 2024 01:34:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/112243/partition-conflict-when-enabling-littlefs-in-both-mcuboot-and-app-simultaneously" /><item><title>RE: Partition conflict when enabling littlefs in both mcuboot and app simultaneously?</title><link>https://devzone.nordicsemi.com/thread/493057?ContentTypeID=1</link><pubDate>Wed, 10 Jul 2024 01:34:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36eca4e1-8210-461e-9edf-654e30830206</guid><dc:creator>llly</dc:creator><description>&lt;p&gt;Hi Hieu&lt;/p&gt;
&lt;p&gt;Thank you for your answers and suggestions. I will carefully discuss the security risks of using LFS in mcuboot with my colleagues.&lt;/p&gt;
&lt;p&gt;This ticket should be able to be closed now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Partition conflict when enabling littlefs in both mcuboot and app simultaneously?</title><link>https://devzone.nordicsemi.com/thread/493034?ContentTypeID=1</link><pubDate>Tue, 09 Jul 2024 18:14:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1709e73-9da9-4e8f-a1b7-717f802fff6d</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Yes, SPU is System Protection Unit. It&amp;nbsp;works in chunks of the configured size, so partitions on flash memory have to be &lt;em&gt;aligned&lt;/em&gt; with&amp;nbsp;the SPU Region Size. For example, the default SPU Region Size is 0x8000. Having the littlefs_storage partition aligned means having it start at 0x00000000, 0x00008000, 0x00800000, 0x00808000&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And littlefs_storage is aligned with the SPU region size to protect it from unauthorized write operations, yes.&lt;/p&gt;
&lt;p&gt;I confirmed the workaround with a few colleagues. As you are already using TF-M, and littlefs_storage has to be aligned anyway, so&amp;nbsp;making the change doesn&amp;#39;t affect your project at all.&lt;/p&gt;
&lt;p&gt;However, it is a change in the SDK and outside of your project, so you need to keep this in mind when collaborating on the project or starting a new project with the same SDK.&lt;br /&gt;For this scenario, it&amp;#39;s recommended to use a workspace project. This is explained&amp;nbsp;here: &lt;a href="https://docs.nordicsemi.com/bundle/ncs-2.7.0/page/nrf/dev_model_and_contributions/adding_code.html#workflow_4_workspace_application_repository_recommended"&gt;Workflow 4: Workspace application repository (recommended)&lt;/a&gt;&lt;span&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Finally, my colleagues also raise concerns about both the bootloader and the application having access to the same LittleFS partition.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt;Bootloaders are immutable for the lifetime of a product and it&amp;#39;s imperative that they do not have security vulnerabilities or a large attack surface because if you compromise a bootloader, you compromise. Adding LittleFS read/write&amp;nbsp;both adds a vulnerability and increases the attack surface.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;We highly recommend that the bootloader stay minimally simple. Giving both the application and the bootloader access to the same file system is especially recommended against.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Partition conflict when enabling littlefs in both mcuboot and app simultaneously?</title><link>https://devzone.nordicsemi.com/thread/492842?ContentTypeID=1</link><pubDate>Tue, 09 Jul 2024 01:55:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05b458c9-b539-4081-9221-3b0addcf11dc</guid><dc:creator>llly</dc:creator><description>&lt;p&gt;I saw the spu in the device tree, referring to the system protection unit, right?&lt;/p&gt;
&lt;p&gt;Is aligning littlefs_storage with the SPU area to protect the lfs partition?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Partition conflict when enabling littlefs in both mcuboot and app simultaneously?</title><link>https://devzone.nordicsemi.com/thread/492837?ContentTypeID=1</link><pubDate>Tue, 09 Jul 2024 01:35:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1de98dc-0770-4497-ab96-855c0786c035</guid><dc:creator>llly</dc:creator><description>&lt;p&gt;Hi Hieu&lt;/p&gt;
&lt;p&gt;Thank you for your research,this is indeed useful and looks better than commenting out the check code in partition_manager.py.&lt;/p&gt;
&lt;p&gt;But what does this spu mean? The current practice is due to the lack of reserved partitions for tfm in mcuboot, resulting in partition mismatch. Therefore, the check on CONFIG-BUILD-With-TFM was commented out, so that it always reserved partitions for tfm and passed the partition check in mcuboot, right?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Partition conflict when enabling littlefs in both mcuboot and app simultaneously?</title><link>https://devzone.nordicsemi.com/thread/492824?ContentTypeID=1</link><pubDate>Mon, 08 Jul 2024 19:33:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6636d688-2a2b-48a6-83cb-56d0f310fa21</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi llly,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have some good news. I was able to pinpoint what the problem is and can think of a workaround. The bad news is that I am&amp;nbsp;only ~85% sure that my workaround is safe.&lt;/p&gt;
&lt;p&gt;The issue is in this section:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v2.6.1/subsys/partition_manager/pm.yml.file_system#L9-L11"&gt;https://github.com/nrfconnect/sdk-nrf/blob/v2.6.1/subsys/partition_manager/pm.yml.file_system#L9-L11&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#include &amp;lt;autoconf.h&amp;gt;

littlefs_storage:
  placement:
    before: [tfm_storage, end]
#ifdef CONFIG_PM_PARTITION_REGION_LITTLEFS_EXTERNAL
  region: external_flash
#else

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
#ifdef CONFIG_BUILD_WITH_TFM
    align: {start: CONFIG_NRF_SPU_FLASH_REGION_SIZE}
#endif
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  inside: [nonsecure_storage]
#endif
  size: CONFIG_PM_PARTITION_SIZE_LITTLEFS&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;CONFIG_BUILD_WITH_TFM&amp;nbsp;is only set for the application, not MCUboot.&amp;nbsp;As you have LittleFS on both, this file is run twice, but with two different requirements for the littlefs_storage partition.&lt;/p&gt;
&lt;p&gt;My proposed workaround is to remove the #ifdef and #endif condition and make the littlefs_storage always align with SPU region size.&lt;/p&gt;
&lt;p&gt;As mentioned, I am fairly sure there is no issue with this, but I prefer to run this through&amp;nbsp;someone who&amp;nbsp;has a better overview of the partitioning.&lt;/p&gt;
&lt;p&gt;I will&amp;nbsp;keep you updated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Partition conflict when enabling littlefs in both mcuboot and app simultaneously?</title><link>https://devzone.nordicsemi.com/thread/491710?ContentTypeID=1</link><pubDate>Tue, 02 Jul 2024 01:05:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:afe43c14-ccc3-47ac-900c-352c8715a67b</guid><dc:creator>llly</dc:creator><description>&lt;p&gt;It&amp;#39;s okay. Thank you for your help&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Partition conflict when enabling littlefs in both mcuboot and app simultaneously?</title><link>https://devzone.nordicsemi.com/thread/491675?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2024 18:53:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46157c57-9fd3-4146-8326-9276786e7dea</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Sorry I wasn&amp;#39;t able to figure this out last week. I will continue&amp;nbsp;this week and keep you updated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Partition conflict when enabling littlefs in both mcuboot and app simultaneously?</title><link>https://devzone.nordicsemi.com/thread/490131?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2024 01:16:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b187445d-618d-44d8-971e-e62cd04e624b</guid><dc:creator>llly</dc:creator><description>&lt;p&gt;Look forward to your reply&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Partition conflict when enabling littlefs in both mcuboot and app simultaneously?</title><link>https://devzone.nordicsemi.com/thread/489956?ContentTypeID=1</link><pubDate>Fri, 21 Jun 2024 11:52:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f38cf397-b453-43ae-8865-9ddb4e275db9</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;There should be better solutions than commenting out a check. I will investigate this and come back to you next week.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Partition conflict when enabling littlefs in both mcuboot and app simultaneously?</title><link>https://devzone.nordicsemi.com/thread/489829?ContentTypeID=1</link><pubDate>Fri, 21 Jun 2024 01:19:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3aabf619-10cc-4dab-b6dd-3388838fcfd2</guid><dc:creator>llly</dc:creator><description>&lt;p&gt;Hi Hieu&lt;/p&gt;
&lt;p&gt;This is where I made the changes in partition_manager.py.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/8802.png" /&gt;&lt;/p&gt;
&lt;p&gt;I simply commented out the code that prompted the error message, and then it can be built normally. Currently, there seems to be no problem, but I think there will be a better solution?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Partition conflict when enabling littlefs in both mcuboot and app simultaneously?</title><link>https://devzone.nordicsemi.com/thread/489822?ContentTypeID=1</link><pubDate>Thu, 20 Jun 2024 20:29:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fcb6bf31-e838-4719-bc01-4749e0a8f927</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi llly,&lt;/p&gt;
&lt;p&gt;Nothing stands out to me from the YAML file.&lt;/p&gt;
&lt;p&gt;Could you please share the spot in partition_manager.py where the issue happened?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Partition conflict when enabling littlefs in both mcuboot and app simultaneously?</title><link>https://devzone.nordicsemi.com/thread/489611?ContentTypeID=1</link><pubDate>Thu, 20 Jun 2024 01:34:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a193c181-20d6-4912-80a4-fed0866d6e8b</guid><dc:creator>llly</dc:creator><description>&lt;p&gt;Hi Hieu&lt;br /&gt;This is a dynamic partition table that I built when only enabling LFS in mcuboot or app (my project requires a single slot, so there is no mcuboot secondary partition, and I initially thought that the insufficient size of the mcuboot partition affected the activation of LFS, so I set it to 100k)&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;EMPTY_0:
  address: 0x19000
  end_address: 0x20000
  placement:
    before:
    - mcuboot_pad
  region: flash_primary
  size: 0x7000
app:
  address: 0x28000
  end_address: 0x80000
  region: flash_primary
  size: 0x58000
littlefs_storage:
  address: 0x80000
  end_address: 0x100000
  inside:
  - nonsecure_storage
  placement:
    align:
      start: 0x8000
    before:
    - end
  region: flash_primary
  size: 0x80000
mcuboot:
  address: 0x0
  end_address: 0x19000
  placement:
    before:
    - mcuboot_primary
  region: flash_primary
  size: 0x19000
mcuboot_pad:
  address: 0x20000
  end_address: 0x20200
  placement:
    align:
      start: 0x8000
    before:
    - mcuboot_primary_app
  region: flash_primary
  size: 0x200
mcuboot_primary:
  address: 0x20000
  end_address: 0x80000
  orig_span: &amp;amp;id001
  - tfm
  - app
  - mcuboot_pad
  region: flash_primary
  size: 0x60000
  span: *id001
mcuboot_primary_app:
  address: 0x20200
  end_address: 0x80000
  orig_span: &amp;amp;id002
  - app
  - tfm
  region: flash_primary
  size: 0x5fe00
  span: *id002
mcuboot_sram:
  address: 0x20000000
  end_address: 0x20008000
  orig_span: &amp;amp;id003
  - tfm_sram
  region: sram_primary
  size: 0x8000
  span: *id003
nonsecure_storage:
  address: 0x80000
  end_address: 0x100000
  orig_span: &amp;amp;id004
  - littlefs_storage
  region: flash_primary
  size: 0x80000
  span: *id004
nrf_modem_lib_ctrl:
  address: 0x20008000
  end_address: 0x200084e8
  inside:
  - sram_nonsecure
  placement:
    after:
    - tfm_sram
    - start
  region: sram_primary
  size: 0x4e8
nrf_modem_lib_rx:
  address: 0x2000a568
  end_address: 0x2000c568
  inside:
  - sram_nonsecure
  placement:
    after:
    - nrf_modem_lib_tx
  region: sram_primary
  size: 0x2000
nrf_modem_lib_sram:
  address: 0x20008000
  end_address: 0x2000c568
  orig_span: &amp;amp;id005
  - nrf_modem_lib_ctrl
  - nrf_modem_lib_tx
  - nrf_modem_lib_rx
  region: sram_primary
  size: 0x4568
  span: *id005
nrf_modem_lib_tx:
  address: 0x200084e8
  end_address: 0x2000a568
  inside:
  - sram_nonsecure
  placement:
    after:
    - nrf_modem_lib_ctrl
  region: sram_primary
  size: 0x2080
otp:
  address: 0xff8108
  end_address: 0xff83fc
  region: otp
  size: 0x2f4
sram_nonsecure:
  address: 0x20008000
  end_address: 0x20040000
  orig_span: &amp;amp;id006
  - sram_primary
  - nrf_modem_lib_ctrl
  - nrf_modem_lib_tx
  - nrf_modem_lib_rx
  region: sram_primary
  size: 0x38000
  span: *id006
sram_primary:
  address: 0x2000c568
  end_address: 0x20040000
  region: sram_primary
  size: 0x33a98
sram_secure:
  address: 0x20000000
  end_address: 0x20008000
  orig_span: &amp;amp;id007
  - tfm_sram
  region: sram_primary
  size: 0x8000
  span: *id007
tfm:
  address: 0x20200
  end_address: 0x28000
  inside:
  - mcuboot_primary_app
  placement:
    before:
    - app
  region: flash_primary
  size: 0x7e00
tfm_nonsecure:
  address: 0x28000
  end_address: 0x80000
  orig_span: &amp;amp;id008
  - app
  region: flash_primary
  size: 0x58000
  span: *id008
tfm_secure:
  address: 0x20000
  end_address: 0x28000
  orig_span: &amp;amp;id009
  - mcuboot_pad
  - tfm
  region: flash_primary
  size: 0x8000
  span: *id009
tfm_sram:
  address: 0x20000000
  end_address: 0x20008000
  inside:
  - sram_secure
  placement:
    after:
    - start
  region: sram_primary
  size: 0x8000
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then I copied this dynamic partition table into a static partition table and enabled LFS in both mcuboot and app, and the above error occurred.&lt;/p&gt;
&lt;p&gt;I have temporarily solved this problem, but I don&amp;#39;t think it&amp;#39;s the right way.&lt;/p&gt;
&lt;p&gt;I opened the file ncs\v2.6.1\nrf\scripts\partition_manager.py, found the error line, and commented out this part of the code. The build can be completed, and the code is currently running normally. But I don&amp;#39;t know if there&amp;#39;s any hidden danger in this.&lt;/p&gt;
&lt;p&gt;If you need any other detailed information, please let me know. I am not sure what can help you analyze this issue&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Partition conflict when enabling littlefs in both mcuboot and app simultaneously?</title><link>https://devzone.nordicsemi.com/thread/489482?ContentTypeID=1</link><pubDate>Wed, 19 Jun 2024 11:14:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:868d1ba7-762a-4dc1-90cf-19eb3d0dc842</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi llly,&lt;/p&gt;
&lt;p&gt;Could you please share more details about&amp;nbsp;your setup, and also the static configuration attempt?&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;
&lt;p&gt;Update**: There is an important warning I would like to add to this first reply:&lt;/p&gt;
[quote user="vthieu"]&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt;Bootloaders are immutable for the lifetime of a product and it&amp;#39;s imperative that they do not have security vulnerabilities or a large attack surface because if you compromise a bootloader, you compromise. Adding LittleFS read/write&amp;nbsp;both adds a vulnerability and increases the attack surface.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;We highly recommend that the bootloader stay minimally simple. Giving both the application and the bootloader access to the same file system is especially recommended against.&lt;/span&gt;&lt;/p&gt;[/quote]&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>