Is toolchain work correct with floating point and ARMv7?
Hello.
Here is code snippet which fail on Cortex-R4F and software floating point.
#include <iostream>
#include <cstdio>
int main()
{
char buf[100];
float f = 0.000187F;
snprintf(buf, 100, "0.000187=%f %d", f, (int)(f*1e6f));
while(1);
return 0;
}
There will be invalid string in buf for both values.
Compiling and linking command string:
arm-none-eabi-g++ -Og mcpu=cortex-r4f -marm -g -mfloat-abi=soft -fmessage-length=0 -fno-builtin -c -std=c++11 -fno-rtti -fno-use-cxa-atexit main.cpp -o main.o
arm-none-eabi-g++ -Og -mcpu=cortex-r4f -marm -g -mfloat-abi=soft -fmessage-length=0 -fno-builtin -Wl,-T,rom.lds -Wl,--gc-sections --specs=nosys.specs main.o -o fw.elf
(plus additional startup object files)
If I remove <iostream> then buf containt correct string.
All floating point operations failed if I add #include <iostream>
How can I use <iostream> with working floating-point?
Question information
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
This question was reopened
Can you help with this problem?
Provide an answer of your own, or ask Vitaliy Bortsov for more information if necessary.