I’m looking for a way to display float values on serial port. It seems there is a new function “e_printf” in the latest firmware (2.x.x.x) but I can’t test it because if I compile the FW with the Ac6 OpenSTM32 IDE, the board reboots permanently, displaying stranges characters on Serial port.
So I’m using an old firmware (1.1.3), that uses a simplified “printf.c” file to reduce memory footprint, but seems to have limited options and the %f is not present :
switch (*pFormat) {
case ‘d’:
case ‘i’: num = PutSignedInt(pStr, fill, width, va_arg(ap, signed int)); break;
case ‘u’: num = PutUnsignedInt(pStr, fill, width, va_arg(ap, unsigned int)); break;
case ‘x’: num = PutHexa(pStr, fill, width, 0, va_arg(ap, unsigned int)); break;
case ‘X’: num = PutHexa(pStr, fill, width, 1, va_arg(ap, unsigned int)); break;
case ‘s’: num = PutString(pStr, va_arg(ap, char *)); break;
case ‘c’: num = PutChar(pStr, va_arg(ap, unsigned int)); break;
Hi @JCDS
I am not so familiar with OpenSTM32. Do you turn on the floating point output? Which compiler version are you using c11 or c99? What gcc are you using?
Sorry for too many questions Try to help
I know that floating point is not supported on all MCU and I’ve seen some specific options for the linker like “-specs=nosys.specs -specs=nano.specs -u _printf_float -u _scanf_float” :