I am building a project with an STM32L4 on a custom board, and trying to use the Bosch BSEC library.
I’ve managed to build and upload and run bsec_get_version(), but only for the M4 version of the library, not the M4F.
I’ve read this post, which had similar issue.
From this post I’ve learned that an extra script is needed to add compiler and linker flags so the hardware FPU gets enabled. As my MCU is a cortex M4F (unlike the M7 of the topic mentioned), I’ve added the code below to an extra script fpuflags.py and added it to platformio.ini extra_scripts.
Import("env")
Import("projenv")
for e in [env, projenv, DefaultEnvironment()]:
e.Append(
CCFLAGS=[
"-mfloat-abi=hard",
"-mfpu=fpv4-sp-d16",
],
LINKFLAGS=[
"-mfloat-abi=hard",
"-mfpu=fpv4-sp-d16",
]
)
but this brings me back to the error like error: .pio\build\target\firmware.elf uses VFP register arguments, .pio\build\target\lib3b6\libuart1.a(uart1.o) does not
So now things are building properly locally, but the build on github actions workflow still fails at the linker…
cannot find -lalgobsec ??
Linking .pio/build/production/firmware.elf
/home/runner/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: cannot find -lalgobsec
collect2: error: ld returned 1 exit status
I have checked uppercase/lowercase problems (as my pc is windows, and the github actions runner is linux), but seems ok.
It’s not a huge problem, as the builds work fine locally, so I can proceed with the development, but it would be nice to stick to the standard workflow that I use, and that builds the production binaries in the CI/CD workflow.