<?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>SPM secure services issue</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/58439/spm-secure-services-issue</link><description>Hello, 
 I have a low power application, which is activated by a push button press. (The DC-DC converter is also in shutdown mode normally, so the NRF9160 does not have power most of the time.) I want to detect the edges of the power enabling push button</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 28 Feb 2020 13:27:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/58439/spm-secure-services-issue" /><item><title>RE: SPM secure services issue</title><link>https://devzone.nordicsemi.com/thread/237141?ContentTypeID=1</link><pubDate>Fri, 28 Feb 2020 13:27:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc6dc196-d153-40f1-b216-1c4f2de9909c</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;481 ms with printing (ie: untouched):&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-fcbfa882d9f74a218d53c35b9f7f7419/pastedimage1582895332859v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;168 ms with CONFIG_SPM_BOOT_SILENTLY=y:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-fcbfa882d9f74a218d53c35b9f7f7419/pastedimage1582895616933v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;168 ms with CONFIG_SERIAL=n:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-fcbfa882d9f74a218d53c35b9f7f7419/pastedimage1582896011436v3.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To override spm, I would recommend that you add this to your samples/nrf9160/my_application/CMakeLists.txt file, &lt;span style="text-decoration:underline;"&gt;&lt;em&gt;just below the &amp;quot;cmake_minimum_required(VERSION 3.13.1)&amp;quot; line&lt;/em&gt;&lt;/span&gt;:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;if (EXISTS &amp;quot;${CMAKE_CURRENT_SOURCE_DIR}/spm.conf&amp;quot;)
  set(spm_CONF_FILE
    prj.conf
    ${CMAKE_CURRENT_LIST_DIR}/spm.conf
  )
endif()
 
if (EXISTS &amp;quot;${CMAKE_CURRENT_SOURCE_DIR}/mcuboot.conf&amp;quot;)
  set(mcuboot_CONF_FILE
    prj.conf
    ${CMAKE_CURRENT_LIST_DIR}/mcuboot.conf
  )
endif()
 
if (EXISTS &amp;quot;${CMAKE_CURRENT_SOURCE_DIR}/${BOARD}.overlay&amp;quot;)
  set(mcuboot_DTC_OVERLAY_FILE &amp;quot;${CMAKE_CURRENT_SOURCE_DIR}/${BOARD}.overlay&amp;quot;)
  set(spm_DTC_OVERLAY_FILE &amp;quot;${CMAKE_CURRENT_SOURCE_DIR}/${BOARD}.overlay&amp;quot;)
endif()&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now, if you create the file my_application/spm.conf, it should be automatically loaded when you reconfigure you project.&lt;/p&gt;
&lt;p&gt;Paste in CONFIG_SERIAL=n into the spm.conf file, and you should see the same boot-up time as I have above here.&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: SPM secure services issue</title><link>https://devzone.nordicsemi.com/thread/236985?ContentTypeID=1</link><pubDate>Thu, 27 Feb 2020 18:50:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a23849bc-7694-46f2-9051-337474d634db</guid><dc:creator>rbence</dc:creator><description>&lt;p&gt;I think I found the answer for the second question.&lt;/p&gt;
&lt;p&gt;This is from secure_services.c:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;__TZ_NONSECURE_ENTRY_FUNC
int spm_request_read(void *destination, u32_t addr, size_t len)
{
	static const struct read_range ranges[] = {
#ifdef PM_MCUBOOT_ADDRESS
		/* Allow reads of mcuboot metadata */
		{.start = PM_MCUBOOT_PAD_ADDRESS,
		 .size = PM_MCUBOOT_PAD_SIZE},
#endif
		{.start = FICR_PUBLIC_ADDR,
		 .size = FICR_PUBLIC_SIZE},
		{.start = FICR_RESTRICTED_ADDR,
		 .size = FICR_RESTRICTED_SIZE},
	};

	if (destination == NULL || len &amp;lt;= 0) {
		return -EINVAL;
	}

	for (size_t i = 0; i &amp;lt; ARRAY_SIZE(ranges); i++) {
		u32_t start = ranges[i].start;
		u32_t size = ranges[i].size;

		if (addr &amp;gt;= start &amp;amp;&amp;amp; addr + len &amp;lt;= start + size) {
			memcpy(destination, (const void *)addr, len);
			return 0;
		}
	}

	return -EPERM;
}
#endif /* CONFIG_SPM_SERVICE_READ */&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It seems that you cannot read from anywhere in the Secure region but only from FICR and MCUBOOT_PAD. I can modify this function to&amp;nbsp;add custom regions which can be read.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;However it would be better if I could reduce the running time of the Secure part from 350 ms to below 100 ms.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>