cancel
Showing results for 
Search instead for 
Did you mean: 

Calling printf() falls into HardFault_Handler()

Jiri Pelant
Associate

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

3 REPLIES 3

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
Up vote any posts that you find helpful, it shows what's working..
Jiri Pelant
Associate

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

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
Up vote any posts that you find helpful, it shows what's working..