<?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>Application fails to boot with MCUboot image in external flash and TF-M</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/128665/application-fails-to-boot-with-mcuboot-image-in-external-flash-and-tf-m</link><description>For my project I want MCUboot with the upgrade image placed in the external flash, and TF-M. I am not able to get this combo to boot however, and I suspect the reason is that MCUboot and non-secure application is fighting over the SPI bus. 
 In this branch</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 18 Jul 2026 14:13:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/128665/application-fails-to-boot-with-mcuboot-image-in-external-flash-and-tf-m" /><item><title>RE: Application fails to boot with MCUboot image in external flash and TF-M</title><link>https://devzone.nordicsemi.com/thread/569230?ContentTypeID=1</link><pubDate>Sat, 18 Jul 2026 14:13:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a83caab3-5928-49db-85f6-b0496d17150d</guid><dc:creator>andvib</dc:creator><description>&lt;p&gt;You were spot on - now it works! I misunderstood how app, tfm_nonsecure and mcuboot_primary ties together, so cleaning them up fixed it.&lt;br /&gt;&lt;br /&gt;Thanks a lot!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application fails to boot with MCUboot image in external flash and TF-M</title><link>https://devzone.nordicsemi.com/thread/569087?ContentTypeID=1</link><pubDate>Tue, 14 Jul 2026 12:56:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:146dee22-b57d-4dc4-820e-c989d1affa41</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Apologies for the wait.&lt;/p&gt;
&lt;p&gt;I think this might show the issue. In your attached pm_static:&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;tfm_nonsecure&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;has&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;span: [app]&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;yet is&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;smaller&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;than&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;app&lt;/code&gt;:&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;0x172000&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;(&lt;code&gt;0x73000&lt;/code&gt;–&lt;code&gt;0x1e5000&lt;/code&gt;) vs&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;0x18a000&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;(&lt;code&gt;0x73000&lt;/code&gt;–&lt;code&gt;0x1fd000&lt;/code&gt;). A span can never be smaller than its member.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;mcuboot_primary&lt;/code&gt;,&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;mcuboot_primary_app&lt;/code&gt;, and&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;tfm_nonsecure&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;all end at&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;0x1e5000&lt;/code&gt;, but&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;app&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;runs to&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;0x1fd000&lt;/code&gt;, i.e.&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;0x18000&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;past the slot and past the image trailer region.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And from the device logs:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;quot;[00:00:00.055,659] &amp;lt;inf&amp;gt; mcuboot: Image index: 0, Swap type: none&amp;quot;&lt;/em&gt; should also indicate that we do not touch the spi at this point (at least w.r.t the external flash), so if theres an SPI contestion it isn&amp;#39;t here&lt;/p&gt;
&lt;p&gt;Could you do&amp;nbsp;a pristine build with&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;and let Partition Manager place everything, relocating only&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;mcuboot_secondary&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;to the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;external_flash&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;region, &lt;em&gt;&lt;strong&gt;i.e do not use a static partition map yet &lt;/strong&gt;&lt;/em&gt;to see if partition manager sets things up properly, and then after create the static file based on the generated partition map (You can find it here&amp;nbsp;&lt;code&gt;&lt;span&gt;build/&lt;/span&gt;&lt;span&gt;partitions.yml&lt;/span&gt;&lt;/code&gt;) and move only&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;mcuboot_secondary&lt;/code&gt;, leaving&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;app&lt;/code&gt;,&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;tfm_nonsecure&lt;/code&gt;, and the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;mcuboot_primary*&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;entries as PM produced them.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;After regenerating, the map must satisfy:&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;app&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;==&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;tfm_nonsecure&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;(same address and size),&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;app&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;nested inside&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;mcuboot_primary_app&lt;/code&gt;,&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;mcuboot_primary_app&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;starting at&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;0x29000&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;(after the pad), and&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;app&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;ending at&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;0x1e5000&lt;/code&gt;. The extra&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;0x18000&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;at&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;0x1e5000&lt;/code&gt;–&lt;code&gt;0x1fd000&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;should be free or a separate storage partition, not part of&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;app&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The fact that MCUboot boots suggests that here suggests that&amp;nbsp;&lt;code&gt;CONFIG_BOOT_MAX_IMG_SECTORS&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt; is adequate for reading the primary, but you could also increase&amp;nbsp;&lt;code&gt;CONFIG_BOOT_MAX_IMG_SECTORS&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;for the external-flash erase-block size. Default might be a little to small for this configuration.&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application fails to boot with MCUboot image in external flash and TF-M</title><link>https://devzone.nordicsemi.com/thread/568991?ContentTypeID=1</link><pubDate>Fri, 10 Jul 2026 07:51:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ecae7e47-6845-407a-9fa5-5282390c54fe</guid><dc:creator>andvib</dc:creator><description>&lt;p&gt;Getting the partitions right for TF-M is difficult, so I&amp;#39;m also open to this being the issue. This is the compiled parititons.yml, or you can see the &lt;a href="https://github.com/andvib/zephyr/blob/tfm-ext-flash-failing/samples/hello_world/pm_static_nrf54lm20dk_nrf54lm20a_cpuapp_ns.yml"&gt;pm_static in my fork&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;app:
  address: 0x73000
  end_address: 0x1fd000
  region: flash_primary
  size: 0x18a000
bootconf:
  address: 0xffd080
  end_address: 0xffd084
  region: bootconf
  size: 0x4
external_flash:
  address: 0x0
  end_address: 0x800000
  region: external_flash
  size: 0x800000
mcuboot:
  address: 0x0
  end_address: 0x28000
  placement:
    before:
    - mcuboot_primary
  region: flash_primary
  size: 0x28000
