<?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>HardFault of SystemInit</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/58511/hardfault-of-systeminit</link><description>Hi, 
 I&amp;#39;m trying to deploy the example program, cifar10, from CMSIS-NN library on NRF52. The issus is I compiled and downloaded it to the board successfully but when I try to debug, it alwasys stays in HardFault_Handler. 
 I checked the code and found</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 09 Mar 2020 06:58:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/58511/hardfault-of-systeminit" /><item><title>RE: HardFault of SystemInit</title><link>https://devzone.nordicsemi.com/thread/238704?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 06:58:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5be7db5d-e661-4908-afae-e1e6115af602</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;Based on the stack pointer, it looks like your RAM is overflowed. I can see 0x2001xxxx, which is larger than the amount of RAM that the nRF52832 has (it has 64k and 0x10000 is 64k in hex). This should give an error when compiling and linking, since keil should check the RAM boundaries, provided that your project is setup properly.&lt;/p&gt;
&lt;p&gt;In order to fix this, you need to reduce the amount of RAM your firmware uses.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Have you considered using the &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/keyfeatures_html5.html?cp=4_0_0"&gt;nRF52840&lt;/a&gt;? it has 256k RAM.&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: HardFault of SystemInit</title><link>https://devzone.nordicsemi.com/thread/238644?ContentTypeID=1</link><pubDate>Sat, 07 Mar 2020 15:43:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2639f4fa-6f0e-4b91-bba7-7e682dda5d57</guid><dc:creator>Price Wang</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have removed the STACKSIZE statement and did those steps with&lt;span&gt;&amp;nbsp;single step instruction&lt;/span&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/4718.1.JPG" /&gt;&lt;/li&gt;
&lt;li&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/2577.2.JPG" /&gt;&lt;/li&gt;
&lt;li&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/3250.3.JPG" /&gt;&lt;/li&gt;
&lt;li&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/7457.4.JPG" /&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault of SystemInit</title><link>https://devzone.nordicsemi.com/thread/238184?ContentTypeID=1</link><pubDate>Thu, 05 Mar 2020 08:19:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a4322b2-ede7-49c9-af8c-1d41f46082c4</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;Here&amp;#39;s a window that shows the call stack in the lower right corner, which shows what functions I&amp;#39;m in:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-e6575f85703c4be08abdcce487c565bb/pastedimage1583396102755v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;However; I see from your stack pointer that this isn&amp;#39;t going well. Its set at 0x20014418, which indicates that approx. 82 kB of RAM is used. This will not run properly, as the nRF52832 has 64kB of RAM.&lt;/p&gt;
&lt;p&gt;As previously mentioned, please remove the __STACK_SIZE=64k that you have in your project, re-compile, and enter debug mode again to see if the fault occurs. If it occurs, please post the whole picture of the IDE.&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: HardFault of SystemInit</title><link>https://devzone.nordicsemi.com/thread/238082?ContentTypeID=1</link><pubDate>Wed, 04 Mar 2020 14:52:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:74a51341-b4e0-4a7b-a0c0-b576e4a6ff7f</guid><dc:creator>Price Wang</dc:creator><description>&lt;p&gt;In debug mode, I did those operations:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Proceeds ok up to &amp;quot;LDR R0, =SystemInit&amp;quot;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;On the next instruction, BLX R0, the code jumps correctly into SystemInit&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Using single step instruction mode,&amp;nbsp;it just went&amp;nbsp;into hardfault handler (the asssembly is a push function)&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/18408.Capture.PNG" /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault of SystemInit</title><link>https://devzone.nordicsemi.com/thread/238041?ContentTypeID=1</link><pubDate>Wed, 04 Mar 2020 13:32:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88ce1e68-5845-4e76-90b0-4ef1493abe2a</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;The nrf52832 has in total 64 kB of RAM. You shouldn&amp;#39;t declare it all for the use of stack. Remove that define if your array is globally declared.&lt;/p&gt;
&lt;p&gt;When in debug mode, you should get a call stack when you reach the hardfault handler, listing which functions lead to the fault. Could you post this?&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: HardFault of SystemInit</title><link>https://devzone.nordicsemi.com/thread/238027?ContentTypeID=1</link><pubDate>Wed, 04 Mar 2020 12:41:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fdb4963d-675f-44c3-9e01-166eac4cc7ae</guid><dc:creator>Price Wang</dc:creator><description>&lt;p&gt;Hi Hakon,&lt;/p&gt;
&lt;p&gt;The variable conv2_wt is a global variable. I checked the stack I defined and I think it&amp;#39;s large enough.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/3808.Capture.PNG" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault of SystemInit</title><link>https://devzone.nordicsemi.com/thread/237336?ContentTypeID=1</link><pubDate>Mon, 02 Mar 2020 08:48:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac91ae8d-c8a1-4fed-95d6-fe0df2b353e6</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Is the variable conv2_wt stacked, or a globally declared variable? If stacked, then you&amp;#39;re running out of stack memory. You can either expand the stack size (Keil: options for project -&amp;gt; &lt;span style="text-decoration:underline;"&gt;ASM&lt;/span&gt; -&amp;gt; define: __STACK_SIZE=larger than your array), or declare it as a global.&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></channel></rss>