Changing -mfloat-abi build option not working

Hi all,

I am building an Mbed OS application for nRF52840 (Cortex-M4) and am including a third party compiled library file (.a file) into my project. During linking i get the following error:

/root/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: error: lib/RTE_OFS/libOFS_0.a(vl53l1_hist_algos_gen3.o) uses VFP register arguments, .pio/build/release/firmware.elf does not
/root/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: failed to merge target specific data of file lib/RTE_OFS/libOFS_0.a(vl53l1_hist_algos_gen3.o)
/root/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: error: lib/RTE_OFS/libOFS_0.a(vl53l1_sigma_estimate.o) uses VFP register arguments, .pio/build/release/firmware.elf does not
/root/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: failed to merge target specific data of file lib/RTE_OFS/libOFS_0.a(vl53l1_sigma_estimate.o)

After initial searches, i was able to narrow down the issue to a mismatch in -mfloat-abi build options used between my project and the library. I was able to confirm with the third party that they are using hard floating point.

When i build the project in verbose mode i see the following output:

Compiling .pio/build/release/FrameworkMbed/cmsis/TARGET_CORTEX_M/mbed_tz_context.o
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
Target: arm-none-eabi
Configured with: /tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/src/gcc/configure --target=arm-none-eabi --prefix=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/install-native --libexecdir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/install-native/lib --infodir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/install-native/share/doc/gcc-arm-none-eabi/info --mandir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/install-native/share/doc/gcc-arm-none-eabi/man --htmldir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/install-native/share/doc/gcc-arm-none-eabi/html --pdfdir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/install-native/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --enable-plugins --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-newlib --with-headers=yes --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/install-native/arm-none-eabi --build=x86_64-linux-gnu --host=x86_64-linux-gnu --with-gmp=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/build-native/host-libs/usr --with-mpfr=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/build-native/host-libs/usr --with-mpc=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/build-native/host-libs/usr --with-isl=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/build-native/host-libs/usr --with-libelf=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/build-native/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='GNU Tools for Arm Embedded Processors 7-2017-q4-major' --with-multilib-list=rmprofile
Thread model: single
gcc version 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204] (GNU Tools for Arm Embedded Processors 7-2017-q4-major)
COLLECT_GCC_OPTIONS='-o' '.pio/build/release/FrameworkMbed/cmsis/TARGET_CORTEX_M/mbed_tz_context.o' '-c' '-v' '-c' '-Wall' '-Wextra' '-Wno-unused-parameter' '-Wno-missing-field-initializers' '-fmessage-length=0' '-fno-exceptions' '-ffunction-sections' '-fdata-sections' '-funsigned-char' '-MMD' '-fno-delete-null-pointer-checks' '-fomit-frame-pointer' '-Os' '-g' '-D' 'MBED_TRAP_ERRORS_ENABLED=1' '-mcpu=cortex-m4' '-mthumb' '-mfpu=fpv4-sp-d16' '-mfloat-abi=softfp' ...

Notice that -mfloat-abi=softfp option is used.
I want to make my application also use hard floating point. After a bit more searching of how i could do this, i came across multiple posts where the suggested action was to create a small extra python script to append linker flags. So i created the below python script link_hardfloat.py:

Import("env")
flags = [
   "-mfloat-abi=hard"
]
env.Append(CCFLAGS=flags, LINKFLAGS=flags)

and made the necessary change in platformio.ini:

[env:release]
...
extra_scripts = 
  pre:link_hardfloat.py

When i build the project again in verbose mode i see the following output:

