• so that float could be passed like ints in R0-R4 so that InlineC code could receive float arguments

    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

  • 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 uses float in declaration and it works thanks to softfp calling convention

    var 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 methods

    var c = E.compiledC(`
    // float fadd(float,float)
    

    to make it less hacky

About

Avatar for fanoush @fanoush started