Skip to main content
Jiri Pelant
Associate
Mar 12, 2019 3:38 PM UTC
Question

Calling printf() falls into HardFault_Handler()

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
Mar 12, 2019 5:49 PM UTC

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
Apr 5, 2019 2:03 PM UTC

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
Apr 5, 2019 3:01 PM UTC

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..