cancel
Showing results for 
Search instead for 
Did you mean: 

scanf on STM32

philipgillespie
Associate II
Posted on November 05, 2010 at 13:27

scanf on STM32

4 REPLIES 4
John F.
Senior
Posted on May 17, 2011 at 14:13

It should be ebough to include <stdio.h>. Check if your development environment has settings to use (or not) floating point support etc. Sometimes only simplified library functions are loaded by default (to save space).

Andrew Neil
Evangelist
Posted on May 17, 2011 at 14:13

For a specific question like this, about a specific toolset, you really should be asking on the tool's own support site!

IIRC, RIDE has options to use a ''small printf'' or ''full printf'' - so you hve to RTFM to make sure all your settings are correct..

Again, the guys at Raisonance are really the ones to ask!

infoinfo974
Associate
Posted on May 17, 2011 at 14:14

how's about this...

currently using the ''small printf'' in the project settings. Printf works fine no complaint there. Scanf compiles ok & the code executes to the point where the first character is sent via the keyboard. The character is echoed back (from within the __io_getchar just for debug purposes) ok.

After that point the code fails jumping to 

void

HardFault_Handler(

void

) & I think it's possibly because there's a formatted_read function that's not been linked correctly.

I'd have though that the #inclusion of stdio.h would've been enough but that's why I'm wondering where scanf lives in the standard install?

Cheers

Posted on May 17, 2011 at 14:14

Under Keil the scanf/printf code eats more stack than the default projects provide for, and consequently crashes into the heap. Probably less of an issue with GNU based chains.

Put in a real handler for the hard fault and you can find the offending code pretty quickly.

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