cancel
Showing results for 
Search instead for 
Did you mean: 

printf function call causes hard fault

Pramod K.G.
Associate II

Hi all,

I am working on a STM32F103VEtx MCU. In my firmware I have redirected the printf function to a UART for debugging purposes. When I start running the code, the printf function causes the hard fault handler to hit. Please see the call stack attached below

Thread #1 (Suspended : Signal : SIGINT:Interrupt)   

   prvGetRegistersFromStack() at stm32f1xx_it.c:109 0x800441a   

   <signal handler called>() at 0xfffffff9   

   std() at 0x8007abe   

   __sinit() at 0x8007b76   

   printf() at 0x8006dac   

   main() at main.c:130 0x800400c

0690X00000DXN5RQAX.png

It seems like  std() function call triggers the hard fault. Please help me to figure out and fix the issue.

Thanks in advance,

Pramod K. G.

10 REPLIES 10

The runtime library sources should be available where your toolchain (compiler etc) came from.