<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/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/"><channel><title>Hardfault exception error</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/30213/hardfault-exception-error</link><description> 
Hello, 

 
I wrote FreeRTOS code for blinking LED on STM32F103RB. When i
debug the program it goes into HardFault exception. May i know what
is the exact cause of this. 
 </description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Hardfault exception error</title><link>https://community.arm.com/thread/146822?ContentTypeID=1</link><pubDate>Tue, 13 Mar 2012 02:31:18 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1ba5b87b-125b-457d-8166-c040628aed40</guid><dc:creator>nikit biraj</dc:creator><description>&lt;p&gt;&lt;p&gt;
Its not wrong..&lt;br /&gt;
did one change in port.c file&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault exception error</title><link>https://community.arm.com/thread/145280?ContentTypeID=1</link><pubDate>Tue, 13 Mar 2012 00:47:09 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:bdeb2a13-0546-4de6-8000-3499fd7745af</guid><dc:creator>Tamiryan Michael</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;have to do few changes in freertos code..&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Probably the wrong solution, unless it is a change to the ported
code !&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault exception error</title><link>https://community.arm.com/thread/143126?ContentTypeID=1</link><pubDate>Mon, 12 Mar 2012 22:45:49 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d275c7bd-8058-43e1-907d-12a1fb659b59</guid><dc:creator>nikit biraj</dc:creator><description>&lt;p&gt;&lt;p&gt;
thank u all..&lt;br /&gt;
finally it worked...&lt;br /&gt;
have to do few changes in freertos code..&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault exception error</title><link>https://community.arm.com/thread/140184?ContentTypeID=1</link><pubDate>Mon, 12 Mar 2012 01:12:41 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:565960ce-9745-4bf0-8d16-d32b57d67d7b</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Have you made sure you don&amp;#39;t have a stack overflow, and don&amp;#39;t have
a memory overrun, and don&amp;#39;t make use of any uninitialized pointers or
index variables?&lt;/p&gt;

&lt;p&gt;
After all - debugging is a significant part of programming.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault exception error</title><link>https://community.arm.com/thread/140183?ContentTypeID=1</link><pubDate>Mon, 12 Mar 2012 01:04:58 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:12509c1f-7c18-42ae-9027-34700ddb2890</guid><dc:creator>Tamiryan Michael</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;please do help&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
How can I? I am not telepathic. I would argue that no one here is.
Debug it -&amp;gt; solve it.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault exception error</title><link>https://community.arm.com/thread/130970?ContentTypeID=1</link><pubDate>Sun, 11 Mar 2012 22:18:28 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:26689fcd-cb97-4348-8575-6a78252038ac</guid><dc:creator>nikit biraj</dc:creator><description>&lt;p&gt;&lt;p&gt;
Sir what changes should i make to resolve my error. My GPIO is set
properly when i check in debug.&lt;br /&gt;
please do help&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault exception error</title><link>https://community.arm.com/thread/127398?ContentTypeID=1</link><pubDate>Sat, 10 Mar 2012 04:57:04 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:869b2041-2028-401e-9e1a-d9c760211fc7</guid><dc:creator>Tamiryan Michael</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;Should i make it zero?&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
NO !&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;what does this mean?&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Read a cortex M3 architecture document and your chip&amp;#39;s user
manual.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault exception error</title><link>https://community.arm.com/thread/116742?ContentTypeID=1</link><pubDate>Sat, 10 Mar 2012 04:20:17 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a18f60e5-fbac-4efb-8c96-da03f8bb1f90</guid><dc:creator>nikit biraj</dc:creator><description>&lt;p&gt;&lt;p&gt;
Peripherals-&amp;gt;Core peripherals-&amp;gt;Fault reports?&lt;br /&gt;
i checked in bar menu. in that HARD_FAULT_STAT: 0x40000000 and forced
option is ticked when i debug.&lt;br /&gt;
Should i make it zero?&lt;br /&gt;
what does this mean?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault exception error</title><link>https://community.arm.com/thread/105819?ContentTypeID=1</link><pubDate>Sat, 10 Mar 2012 04:05:34 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:aec8855f-cfdd-44c7-ba24-d3044dc19a55</guid><dc:creator>Tamiryan Michael</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;May i know sir what do you mean by Peripherals-&amp;gt;Core
peripherals-&amp;gt;Fault reports?&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Look at uv4&amp;#39;s menu bar and you&amp;#39;ll get it.&lt;br /&gt;
And yet, maybe your GPIO block is not powered. That can lead to a
hard fault.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault exception error</title><link>https://community.arm.com/thread/80079?ContentTypeID=1</link><pubDate>Sat, 10 Mar 2012 03:33:19 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:e9960a20-bded-46d0-89bd-25f812bdbdbc</guid><dc:creator>nikit biraj</dc:creator><description>&lt;p&gt;&lt;p&gt;
May i know sir what do you mean by Peripherals-&amp;gt;Core
peripherals-&amp;gt;Fault reports?&lt;/p&gt;

