<?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>Increase size of custom SPM partition</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/76883/increase-size-of-custom-spm-partition</link><description>Hello, 
 I am using NCS v1.5.0 and my application runs in non-secure mode, and uses a custom SPM. Initially all build and ran correctly, and the SPM fit in a 32 KB partition. Then I added some secure services and the SPM image size increased and I got</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 01 Jul 2021 13:15:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/76883/increase-size-of-custom-spm-partition" /><item><title>RE: Increase size of custom SPM partition</title><link>https://devzone.nordicsemi.com/thread/318242?ContentTypeID=1</link><pubDate>Thu, 01 Jul 2021 13:15:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3411e68-a33c-492d-88db-d004897c944b</guid><dc:creator>NelsonGoncalves</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks, for now nothing else.&lt;/p&gt;
&lt;p&gt;I am sorry to have taken you on a wild goose chase. I was convinced the problem was with config or partition changes.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increase size of custom SPM partition</title><link>https://devzone.nordicsemi.com/thread/318160?ContentTypeID=1</link><pubDate>Thu, 01 Jul 2021 11:23:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7a52040-285f-4303-9752-aebd422872d4</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;That&amp;#39;s great to hear. Is there anything else I can do for you at this time?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increase size of custom SPM partition</title><link>https://devzone.nordicsemi.com/thread/318134?ContentTypeID=1</link><pubDate>Thu, 01 Jul 2021 09:40:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8a12f07-a39f-4d02-9508-95d9c33e4d6e</guid><dc:creator>NelsonGoncalves</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I found out the reason behind this weird behavior. It is not the size of the SPM partition, but instead the use of the Zephyr SPI flash driver. It makes use of an interrupt that I had reserved (but was not using) for a serial port. When SPI events occured, the wrong ISR handler was called and it for some reason, caused the application to get stuck in the idle task.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Initially I was convinced it was the configuration changes or the SPM partition size, because I first tested the SPI specific code on one of the Zephyr samples and it worked. So I did not suspect issues comming from there.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increase size of custom SPM partition</title><link>https://devzone.nordicsemi.com/thread/318015?ContentTypeID=1</link><pubDate>Wed, 30 Jun 2021 14:02:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a6983ba-4466-4fb6-8dd3-94d1b75470be</guid><dc:creator>NelsonGoncalves</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Here are the files:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/spm_5F00_zephyr_5F00_linker.zip"&gt;devzone.nordicsemi.com/.../spm_5F00_zephyr_5F00_linker.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/build_5F00_zephyr_5F00_linker.zip"&gt;devzone.nordicsemi.com/.../build_5F00_zephyr_5F00_linker.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I did not find anything wrong with the linker placements. I believe the issue is related to these configuration options:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_SPI=y
CONFIG_SPI_NOR=y
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_JESD216_API=y
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I can reproduce the issue when these options are enabled. And for reference, this is the device tree SPI external flash&amp;nbsp;definition:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;spi3 {
	status = &amp;quot;okay&amp;quot;;
	compatible = &amp;quot;nordic,nrf-spim&amp;quot;;
	sck-pin = &amp;lt;13&amp;gt;;
	mosi-pin = &amp;lt;11&amp;gt;;
	miso-pin = &amp;lt;12&amp;gt;;
	cs-gpios = &amp;lt;&amp;amp;gpio0 25 GPIO_ACTIVE_LOW&amp;gt;;
	mx25r64: mx25r6435f@0 {
		compatible = &amp;quot;jedec,spi-nor&amp;quot;;
		reg = &amp;lt;0&amp;gt;;
		spi-max-frequency = &amp;lt;8000000&amp;gt;;
		jedec-id = [c2 20 15];
		label = &amp;quot;MX25R6435F&amp;quot;;
		size = &amp;lt;67108864&amp;gt;;
	};	
};
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increase size of custom SPM partition</title><link>https://devzone.nordicsemi.com/thread/317993?ContentTypeID=1</link><pubDate>Wed, 30 Jun 2021 13:14:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:429a4e0b-ec8a-49ad-ac5b-22db6d27b35d</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Hi, my original comment was incorrect, I meant to check in&amp;nbsp;&lt;span&gt;&amp;lt;build_folder&amp;gt;/spm/zephyr/.config. I have edited it now to reflect this.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Can you find linker.cmd located both in &amp;lt;build&amp;gt;/zephyr/ and &amp;lt;build&amp;gt;/spm/zephyr and attach them?&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;I want to see if there is any overlap in the memory regions, which would explain why it&amp;#39;s getting stuck at startup.&amp;nbsp;&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: Increase size of custom SPM partition</title><link>https://devzone.nordicsemi.com/thread/317979?ContentTypeID=1</link><pubDate>Wed, 30 Jun 2021 12:47:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:771a156d-cc9c-41ec-aeef-ce96b4e5514f</guid><dc:creator>NelsonGoncalves</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t think this strange behavior (application stuck in the Zephyr idle task) has anything to do with the SPM partition.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I checked out my last working version, and increased the size of the SPM partition to 64 KB. The application built and launched correctly.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Other than the size of the SPM partition, the difference is that I am now using the Zephyr SPI flash driver. Could the issue be wrong a wrong configuration ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increase size of custom SPM partition</title><link>https://devzone.nordicsemi.com/thread/317757?ContentTypeID=1</link><pubDate>Tue, 29 Jun 2021 14:14:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a44ffbef-3a9c-4bea-9728-23558cf7f973</guid><dc:creator>NelsonGoncalves</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I aded&amp;nbsp;CONFIG_INIT_ARCH_HW_AT_BOOT=y as well to the application prj.conf, and now it is defined in the &amp;lt;build&amp;gt;/zephyr/.config file.&lt;/p&gt;
&lt;p&gt;However the behaviour is the same, at startup it gets stuck at the Zephyr idle loop.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increase size of custom SPM partition</title><link>https://devzone.nordicsemi.com/thread/317631?ContentTypeID=1</link><pubDate>Tue, 29 Jun 2021 08:37:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0dd23186-c769-4885-83e8-a97174b7f8d8</guid><dc:creator>NelsonGoncalves</dc:creator><description>&lt;p&gt;Hello Heidi,&lt;/p&gt;
&lt;p&gt;[EDIT 30/06/2021] &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/CONFIG_INIT_ARCH_HW_AT_BOOT.html"&gt;CONFIG_INIT_ARCH_HW_AT_BOOT&lt;/a&gt;&lt;span&gt;&amp;nbsp;is enabled in &amp;lt;build_folder&amp;gt;/spm/zephyr/.config. I initially said it as not, but was I looking in (the wrong place)&amp;nbsp; &amp;lt;build&amp;gt;/zephyr/.config.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;This is the ouptut of&amp;nbsp;&lt;em&gt;ninja partition_manager_report&amp;nbsp;&lt;/em&gt;when the build succeeds (that is&amp;nbsp;&lt;span&gt;CONFIG_PM_PARTITION_SIZE_SPM=0x10000)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;c:\workspace\repos\DNG\build&amp;gt;ninja partition_manager_report
[0/10] Performing build step for &amp;#39;spm_subimage&amp;#39;
ninja: no work to do.
[2/2] cmd.exe /C &amp;quot;cd /D C:\workspace\repos\DNG\build\modules\nrf &amp;amp;&amp;amp; C:\Nordic\v1.5.0\toolchain\opt\bin\python.exe C:/Nordic/v1.5.0/zephyr/../nrf/scripts/partition_manager_report.py --input C:/workspace/repos/DNG/build/partitions.yml&amp;quot;
  external_flash (0x800000 - 8192kB):
+----------------------------------------------+
| 0x180000: external_flash (0x800000 - 8192kB) |
+----------------------------------------------+

  flash_primary (0x100000 - 1024kB):
+--------------------------------+
| 0x0: spm (0x10000 - 64kB)      |
| 0x10000: app (0xf0000 - 960kB) |
+--------------------------------+

  otp (0x2f4 - 756B):
+------------------------------+
| 0xff8108: otp (0x2f4 - 756B) |
+------------------------------+

  sram_primary (0x40000 - 256kB):
+--------------------------------------------------+
+---0x20000000: sram_secure (0x10000 - 64kB)-------+
| 0x20000000: spm_sram (0x10000 - 64kB)            |
+---0x20010000: sram_nonsecure (0x30000 - 192kB)---+
+---0x20010000: nrf_modem_lib_sram (0x44e8 - 17kB)-+
| 0x20010000: nrf_modem_lib_ctrl (0x4e8 - 1kB)     |
| 0x200104e8: nrf_modem_lib_tx (0x2000 - 8kB)      |
| 0x200124e8: nrf_modem_lib_rx (0x2000 - 8kB)      |
+--------------------------------------------------+
| 0x200144e8: sram_primary (0x2bb18 - 174kB)       |
+--------------------------------------------------+
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increase size of custom SPM partition</title><link>https://devzone.nordicsemi.com/thread/317620?ContentTypeID=1</link><pubDate>Tue, 29 Jun 2021 08:14:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d4e0f6d8-6522-41f6-8624-74a4728bd1e9</guid><dc:creator>NelsonGoncalves</dc:creator><description>&lt;p&gt;I found out why it fails when using a decimal value in&amp;nbsp;&lt;span&gt;CONFIG_PM_PARTITION_SIZE_SPM=65536.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Looking in the application build directory, in file pm.config I found:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;PM_SPM_ADDRESS=0x0
PM_SPM_END_ADDRESS=0x65536
PM_SPM_SIZE=0x65536
PM_SPM_NAME=spm&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The value of&amp;nbsp;CONFIG_PM_PARTITION_SIZE_SPM is implicitely assumed to be in hexadecimal. So when I mean 65536 bytes,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;the build system assumed 0x65536 bytes ( = 415030 bytes). Because my application is ~500 KB, the whole thing did not fit in the SoC internal flash.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;After changing the configuration to use an hexadecimal value, CONFIG_PM_PARTITION_SIZE_SPM=0x10000, the build completes successfully but still it does not run correctly.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increase size of custom SPM partition</title><link>https://devzone.nordicsemi.com/thread/317618?ContentTypeID=1</link><pubDate>Tue, 29 Jun 2021 08:11:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f650d19d-eed0-4118-ac6b-cd6674f23242</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Using the hexadecimal value is correct.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Can you check that &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/CONFIG_INIT_ARCH_HW_AT_BOOT.html"&gt;CONFIG_INIT_ARCH_HW_AT_BOOT&lt;/a&gt;&amp;nbsp;is enabled (check &amp;lt;build_folder&amp;gt;/spm/zephyr/.config)?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also, please paste the output of running &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;ninja partition_manager_report&lt;/span&gt; in the build folder.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Heidi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>