Unable to solve error ".o uses VFP register arguments, .elf does not"

  1. CFLAGS only applies to compiling C files, for such global options you should be using CCFLAGS, applying to both C and C++
  2. You should also add those flags to the linking stage, aka LINKFLAGS

-mfloat-abi is one part, it should be I think either softfp or hard to allow VFP register usage, the other part is setting what FPU you have. For a Cortex-M4 that could e.g. be

but if you work with a Cortex-M7 that argument might be different. Per https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html there are quite some options, but matching it to https://developer.arm.com/documentation/100068/0609/migrating-from-armcc-to-armclang/migrating-architecture-and-processor-names-for-command-line-options leads me to believe that something like

Import("env")
env.Append(
    CCFLAGS=[
        "-mfloat-abi=hard", # or softfp
        "-mfpu=fpv5-sp-d16"
    ],
    LINKFLAGS=[
        "-mfloat-abi=hard", # or softp
        "-mfpu=fpv5-sp-d16"
   ]
)

might work.

I can also recommend reading through