2010-11-05 05:27 AM
scanf on STM32
2011-05-17 05:13 AM
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).
2011-05-17 05:13 AM
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!2011-05-17 05:14 AM
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
2011-05-17 05:14 AM
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.