<?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>softdevice use precludes manual MSP?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/93697/softdevice-use-precludes-manual-msp</link><description>i&amp;#39;m using the nRF52840 with a custom micro-kernel designed to support user-space applications with multi-tasking. multi-tasking is implemented using separate stack space for each of multiple threads, which means we&amp;#39;re manually changing PSP and MSP to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 09 Nov 2022 18:19:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/93697/softdevice-use-precludes-manual-msp" /><item><title>RE: softdevice use precludes manual MSP?</title><link>https://devzone.nordicsemi.com/thread/394991?ContentTypeID=1</link><pubDate>Wed, 09 Nov 2022 18:19:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:44d90f36-0f81-4f25-94cf-67ca210ce4a5</guid><dc:creator>tague</dc:creator><description>&lt;p&gt;thank you. i&amp;#39;ve already read all of the documentation, but I cannot understand why the MSP cannot be changed by the kernel to support context-switching among user-space threads.&amp;nbsp; it should not be an issue, since all interaction would be done with the softdevice through system calls, but our kernel still changes the MSP per thread.&amp;nbsp; i still could not get a sense from the documentation of _why_ the MSP cannot be changed.&amp;nbsp; do i just need to try to incorporate the SD and see if it works or not?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: softdevice use precludes manual MSP?</title><link>https://devzone.nordicsemi.com/thread/394907?ContentTypeID=1</link><pubDate>Wed, 09 Nov 2022 12:39:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:969699ed-68ac-4dd3-be00-a9b70958855e</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;There are more info here:&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsds_s140%2FSDS%2Fs1xx%2Fmem_usage%2Fmem_resource_reqs.html"&gt;https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsds_s140%2FSDS%2Fs1xx%2Fmem_usage%2Fmem_resource_reqs.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;br /&gt;By default, the nRF52 System on Chip (SoC) will have a shared call stack with both application stack frames and SoftDevice stack frames, managed by the Main Stack Pointer (MSP).&lt;/p&gt;
&lt;p&gt;The application configures the call stack, and the MSP gets initialized on reset to the address specified by the application vector table entry 0. In its reset vector the application may configure the CPU to use the Process Stack Pointer (PSP) in thread mode. This configuration is optional but may be required by an OS, for example, to isolate application threads and OS context memory. The application programmer must be aware that the SoftDevice will use the MSP as it is always executed in exception mode.&lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;and,&lt;/p&gt;
[quote user=""]&amp;gt; Do not change the value of MSP dynamically (i.e. never set the MSP register directly)[/quote]
&lt;p&gt;Above this statement we also have:&lt;/p&gt;
&lt;p&gt;&amp;quot;The location of the call stack is communicated to the SoftDevice through the contents of the Main Stack Pointer (MSP) register. &amp;quot;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>