&lt;p&gt;
Is it that i have initialized GPIO pins so it is giving error?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault exception error</title><link>https://community.arm.com/thread/80078?ContentTypeID=1</link><pubDate>Sat, 10 Mar 2012 03:31:41 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a8b02b82-5e20-4948-9704-c5279adb414f</guid><dc:creator>nikit biraj</dc:creator><description>&lt;p&gt;&lt;p&gt;
I have a delay function in while loop. When this delay function is
executing it goes to void xPortSysTickHandler( void ), it executes
few instructions, then it goes to&lt;br /&gt;
__asm void vPortSetInterruptMask( void )&lt;/p&gt;

&lt;p&gt;
{ PRESERVE8&lt;/p&gt;

&lt;p&gt;
push { r0 } mov r0, #configMAX_SYSCALL_INTERRUPT_PRIORITY msr
basepri, r0 pop { r0 } bx r14&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;
it executes this then void vTaskIncrementTick( void ) is done.&lt;br /&gt;
then it goes to&lt;/p&gt;

&lt;p&gt;
__asm void vPortClearInterruptMask( void )&lt;/p&gt;

&lt;p&gt;
{ PRESERVE8&lt;/p&gt;

&lt;p&gt;
push { r0 } mov r0, #0 msr basepri, r0 pop { r0 } bx r14&lt;br /&gt;
} then it goes to&lt;/p&gt;

&lt;p&gt;
__asm void xPortPendSVHandler( void )&lt;/p&gt;

&lt;p&gt;
{ extern uxCriticalNesting; extern pxCurrentTCB; extern
vTaskSwitchContext;&lt;/p&gt;

&lt;p&gt;
PRESERVE8&lt;/p&gt;

&lt;p&gt;
-----&amp;gt; mrs r0, psp&lt;/p&gt;

&lt;p&gt;
ldr r3, =pxCurrentTCB /* Get the location of the current TCB. */
ldr r2, [r3]&lt;/p&gt;

&lt;p&gt;
stmdb r0!, {r4-r11} /* Save the remaining registers. */ str r0,
[r2] /* Save the new top of stack into the first member of the TCB.
*/&lt;/p&gt;

&lt;p&gt;
stmdb sp!, {r3, r14} mov r0, #configMAX_SYSCALL_INTERRUPT_PRIORITY
msr basepri, r0 bl vTaskSwitchContext mov r0, #0 msr basepri, r0
ldmia sp!, {r3, r14}&lt;/p&gt;

&lt;p&gt;
ldr r1, [r3] ldr r0, [r1] /* The first item in pxCurrentTCB is the
task top of stack. */ ldmia r0!, {r4-r11} /* Pop the registers and
the critical nesting count. */ msr psp, r0 bx r14&lt;/p&gt;

&lt;p&gt;
nop&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;
i have show arrow in above code, from that is executes. When it
executes nop instruction at last it jumps to Hardfault exception.&lt;/p&gt;

&lt;p&gt;
i guess while poping it is going to some different location.&lt;/p&gt;

&lt;p&gt;
Do help me out please&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault exception error</title><link>https://community.arm.com/thread/60492?ContentTypeID=1</link><pubDate>Sat, 10 Mar 2012 03:10:00 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3d50340e-c7d5-49fd-afc5-a5aa80be2b86</guid><dc:creator>Tamiryan Michael</dc:creator><description>&lt;p&gt;&lt;p&gt;
Peripherals-&amp;gt;Core peripherals-&amp;gt;Fault reports&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault exception error</title><link>https://community.arm.com/thread/60491?ContentTypeID=1</link><pubDate>Sat, 10 Mar 2012 02:15:59 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3e2d0716-dc9a-4ccb-8d31-e008ed6403f1</guid><dc:creator>H Mackie</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;May i know what is the exact cause of this.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
You may. Use the debugger and find the point where the HardFault
is triggered.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>