I'm hoping someone can help me out as two days have passed and I am not capable of solving the issue myself. Hopefully it is something simple.
I can not perform any operations using float values. They just don't work or produce completely wrong results. As an example, I added the following shell function to the standard STM32F4-Discovery-MEMS demo:
Code: Select all
static void cmd_float(BaseSequentialStream *chp, int argc, char *argv[]) {
float res, res1, res2, res3;
res = (float)2.2/(float)1.1;
res1 = (float)2.3+(float)3.4;
res2 = (float)3.3-(float)5.2;
res3 = (float)3.4*(float)8.5;
chprintf(chp, "Result of float division: %f\r\n", res);
chprintf(chp, "Result of float addition: %f\r\n", res1);
chprintf(chp, "Result of float subtraction: %f\r\n", res2);
chprintf(chp, "Result of float multiplication: %f\r\n", res3);
}
and the output when calling this shell command is:
Result of float division: f
Result of float addition: f
Result of float subtraction: f
Result of float multiplication: f
Which is quite strange.
I tried setting USE_FPU in the Makefile to no,hard,softfp but nothing changes. Using just "soft" produces a compile error.
Can anyone shed some light on what needs to be done to use floats correctly? This is in ChibiStudio latest I believe, Chibios 2.6 branch.
Any help appreciated,
Thanks in advance,
-Igor