mcuboot_pad:
  address: 0x28000
  end_address: 0x29000
  placement:
    before:
    - app
  region: flash_primary
  size: 0x1000
mcuboot_primary:
  address: 0x28000
  end_address: 0x1e5000
  region: flash_primary
  size: 0x1bd000
  span:
  - mcuboot_pad
  - app
mcuboot_primary_app:
  address: 0x28000
  end_address: 0x1e5000
  region: flash_primary
  size: 0x1bd000
  span:
  - mcuboot_pad
  - app
mcuboot_secondary:
  address: 0x0
  end_address: 0x1bc000
  placement:
    align:
      start: 0x1000
  region: external_flash
  size: 0x1bc000
mcuboot_sram:
  address: 0x20000000
  end_address: 0x20010000
  orig_span: &amp;amp;id001
  - tfm_sram
  region: sram_primary
  size: 0x10000
  span: *id001
otp:
  address: 0xffd500
  end_address: 0xffd980
  region: otp
  size: 0x480
sram_nonsecure:
  address: 0x20010000
  end_address: 0x2007fe40
  orig_span: &amp;amp;id002
  - sram_primary
  region: sram_primary
  size: 0x6fe40
  span: *id002
sram_primary:
  address: 0x20010000
  end_address: 0x2007fe40
  region: sram_primary
  size: 0x6fe40
sram_secure:
  address: 0x20000000
  end_address: 0x20010000
  orig_span: &amp;amp;id003
  - tfm_sram
  region: sram_primary
  size: 0x10000
  span: *id003
tfm:
  address: 0x29000
  end_address: 0x68800
  placement:
    before:
    - app
  region: flash_primary
  size: 0x3f800
tfm_its:
  address: 0x68800
  end_address: 0x6c800
  inside:
  - tfm_storage
  placement:
    before:
    - tfm_otp_nv_counters
  region: flash_primary
  size: 0x4000
tfm_nonsecure:
  address: 0x73000
  end_address: 0x1e5000
  orig_span: &amp;amp;id004
  - app
  region: flash_primary
  size: 0x172000
  span: *id004
tfm_otp_nv_counters:
  address: 0x6c800
  end_address: 0x6e800
  inside:
  - tfm_storage
  placement:
    before:
    - tfm_ps
  region: flash_primary
  size: 0x2000
tfm_ps:
  address: 0x6e800
  end_address: 0x73000
  inside:
  - tfm_storage
  placement:
    after:
    - tfm_secure
  region: flash_primary
  size: 0x4800
tfm_secure:
  address: 0x29000
  end_address: 0x68800
  orig_span: &amp;amp;id005
  - tfm
  region: flash_primary
  size: 0x3f800
  span: *id005
tfm_sram:
  address: 0x20000000
  end_address: 0x20010000
  inside:
  - sram_secure
  placement:
    after:
    - start
  region: sram_primary
  size: 0x10000
tfm_storage:
  address: 0x68800
  end_address: 0x73000
  orig_span: &amp;amp;id006
  - tfm_ps
  - tfm_its
  - tfm_otp_nv_counters
  region: flash_primary
  size: 0xa800
  span: *id006
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This is the runtime logs I get from MCUboot:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting Zephyr OS build ncs-v3.3.0-2-gda4454231faa ***
*** Booting My Application v2.3.0-dev-fce4dac2e629 ***
*** Using nRF Connect SDK v3.3.0-a7f2e9d655e2 ***
*** Using Zephyr OS v4.3.99-da4454231faa ***
[00:00:00.024,078] &amp;lt;inf&amp;gt; mcuboot: Starting bootloader
[00:00:00.030,154] &amp;lt;inf&amp;gt; mcuboot: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[00:00:00.040,139] &amp;lt;inf&amp;gt; mcuboot: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[00:00:00.050,121] &amp;lt;inf&amp;gt; mcuboot: Boot source: none
[00:00:00.055,659] &amp;lt;inf&amp;gt; mcuboot: Image index: 0, Swap type: none
[00:00:00.154,197] &amp;lt;inf&amp;gt; mcuboot: Bootloader chainload address offset: 0x28000
[00:00:00.161,754] &amp;lt;inf&amp;gt; mcuboot: Image version: v0.0.0
[00:00:00.167,384] &amp;lt;inf&amp;gt; mcuboot: Jumping to the first image slot&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This is the runtime logs from TF-M (which do look a bit cut off):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Pins have been configured as secure.
GPIO port: 0x00000000
Pin: 0x00000000
Pin: 0x00000001
Booting TF-M v2.2.2**
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I get no output from the application, even when I&amp;#39;ve tried to disable the UART for MCUboot and TF-M to make sure they don&amp;#39;t fight over the peripheral. I also added &lt;a href="https://github.com/andvib/zephyr/blob/tfm-ext-flash-failing/samples/hello_world/src/main.c"&gt;blinky code to Hello World&lt;/a&gt; to have a visual confirmation other than UART logs, and the LED is not blinking which supports the app never booting.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Application fails to boot with MCUboot image in external flash and TF-M</title><link>https://devzone.nordicsemi.com/thread/568964?ContentTypeID=1</link><pubDate>Thu, 09 Jul 2026 14:08:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37818afa-5cbf-4336-b512-508132193dae</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hello!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you share the runtime logs and/or any error messages that you run into when trying?&lt;/p&gt;
&lt;p&gt;Could you share your memory map (generated partitions,yml in your build folder is fine)?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m more leaning towards the option of there being a non-correct partitioning w.r.t tf-m partitions rather than a conflict of spi resources, but I&amp;#39;m not excluding that this could be the case&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>