cancel
Showing results for 
Search instead for 
Did you mean: 

Measuring stack depth of function cause hardfault, inside the first for loop when ii > 4 the IMPRECISERR bit is set in the Configurable Fault Status Register (CFSR)

MOhamed_Mehery
Associate III


_legacyfs_online_stmicro_images_0693W00000blCjeQAE.png

1 ACCEPTED SOLUTION

Accepted Solutions
KnarfB
Principal III

the stack goes down, not up?

View solution in original post

6 REPLIES 6
KnarfB
Principal III

> inside for loop when i > 4

which loop? which i?

What type has stack_pointer? You cast it to uint8_t in the second loop, but not in the first?

ST uses the gcc idiom

register char * stack_ptr asm("sp");

to get the stack pointer

.

hth

KnarfB

I made edit

KnarfB
Principal III

what type? What + 4 does depends on the type (size).

unit32_t, I guess I'm increament the pointer in wrong direction

KnarfB
Principal III

the stack goes down, not up?

So, I have to decreament the pointer, not increamenting it