Compiling .pio/build/release/FrameworkMbed/cmsis/TARGET_CORTEX_M/mbed_tz_context.o
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
Target: arm-none-eabi
Configured with: /tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/src/gcc/configure --target=arm-none-eabi --prefix=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/install-native --libexecdir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/install-native/lib --infodir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/install-native/share/doc/gcc-arm-none-eabi/info --mandir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/install-native/share/doc/gcc-arm-none-eabi/man --htmldir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/install-native/share/doc/gcc-arm-none-eabi/html --pdfdir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/install-native/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --enable-plugins --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-newlib --with-headers=yes --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/install-native/arm-none-eabi --build=x86_64-linux-gnu --host=x86_64-linux-gnu --with-gmp=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/build-native/host-libs/usr --with-mpfr=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/build-native/host-libs/usr --with-mpc=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/build-native/host-libs/usr --with-isl=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/build-native/host-libs/usr --with-libelf=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-633_20171130_1512067137/build-native/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='GNU Tools for Arm Embedded Processors 7-2017-q4-major' --with-multilib-list=rmprofile
Thread model: single
gcc version 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204] (GNU Tools for Arm Embedded Processors 7-2017-q4-major)
COLLECT_GCC_OPTIONS='-o' '.pio/build/release/FrameworkMbed/cmsis/TARGET_CORTEX_M/mbed_tz_context.o' '-c' '-mfloat-abi=hard' '-v' '-c' '-Wall' '-Wextra' '-Wno-unused-parameter' '-Wno-missing-field-initializers' '-fmessage-length=0' '-fno-exceptions' '-ffunction-sections' '-fdata-sections' '-funsigned-char' '-MMD' '-fno-delete-null-pointer-checks' '-fomit-frame-pointer' '-Os' '-g' '-D' 'MBED_TRAP_ERRORS_ENABLED=1' '-mcpu=cortex-m4' '-mthumb' '-mfpu=fpv4-sp-d16' '-mfloat-abi=softfp' ...

and still get the … uses VFP register arguments, .pio/build/release/firmware.elf does not error.

Is it correct for the -mfloat-abi build option to appear twice like this? Am i on the right track here?

Any help here would be much appreciated. Thank you.

You have to remove the old flags via the Python script, too.

Import("env")
old_flags = env["CCFLAGS"]
old_flags = [x for x in old_flags if x != "-mfloat-abi=softfp"]
env["CCFLAGS"] = old_flags
old_flags = env["LINKFLAGS"]
old_flags = [x for x in old_flags if x != "-mfloat-abi=softfp"]
env["LINKFLAGS"] = old_flags
flags = [
   "-mfloat-abi=hard"
]
env.Append(CCFLAGS=flags, LINKFLAGS=flags)

Hi @maxgerhardt, thanks for your reply.

What you have suggested doesn’t seem to fix the issue as i still get the … uses VFP register arguments, .pio/build/release/firmware.elf does not error and the following when i build the project

COLLECT_GCC_OPTIONS='-o' '.pio/build/release/FrameworkMbed/cmsis/TARGET_CORTEX_M/mbed_tz_context.o' '-c' '-mfloat-abi=hard' '-v' '-c' '-Wall' '-Wextra' '-Wno-unused-parameter' '-Wno-missing-field-initializers' '-fmessage-length=0' '-fno-exceptions' '-ffunction-sections' '-fdata-sections' '-funsigned-char' '-MMD' '-fno-delete-null-pointer-checks' '-fomit-frame-pointer' '-Os' '-g' '-D' 'MBED_TRAP_ERRORS_ENABLED=1' '-mcpu=cortex-m4' '-mthumb' '-mfpu=fpv4-sp-d16' '-mfloat-abi=softfp' ...

I previously had the same idea that perhaps i needed to replace the -mfloat-abi option by removing the existing one. So the first thing i did was see what flags were set in env[“CCFLAGS”] and env[“LINKFLAGS”] with the following code in the python script:

for item in sorted(env.Dictionary().items()):
    print("construction variable = '%s', value = '%s'" % item)

which gave the output:

construction variable = 'AR', value = 'ar'
construction variable = 'ARCOM', value = '$AR $ARFLAGS $TARGET ${_long_sources_hook(__env__, SOURCES)}'
construction variable = 'ARCOMSTR', value = 'Archiving $TARGET'
construction variable = 'ARFLAGS', value = 'rc'
construction variable = 'AS', value = 'as'
construction variable = 'ASCOM', value = '$AS $ASFLAGS -o $TARGET $SOURCES'
construction variable = 'ASCOMSTR', value = 'Compiling $TARGET'
construction variable = 'ASFLAGS', value = ''
construction variable = 'ASPPCOM', value = '$CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS ${_long_incflags_hook(__env__, _CPPINCFLAGS)} -c -o $TARGET $SOURCES'
construction variable = 'ASPPCOMSTR', value = 'Compiling $TARGET'
construction variable = 'ASPPFLAGS', value = '$ASFLAGS'
construction variable = 'BOARD', value = 'nrf52840_dk'
construction variable = 'BOARD_F_CPU', value = '64000000L'
construction variable = 'BOARD_MCU', value = 'nrf52840'
construction variable = 'BUILDERS', value = '{'StaticLibrary': <SCons.Builder.BuilderBase object at 0x7fc8f55a4a60>, 'Library': <SCons.Builder.BuilderBase object at 0x7fc8f55a4a60>, 'StaticObject': <SCons.Builder.CompositeBuilder object at 0x7fc8f55a4dc0>, 'Object': <SCons.Builder.CompositeBuilder object at 0x7fc8f55a4dc0>, 'SharedObject': <SCons.Builder.CompositeBuilder object at 0x7fc8f55a4fd0>, 'SharedLibrary': <SCons.Builder.BuilderBase object at 0x7fc8f55c3bb0>, 'Program': <SCons.Builder.BuilderBase object at 0x7fc8f55540d0>, 'LoadableModule': <SCons.Builder.BuilderBase object at 0x7fc8f5554730>}'
construction variable = 'BUILD_CACHE_DIR', value = 'None'
construction variable = 'BUILD_DIR', value = '$PROJECT_BUILD_DIR/$PIOENV'
construction variable = 'BUILD_FLAGS', value = '['-D__BUILD_TYPE__="release"', '-DPIO_FRAMEWORK_MBED_RTOS_PRESENT', '-Wl,-Map=$PROJECT_WORKSPACE_DIR/build/release/firmware.map', '-Ic:\\0_docs\\PIO/framework-mbed/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/modules/nrfx/drivers/include', '-L$PROJECT_WORKSPACE_DIR/build/release/FrameworkMbed/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/modules/nrfx/drivers/src', '-l:nrfx_systick.o', '-Llib/RTE_OFS', '-lOFS_0']'
construction variable = 'BUILD_SCRIPT', value = '/root/.platformio/platforms/nordicnrf52/builder/main.py'
construction variable = 'BUILD_SRC_DIR', value = '$BUILD_DIR/src'
construction variable = 'BUILD_TEST_DIR', value = '$BUILD_DIR/test'
construction variable = 'CC', value = 'cc'
construction variable = 'CCCOM', value = '$CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES'
construction variable = 'CCCOMSTR', value = 'Compiling $TARGET'
construction variable = 'CCFLAGS', value = ''
construction variable = 'CFILESUFFIX', value = '.c'
construction variable = 'CFLAGS', value = ''
construction variable = 'COMPILATIONDB_PATH', value = '$BUILD_DIR/compile_commands.json'
construction variable = 'CONFIGUREDIR', value = '#/.sconf_temp'
construction variable = 'CONFIGURELOG', value = '#/config.log'
construction variable = 'CPPDEFPREFIX', value = '-D'
construction variable = 'CPPDEFSUFFIX', value = ''
construction variable = 'CPPSUFFIXES', value = '['.c', '.C', '.cxx', '.cpp', '.c++', '.cc', '.h', '.H', '.hxx', '.hpp', '.hh', '.F', '.fpp', '.FPP', '.m', '.mm', '.S', '.spp', '.SPP', '.sx']'
construction variable = 'CXX', value = 'CC'
construction variable = 'CXXCOM', value = '$CXX -o $TARGET -c $CXXFLAGS $CCFLAGS $_CCCOMCOM $SOURCES'
construction variable = 'CXXCOMSTR', value = 'Compiling $TARGET'
construction variable = 'CXXFILESUFFIX', value = '.cc'
construction variable = 'CXXFLAGS', value = ''
construction variable = 'DSUFFIXES', value = '['.d']'
construction variable = 'Dir', value = '<SCons.Defaults.Variable_Method_Caller object at 0x7fc8f5d0e8e0>'
construction variable = 'Dirs', value = '<SCons.Defaults.Variable_Method_Caller object at 0x7fc8f5d0e940>'
construction variable = 'ENV', value = 'environ({'HOSTNAME': '61558a612e7c', 'PWD': '/root/Repos/Fuel_Sensor_Test/Door', 'TZ': 'Pacific/Auckland', 'HOME': '/root', 'TERM': 'xterm', 'SHLVL': '1', 'PATH': '/root/.platformio/packages/toolchain-gccarmnoneeabi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.platformio/penv/bin', '_': '/root/.platformio/penv/bin/pio', 'OLDPWD': '/home/sensorbuild', 'LC_CTYPE': 'C.UTF-8', 'PYTHONPATH': '/root/.platformio/penv/lib/python3.8/site-packages'})'
construction variable = 'ESCAPE', value = '<function escape at 0x7fc8f5a918b0>'
construction variable = 'FRAMEWORKPATH', value = ''
construction variable = 'FRAMEWORKS', value = ''
construction variable = 'File', value = '<SCons.Defaults.Variable_Method_Caller object at 0x7fc8f5d0e9a0>'
construction variable = 'HOST_ARCH', value = 'None'
construction variable = 'HOST_OS', value = 'None'
construction variable = 'IDLSUFFIXES', value = '['.idl', '.IDL']'
construction variable = 'INCPREFIX', value = '-I'
construction variable = 'INCSUFFIX', value = ''
construction variable = 'LDMODULE', value = '$SHLINK'
construction variable = 'LDMODULECOM', value = '$LDMODULE -o $TARGET $LDMODULEFLAGS $__LDMODULEVERSIONFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS'
construction variable = 'LDMODULEEMITTER', value = '[<function ldmod_emitter at 0x7fc8f55579d0>]'
construction variable = 'LDMODULEFLAGS', value = '$SHLINKFLAGS'
construction variable = 'LDMODULENOVERSIONSYMLINKS', value = '$SHLIBNOVERSIONSYMLINKS'
construction variable = 'LDMODULEPREFIX', value = '$SHLIBPREFIX'
construction variable = 'LDMODULESUFFIX', value = '$SHLIBSUFFIX'
construction variable = 'LDMODULEVERSION', value = '$SHLIBVERSION'
construction variable = 'LDSCRIPT_PATH', value = 'nrf52_xxaa.ld'
construction variable = 'LIBDIRPREFIX', value = '-L'
construction variable = 'LIBDIRSUFFIX', value = ''
construction variable = 'LIBLINKPREFIX', value = '-l'
construction variable = 'LIBLINKSUFFIX', value = ''
construction variable = 'LIBPATH', value = '['$BUILD_DIR']'
construction variable = 'LIBPREFIX', value = 'lib'
construction variable = 'LIBPREFIXES', value = '['$LIBPREFIX']'
construction variable = 'LIBSOURCE_DIRS', value = '['/root/Repos/Fuel_Sensor_Test/Door/lib', '$PROJECT_LIBDEPS_DIR/$PIOENV', '/root/.platformio/lib']'
construction variable = 'LIBSUFFIX', value = '.a'
construction variable = 'LIBSUFFIXES', value = '['$LIBSUFFIX', '$SHLIBSUFFIX']'
construction variable = 'LINK', value = '$SMARTLINK'
construction variable = 'LINKCOM', value = '$LINK -o $TARGET $LINKFLAGS $__RPATH ${_long_sources_hook(__env__, SOURCES)} $_LIBDIRFLAGS $_LIBFLAGS'
construction variable = 'LINKCOMSTR', value = 'Linking $TARGET'
construction variable = 'LINKFLAGS', value = ''
construction variable = 'MAXLINELENGTH', value = '128072'
construction variable = 'OBJPREFIX', value = ''
construction variable = 'OBJSUFFIX', value = '.o'
construction variable = 'PIOENV', value = 'release'
construction variable = 'PIOFRAMEWORK', value = '['mbed']'
construction variable = 'PIOPLATFORM', value = 'nordicnrf52'
construction variable = 'PLATFORM', value = 'posix'
construction variable = 'PLATFORM_MANIFEST', value = '/root/.platformio/platforms/nordicnrf52/platform.json'
construction variable = 'PROGNAME', value = 'program'
construction variable = 'PROGPREFIX', value = ''
construction variable = 'PROGSUFFIX', value = ''
construction variable = 'PROG_PATH', value = '$BUILD_DIR/$PROGNAME$PROGSUFFIX'
construction variable = 'PROJECTDATA_DIR', value = '/root/Repos/Fuel_Sensor_Test/Door/data'
construction variable = 'PROJECTSRC_DIR', value = '/root/Repos/Fuel_Sensor_Test/Door/src'
construction variable = 'PROJECT_BUILD_DIR', value = '/root/Repos/Fuel_Sensor_Test/Door/.pio/build'
construction variable = 'PROJECT_CONFIG', value = '/root/Repos/Fuel_Sensor_Test/Door/platformio.ini'
construction variable = 'PROJECT_CORE_DIR', value = '/root/.platformio'
construction variable = 'PROJECT_DATA_DIR', value = '/root/Repos/Fuel_Sensor_Test/Door/data'
construction variable = 'PROJECT_DIR', value = '/root/Repos/Fuel_Sensor_Test/Door'
construction variable = 'PROJECT_INCLUDE_DIR', value = '/root/Repos/Fuel_Sensor_Test/Door/include'
construction variable = 'PROJECT_LIBDEPS_DIR', value = '/root/Repos/Fuel_Sensor_Test/Door/.pio/libdeps'
construction variable = 'PROJECT_PACKAGES_DIR', value = '/root/.platformio/packages'
construction variable = 'PROJECT_SRC_DIR', value = '/root/Repos/Fuel_Sensor_Test/Door/src'
construction variable = 'PROJECT_TEST_DIR', value = '/root/Repos/Fuel_Sensor_Test/Door/test'
construction variable = 'PROJECT_WORKSPACE_DIR', value = '/root/Repos/Fuel_Sensor_Test/Door/.pio'
construction variable = 'PSPAWN', value = '<function piped_env_spawn at 0x7fc8f55ab4c0>'
construction variable = 'PYTHONEXE', value = '/root/.platformio/penv/bin/python'
construction variable = 'RANLIBCOMSTR', value = 'Indexing $TARGET'
construction variable = 'RDirs', value = '<SCons.Defaults.Variable_Method_Caller object at 0x7fc8f5d0ea00>'
construction variable = 'SCANNERS', value = '[<SCons.Scanner.Base object at 0x7fc8f5d06640>]'
construction variable = 'SHCC', value = '$CC'
construction variable = 'SHCCCOM', value = '$SHCC -o $TARGET -c $SHCFLAGS $SHCCFLAGS $_CCCOMCOM $SOURCES'
construction variable = 'SHCCFLAGS', value = '$CCFLAGS'
construction variable = 'SHCFLAGS', value = '$CFLAGS'
construction variable = 'SHCXX', value = '$CXX'
construction variable = 'SHCXXCOM', value = '$SHCXX -o $TARGET -c $SHCXXFLAGS $SHCCFLAGS $_CCCOMCOM $SOURCES'
construction variable = 'SHCXXFLAGS', value = '$CXXFLAGS'
construction variable = 'SHELL', value = 'sh'
construction variable = 'SHLIBEMITTER', value = '[<function shlib_emitter at 0x7fc8f5557940>]'
construction variable = 'SHLIBPREFIX', value = '$LIBPREFIX'
construction variable = 'SHLIBSUFFIX', value = '.so'
construction variable = 'SHLINK', value = '$LINK'
construction variable = 'SHLINKCOM', value = '$SHLINK -o $TARGET $SHLINKFLAGS $__SHLIBVERSIONFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS'
construction variable = 'SHLINKFLAGS', value = '$LINKFLAGS -shared'
construction variable = 'SHOBJPREFIX', value = '$OBJPREFIX'
construction variable = 'SHOBJSUFFIX', value = '.os'
construction variable = 'SMARTLINK', value = '<function smart_link at 0x7fc8f55493a0>'
construction variable = 'SPAWN', value = '<function subprocess_spawn at 0x7fc8f5a91c10>'
construction variable = 'SRC_FILTER', value = '['+<*>', '-<.git/>', '-<test/>', '-<OTA/boot/>', '-<OTA/test/>']'
construction variable = 'STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME', value = '0'
construction variable = 'TARGET_ARCH', value = 'None'
construction variable = 'TARGET_OS', value = 'None'
construction variable = 'TEMPFILE', value = '<class 'SCons.Platform.TempFileMunge'>'
construction variable = 'TEMPFILEARGJOIN', value = ' '
construction variable = 'TEMPFILEPREFIX', value = '@'
construction variable = 'TOOLS', value = '['ar', 'as', 'cc', 'c++', 'link', 'platformio', 'pioplatform', 'pioproject', 'piomaxlen', 'piolib', 'pioupload', 'piomisc', 'pioide', 'piosize']'
construction variable = 'UNIX_TIME', value = '1646252008'
construction variable = 'UPLOAD_PROTOCOL', value = 'jlink'
construction variable = '_CCCOMCOM', value = '$CPPFLAGS $_CPPDEFFLAGS ${_long_incflags_hook(__env__, _CPPINCFLAGS)}'
construction variable = '_CPPDEFFLAGS', value = '${_defines(CPPDEFPREFIX, CPPDEFINES, CPPDEFSUFFIX, __env__)}'
construction variable = '_CPPINCFLAGS', value = '$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)'
construction variable = '_LIBDIRFLAGS', value = '$( ${_concat(LIBDIRPREFIX, LIBPATH, LIBDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)'
construction variable = '_LIBFLAGS', value = '${_stripixes(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, LIBPREFIXES, LIBSUFFIXES, __env__)}'
construction variable = '__DRPATH', value = '$_DRPATH'
construction variable = '__DSHLIBVERSIONFLAGS', value = '${__libversionflags(__env__,"DSHLIBVERSION","_DSHLIBVERSIONFLAGS")}'
construction variable = '__LDMODULEVERSIONFLAGS', value = '${__libversionflags(__env__,"LDMODULEVERSION","_LDMODULEVERSIONFLAGS")}'
construction variable = '__RPATH', value = '$_RPATH'
construction variable = '__SHLIBVERSIONFLAGS', value = '${__libversionflags(__env__,"SHLIBVERSION","_SHLIBVERSIONFLAGS")}'
construction variable = '__libversionflags', value = '<function __libversionflags at 0x7fc8f5c95700>'
construction variable = '_concat', value = '<function _concat at 0x7fc8f5c95430>'
construction variable = '_defines', value = '<function _defines at 0x7fc8f5c95670>'
construction variable = '_long_incflags_hook', value = '<function long_incflags_hook at 0x7fc8f5562d30>'
construction variable = '_long_sources_hook', value = '<function long_sources_hook at 0x7fc8f5562ca0>'
construction variable = '_stripixes', value = '<function _stripixes at 0x7fc8f5c95550>'
construction variable = 'toolpath', value = '['/root/.platformio/penv/lib/python3.8/site-packages/platformio/builder/tools']'

