-
For some reason the following compiles fine on my local EspruinoCompiler, but fails on the online one:
let c = E.compiledC(` // int boop(double) int boop(double d) { return float(d) * 3; } `); print('boop:', c.boop(3.5));
Maybe it's a different GCC version?
arm-none-eabi-gcc -v
gives me:
gcc version 10.3.1 20210824 (release) (GNU Arm Embedded Toolchain 10.3-2021.10)
I think fixing it on the online one is just a matter of adding
cflags += "-lgcc ";
but I can't test that here. It doesn't increase the binary size unnecessarily and is much better than messing with inline assembly.
I've just updated with the changes (and softfp) and it would appear to be working ok.
Now we have some hardware FP support, I wonder if it might be worth implementing at least
__aeabi_d2f
and__aeabi_f2d
if only as static functions added to what's compiled (which should get compiled out if not used) so that at least it's possible to convert to/from doubles for Espruino?I can see the Raspberry Pi Pico seems to have optimised implementations?
https://github.com/raspberrypi/pico-sdk/blob/6a7db34ff63345a7badec79ebea3aaef1712f374/src/rp2_common/pico_double/double_aeabi.S