<?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>Issue with using SPI flash for holding second boot slot</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/114700/issue-with-using-spi-flash-for-holding-second-boot-slot</link><description>Hi all, 
 I have an issue with putting my second boot slot on an external SPI flash. There are more people on the Q&amp;amp;A with issues in this realm, but none that I found were both similar enough and about a somewhat recent NCS release. 
 Zephyr &amp;amp; MCUboot</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 13 Sep 2024 13:17:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/114700/issue-with-using-spi-flash-for-holding-second-boot-slot" /><item><title>RE: Issue with using SPI flash for holding second boot slot</title><link>https://devzone.nordicsemi.com/thread/502490?ContentTypeID=1</link><pubDate>Fri, 13 Sep 2024 13:17:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1722c81e-feaf-45d8-82ac-9f94cc728a20</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Maarten,&lt;/p&gt;
&lt;p&gt;Thanks for the detailed investigation.&amp;nbsp;&lt;br /&gt;I think you found the right culprit. I haven&amp;#39;t looked deep into this but from what I can see in the doc:&amp;nbsp;&lt;br /&gt;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/scripts/partition_manager/partition_manager.html"&gt;https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/scripts/partition_manager/partition_manager.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1726233382310v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;If it&amp;#39;s not QSPI NOR then you will have to use&amp;nbsp;&lt;span&gt;CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y. In your case you are using SPI so need to override the PM driver ?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with using SPI flash for holding second boot slot</title><link>https://devzone.nordicsemi.com/thread/502373?ContentTypeID=1</link><pubDate>Thu, 12 Sep 2024 19:31:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17df15cb-7c53-49da-97c3-d7dbb4c31c07</guid><dc:creator>Maarten &amp;amp;quot;merethan&amp;amp;quot;</dc:creator><description>&lt;p&gt;Yep, boots. So I&amp;#39;d say this is a bug, that one can work around with CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y.&lt;/p&gt;
&lt;p&gt;Make sure it is set to &amp;#39;y&amp;#39; for both the application code and mcuboot. This is harder than it should be with sysbuild in between you and both these builds. Double-check it before testing.&lt;/p&gt;
&lt;p&gt;There&amp;#39;s further investigation pending on why a partition on an external but very standard JEDEC flash is somehow considered a partition without suitable driver available (really CONFIG_SPI_FLASH is all you need, and I had it enabled all this time for both appcode &amp;amp; mcuboot) but one can work around it by setting the before mentioned PM_OVERRIDE_EXTERNAL_DRIVER_CHECK.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solved, I guess?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;On to the next thing that blows up. But this crime scene is solved, for now at least. As for the exact motives of the perpetrator, some further investigation is needed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with using SPI flash for holding second boot slot</title><link>https://devzone.nordicsemi.com/thread/502371?ContentTypeID=1</link><pubDate>Thu, 12 Sep 2024 19:13:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72d9e1ab-f78b-4bf4-8132-27a1d30d706a</guid><dc:creator>Maarten &amp;amp;quot;merethan&amp;amp;quot;</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/* The full list of partitions will be here cut down to partitions that
 * are defined over devices with drivers enabled in Kconfig.
 */&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Uhoh.. Would this be really it..? Something going sideways there?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;const struct flash_area default_flash_map[] = {
	FLASH_MAP_PM_LIST
};

const int flash_map_entries = ARRAY_SIZE(default_flash_map);
const struct flash_area *flash_map = default_flash_map;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Above snippet is from flash_map_partition_manager.c&lt;/p&gt;
&lt;p&gt;I need go look into what CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK does. And possibly if there is a driver-thing for realsies broken, fix that. I do have CONFIG_SPI_NOR though, which should be all one needs for NOR flash adhering to JEDEC standards. So there likely ain&amp;#39;t much of an external driver to fix. And I already verified I can read &amp;amp; write the flash from the serial shell.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Debugging software: A crime scene game where you are the victim, the perpetrator, the detective and the witness all yourself, in one person.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with using SPI flash for holding second boot slot</title><link>https://devzone.nordicsemi.com/thread/502369?ContentTypeID=1</link><pubDate>Thu, 12 Sep 2024 18:57:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0c5054b-7581-448f-a52b-77fd91caa163</guid><dc:creator>Maarten &amp;amp;quot;merethan&amp;amp;quot;</dc:creator><description>&lt;p&gt;Few notes:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static inline uint32_t __flash_area_ids_for_slot(int img, int slot)
{
    static const int all_slots[] = {
        FOR_EACH_NONEMPTY_TERM(FIXED_PARTITION_ID, (,), ALL_AVAILABLE_SLOTS)
    };
    return all_slots[img * 2 + slot];
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Snippet from sysflash.h&lt;/p&gt;
&lt;p&gt;Function flash_area_id_from_multi_image_slot() which through some macro-indirection uses __flash_area_ids_for_slot() which uses some more macro-indirection creates a list &amp;amp; searches the partitions in the device tree. The partitions I have in the device tree are placeholders, as everything is to be overwritten by the partition manager (which parses pm-static.yml) somehow. How this mechanism is to work I not understood yet. So if this DT partition list is overwritten by the PM partition list by the time everything gets linked together, I not know.&lt;/p&gt;
&lt;p&gt;It may be a clue though, if one does DT and the other does PM, for one reason or another.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>