Notice that CCFLAGS and LINKFLAGS are empty.
So it’s as if the -mfloat-abi build option isn’t coming specifically from these flags but from somewhere else?

I think that has to be a post: rather than pre: script so that the offending options can be removed.

Okay i’ve made the change from pre: to post: and it looks like that’s made a difference.

The third party library seems to link now without the “VFP register arguments” however, i am now getting the error for all the files in my application and some Mbed OS files which i wasn’t getting before eg:

/root/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: error: .pio/build/release/firmware.elf uses VFP register arguments, .pio/build/release/src/main.o does not
/root/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: failed to merge target specific data of file .pio/build/release/src/main.o

/root/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: error: .pio/build/release/firmware.elf uses VFP register arguments, /root/.platformio/packages/framework-mbed/features/cryptocell/FEATURE_CRYPTOCELL310/TARGET_MCU_NRF52840/TOOLCHAIN_GCC_ARM/libcc_310_ext.a(sns_silib.o) does not
/root/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /root/.platformio/packages/framework-mbed/features/cryptocell/FEATURE_CRYPTOCELL310/TARGET_MCU_NRF52840/TOOLCHAIN_GCC_ARM/libcc_310_ext.a(sns_silib.o)

Well looks like a deadlock to me if you have a library that is compiled with hardfloat and one with softfp and want link in both :confused:

But by setting -mfloat-abi=hard the way we are in the python script, aren’t we compiling my project (my application files and Mbed OS) with hardfloat such that it can match the third party library (confirmed third party library is built with hardfloat)?

^ shows that mbed-os again contains precompiled libraries that use softfp, if you can’t find these in hardfloat too, the whole thing can’t link as hardfloat.

Right, i see. That makes sense to me.
And what about my application files? Those are not precompiled libraries but have the same issue? Aren’t we compiling them with hardfloat?

/root/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: error: .pio/build/release/firmware.elf uses VFP register arguments, .pio/build/release/src/main.o does not
/root/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: failed to merge target specific data of file .pio/build/release/src/main.o