Skip to main content
MOhamed_Mehery
Associate III
May 31, 2023
Solved

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)


_legacyfs_online_stmicro_images_0693W00000blCjeQAE.png

This topic has been closed for replies.
KnarfB
KnarfBBest answer
Super User
May 31, 2023

the stack goes down, not up?

6 replies

KnarfB
Super User
May 31, 2023

> 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

MOhamed_Mehery
Associate III
May 31, 2023

I made edit

KnarfB
Super User
May 31, 2023

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

MOhamed_Mehery
Associate III
May 31, 2023

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

KnarfB
KnarfBBest answer
Super User
May 31, 2023

the stack goes down, not up?

MOhamed_Mehery
Associate III
May 31, 2023

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