-
although since sending floats as function arguments isn't something that's really supported (it has to be done by a bit of a hack)
in inlineC it is definitely a hack as the header clearly says
int
but code usesfloat
in declaration and it works thanks to softfp calling conventionvar c = E.compiledC(` // int fadd(int,int) // int fmul(int,int) float fadd(float f1,float f2){ return f1+f2; } float fmul(float f1,float f2){ return f1*f2; }
so if softfp build will work fine and will stay, it might make sense to allow
float
keyword also in header comment declaration of InlineC methodsvar c = E.compiledC(` // float fadd(float,float)
to make it less hacky
Ahh - yes, this makes sense - although since sending floats as function arguments isn't something that's really supported (it has to be done by a bit of a hack) it probably explains why nobody hit this before. I wasn't aware that changing from soft/hard actually changed the argument passing behaviour. nRF52 builds have been like this since at least 2017!!
Changing from hard -> softfp actually seems to shave a few bytes off the firmware size, so I've committed a change - however it's a tricky one - it doesn't really help anyone on nRF52 who is using the firmware that's out there now. They'll still have the issue using any floating point numbers in code.
I guess maybe I'll wait until 2v15 gets released and then switch the compiler back to using
softfp