cancel
Showing results for 
Search instead for 
Did you mean: 

HardFault_Handler debugging

baev_al
Associate II
Posted on January 04, 2015 at 09:22

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:

xPortPendSVHandler:

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}

mov r0, #configMAX_SYSCALL_INTERRUPT_PRIORITY

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

1 REPLY 1
Posted on January 04, 2015 at 14:46

What is my next step?

Determine why the process's stack context is getting corrupted.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..