AnsweredAssumed Answered

HardFault_Handler debugging

Question asked by Baev.Alexander on Jan 4, 2015
Latest reply on Jan 4, 2015 by Clive One

Dear friends.

My platform is STM32F429Discovery.

I encountered whit Hard Fault error. I used the code of Joseph Yiu to track the place where error occurs. It is in the portasm_cm4.s (FreeRTOS).

     ldr r0, [r1]

r1=0x03FF6BF7, and this part of memory is reserved, so the HardFault is generated.

What is my next step?

Here is the full function:



     mrs r0, psp                              


     /* Get the location of the current TCB. */

     ldr     r3, =pxCurrentTCB               

     ldr     r2, [r3]                              


     /* Is the task using the FPU context?  If so, push high vfp registers. */

     tst r14, #0x10

     it eq

     vstmdbeq r0!, {s16-s31}


     /* Save the core registers. */

     stmdb r0!, {r4-r11, r14}                    


     /* Save the new top of stack into the first member of the TCB. */

     str r0, [r2]


     stmdb sp!, {r3, r14}


     msr basepri, r0

     bl vTaskSwitchContext               

     mov r0, #0

     msr basepri, r0

     ldmia sp!, {r3, r14}


     /* The first item in pxCurrentTCB is the task top of stack. */

     ldr r1, [r3]     

     ldr r0, [r1]


     /* Pop the core registers. */

     ldmia r0!, {r4-r11, r14}


     /* Is the task using the FPU context?  If so, pop the high vfp registers

     too. */

     tst r14, #0x10

     it eq

     vldmiaeq r0!, {s16-s31}


     msr psp, r0                              

     bx r14