printf floating pt with STM32F103 giving crazy output
On a custom board with a STM32F103VCT6 (Cortex-m3) printf is giving zeros or a very long nonsense number, e.g. the following code produces 0.00, -0.00, or a varying length (up to around 100) of numbers ending in .00, when all the time the integer printf produces a value of about 140 (the integer printf seems to work OK).
...
double therm[NUMBERADC
...
printf("%10.2f", therm[1]);
'Makefile' includes the following--
...
CFLAGS = -std=gnu99 -g -Os -Wall -Wextra
CFLAGS += -mlittle-endian -mthumb -mthumb-interwork -nostartfiles
CFLAGS += -fno-common -mcpu=cortex-m3 -Wstrict-prototypes
override FLOAT_TYPE = soft
CFLAGS += -msoft-float
...
LGCC = /opt/launchpad/
LOTHER = /opt/launchpad/
...
Using the same version of launchpad on a DiscoveryF4 with hard floating pt the printf works fine with floating pt, however the program, Makefile, startup code, though similar, are not identical.
(This is all bare metal C. For the F103 I've been using "tiny printf" which only does integers. Floating pt printf would be handy for the latest project, but "manually coding" a floating pt output seems silly when the launchpad printf should do the job.)
At this point I'm suspicious that it might have to do with startup and initialization, but I don't know what it might be and what to try. Any suggestions as to what-and-where to look would be appreciated.
Question information
- Language:
- English Edit question
- Status:
- Expired
- Assignee:
- No assignee Edit question
- Last query:
- Last reply: