cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7: How can trace/diagnose stack overflow using STM AC6 Workbench ?

Manish Sharma
Associate III
Posted on April 30, 2018 at 06:19

Hi All,

Recently, I am stucked in an issue where if i use 'printf('%f', num)' ( where num is float type) then system gives 'hard fault' but if i use 'printf('%d', num) ( where num is integer) then system works fine.

I don't know that how can we debug such issue in STM32 AC6 Workbench ?

Regards,

Manish

#debuging #stm32h7 #ide-debugger-eclipse
7 REPLIES 7
Imen.D
ST Employee
Posted on May 02, 2018 at 12:36

Hello

manishsharma3134

,

Please, have a look to this discussion, it may help you

https://community.st.com/0D50X00009XkfDjSAJ

or this

http://www.openstmorg/forumthread954

Best Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
AvaTar
Lead
Posted on May 02, 2018 at 12:43

Many toolchains have an option to initialize the stack with a specific pattern.

This will allow you to determine a 'high watermark' during runtime, and an indication of a stack overflow after a crash.

Still, stack size is defined statically, and your responsibility.

This means, you need to increase the size until it fits your application.

Recently, I am stucked in an issue where if i use 'printf('%f', num)' ( where num is float type) ...

You shalt not print floating point numbers.

Their impact on stack usage is well-known.

Posted on May 02, 2018 at 13:43

Hard Faults are gross failures and should be pretty easy to pin-point with some precision.

Have a handler that does more than while(1). Identify the instructions which are faulting along with the CPU registers at the fault.

Make sure the tools are pulling the right libraries for the chip, and that the FPU is enabled.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Manish Sharma
Associate III
Posted on May 03, 2018 at 06:52

meyer.frank

Turvey.Clive.002

Turvey.Clive

DAHMEN.IMEN

Thanks all for the inputs. Although, my question was that 'how can we debug such issue in the AC6 environment' ?

I am novice to this world. Any help is greatly appreciated.

Sincerely,

Manish

Posted on May 03, 2018 at 09:09

... my question was that 'how can we debug such issue in the AC6 environment' ?

Obviously not so much users of this IDE here.

I would check for it's documentation and tutorials.

Or, you can work your way from the hardfault backwards:

http://www.keil.com/appnotes/files/apnt209.pdf

 
Dmytro Kovalenko
Associate II
Posted on May 03, 2018 at 15:31

Just try usage StackTrace window to show actual call state at HF. Then try Debug step by step at new run via that call sequence and detect problem place.

Manish Sharma
Associate III
Posted on May 09, 2018 at 12:26

Apologize for the late reply.

Thanks

kovalenko

meyer.frank

Turvey.Clive

DAHMEN.IMEN

‌ for addressing the issue. It certainly helped me to debug this issue.