Skip to main content
Jiri Pelant
Associate
March 12, 2019
Question

Calling printf() falls into HardFault_Handler()

  • March 12, 2019
  • 3 replies
  • 946 views

Hi,

I have troubles with stdio.h library function printf on STM32F207ZG-Nucleo board. After implementing (for example from ..\STM32Cube_FW_F2_V1.7.0\Projects\STM32F207ZG-Nucleo\Examples\UART\UART_Printf\..) calling printf() doesn't work. When I've tried to debug it, execution fails into HardFault_Handler and there stops.

The project is generated from newest CubeMX (5.1.0) and using RTOS. Im affarid it somehow corresponds with upgrade to 5.1.0 I did before this issue. In the previois versions (can't say exactly version number) I have no problem with this (I have noticed slightly different implementation of syscalls.c).

Thanks,

Jiri

This topic has been closed for replies.

3 replies

Tesla DeLorean
Guru
March 12, 2019

In Keil if you don't have the semi-hosting functionality correctly set up the BKPT instruction will Hard Fault

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Jiri Pelant
Associate
April 5, 2019

Hi,

thank you for your answer. Unfortunately I'm using SW4STM32.

I did downgrade to CubeMX v4.24.0. There it works correctly. The same method in v5.1.0, but not the same result.

Thanks

Tesla DeLorean
Guru
April 5, 2019

Don't know, I'd start with the Hard Fault and work backward, likely something isn't linking properly, or a name/symbol usage changed.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..