Skip to main content
Manish Sharma
Associate III
April 30, 2018
Question

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

  • April 30, 2018
  • 6 replies
  • 1879 views
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
This topic has been closed for replies.

6 replies

Technical Moderator
May 2, 2018
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

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
AvaTar
Senior III
May 2, 2018
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.

Tesla DeLorean
Guru
May 2, 2018
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 VenmoUp vote any posts that you find helpful, it shows what's working..
Manish Sharma
Associate III
May 3, 2018
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

AvaTar
Senior III
May 3, 2018
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
Visitor II
May 3, 2018
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
May 9, 2018
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.