<?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>Debugging nRF5340 Net CPU Causes Stack Overflow on Reset</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/75595/debugging-nrf5340-net-cpu-causes-stack-overflow-on-reset</link><description>When compiling the net CPU with debugging configs such as CONFIG_DEBUG or CONFIG_DEBUG_OPTIMIZATIONS enabled and the resulting hex is flashed to the nRF5340; If then an Ozone debugging session is started and the system reset, a stack overflow hard fault</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 16 Jun 2021 12:39:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/75595/debugging-nrf5340-net-cpu-causes-stack-overflow-on-reset" /><item><title>RE: Debugging nRF5340 Net CPU Causes Stack Overflow on Reset</title><link>https://devzone.nordicsemi.com/thread/315606?ContentTypeID=1</link><pubDate>Wed, 16 Jun 2021 12:39:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc7358b9-18ab-4fff-b83d-517243d224ae</guid><dc:creator>anthony32086</dc:creator><description>&lt;p&gt;Setting CONFIG_INIT_ARCH_HW_AT_BOOT does indeed fix the problem with no other changes to the base reset.S.&lt;/p&gt;
&lt;p&gt;The only time I observe this issue is when debugging so you mentioning that the debugger should perform a reset but not doing it makes sense. Cold boots with no debugger attached do not observe any hardfaults.&lt;/p&gt;
&lt;p&gt;The debugger I am using is a JTrace attached externally to P18 (debug in) on the devboard however I can confirm that it the issue was also present when using the built in JLink.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Debugging nRF5340 Net CPU Causes Stack Overflow on Reset</title><link>https://devzone.nordicsemi.com/thread/315586?ContentTypeID=1</link><pubDate>Wed, 16 Jun 2021 11:58:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d4e56f3-8e43-4cb6-a699-6a969cfe4baf</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The Network core is a regular Cortex-M33 and any warm/cold reset should be initializing the CONTROL register. If the debugger does not do it on the NET core, then this might be a problem.&lt;/p&gt;
&lt;p&gt;One thing that you can do is to set the CONFIG_INIT_ARCH_HW_AT_BOOT Kconfig option for the network core. This option will set the CONTROL register before anything else, in reset.S:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;br /&gt;#if&amp;nbsp;defined(CONFIG_INIT_ARCH_HW_AT_BOOT)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/&lt;b&gt;&amp;nbsp;Reset&amp;nbsp;CONTROL&amp;nbsp;register&amp;nbsp;&lt;/b&gt;/&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;movs.n&amp;nbsp;r0,&amp;nbsp;#0&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;msr&amp;nbsp;CONTROL,&amp;nbsp;r0&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;isb&lt;br /&gt;#if&amp;nbsp;defined(CONFIG_CPU_CORTEX_M_HAS_SPLIM)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/&lt;b&gt;&amp;nbsp;Clear&amp;nbsp;SPLIM&amp;nbsp;registers&amp;nbsp;&lt;/b&gt;/&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;movs.n&amp;nbsp;r0,&amp;nbsp;#0&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;msr&amp;nbsp;MSPLIM,&amp;nbsp;r0&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;msr&amp;nbsp;PSPLIM,&amp;nbsp;r0&lt;br /&gt;#endif&amp;nbsp;/&lt;b&gt;&amp;nbsp;CONFIG_CPU_CORTEX_M_HAS_SPLIM&amp;nbsp;&lt;/b&gt;/&lt;br /&gt;&amp;nbsp;&lt;br /&gt;This will ensure that the MSP is used at Network core boot, and not the PSP.&lt;/p&gt;
&lt;p&gt;Let me know if this&amp;nbsp;workaround works for you or not.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Debugging nRF5340 Net CPU Causes Stack Overflow on Reset</title><link>https://devzone.nordicsemi.com/thread/312876?ContentTypeID=1</link><pubDate>Tue, 01 Jun 2021 12:18:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be62d5aa-9130-4280-8ef4-ef92c9c5656a</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thank you for reporting this. I have reported this internally. I will keep you posted about our findings.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>