05-16-2020 12:37 AM
I tried implementing the BSEC library in NRF52 sdk on NRF52840. But I get a lot of linker errors like the one below.
Severity Code Description Project File Line Suppression State
Error Debug/nrf52840_xxaa.out uses VFP register arguments, C:/Users/Corne/source/repos/SensorNodeNRF/BME680/libalgobsec.a(bsec_interface.o) does not SensorNodeNRF d:\work\tools\arm_gnu\arm-none-eabi\bin\ld.exe 1
I tried a few settings with the floating point support settings. But no succes.
What can I try to get this working?
Corné
Solved! Go to Solution.
05-18-2020 05:21 AM
You can also refer to the following link for this error:
which means the -mfloat-abi compiling option is different in SDK and our library, you can have a try on modifying this part. Below is the compiling options for our library.
GCC_CFLAGS_M4 = -c -std=c99 -mcpu=cortex-m4 -mthumb -O2 -fdata-sections -fno-builtin -fno-common
GCC_CFLAGS_M4_FPU = -c -std=c99 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O2 -mthumb -mabi=aapcs -fdata-sections -fno-builtin -fno-common
05-18-2020 11:56 AM
Thanks for the reply, but i still have no succes when adding these flags. This is the first time for me to directly edit the makefile so this is all a bit new to me.
As far as I can see the makefile I have as below should be similar to the lines you posted. I also tried adding the lines to the makefile but this gives the same errors. Can you see anything I need to change in the settings bellow.
# Optimization flags
OPT = -Os -ggdb3
# Uncomment the line below to enable link time optimization
#OPT += -flto
# C flags common to all targets
CFLAGS += $(OPT)
CFLAGS += -DAPP_TIMER_V2
CFLAGS += -DAPP_TIMER_V2_RTC1_ENABLED
CFLAGS += -DBOARD_PCA10056
CFLAGS += -DCONFIG_GPIO_AS_PINRESET
CFLAGS += -DENABLE_FEM
CFLAGS += -DFLOAT_ABI_HARD
CFLAGS += -DNRF52840_XXAA
CFLAGS += -DZB_ED_ROLE
CFLAGS += -DZB_TRACE_LEVEL=0
CFLAGS += -DZB_TRACE_MASK=0
CFLAGS += -mcpu=cortex-m4
CFLAGS += -mthumb -mabi=aapcs
CFLAGS += -Wall -Werror
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
# keep every function in a separate section, this allows linker to discard unused ones
CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
CFLAGS += -fno-builtin -fshort-enums -Wno-packed-bitfield-compat
# C++ flags common to all targets
CXXFLAGS += $(OPT)
# Assembler flags common to all targets
ASMFLAGS += -ggdb3
ASMFLAGS += -mcpu=cortex-m4
ASMFLAGS += -mthumb -mabi=aapcs
ASMFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
ASMFLAGS += -DAPP_TIMER_V2
ASMFLAGS += -DAPP_TIMER_V2_RTC1_ENABLED
ASMFLAGS += -DBOARD_PCA10056
ASMFLAGS += -DCONFIG_GPIO_AS_PINRESET
ASMFLAGS += -DENABLE_FEM
ASMFLAGS += -DFLOAT_ABI_HARD
ASMFLAGS += -DNRF52840_XXAA
ASMFLAGS += -DZB_ED_ROLE
# Linker flags
LDFLAGS += $(OPT)
LDFLAGS += -mthumb -mabi=aapcs -L$(SDK_ROOT)/modules/nrfx/mdk -T$(LINKER_SCRIPT)
LDFLAGS += -mcpu=cortex-m4
LDFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
# let linker dump unused sections
LDFLAGS += -Wl,--gc-sections
# use newlib in nano version
LDFLAGS += --specs=nano.specs
05-18-2020 03:53 PM
In BSEC's release package, you can find two folders for the Cortex M4 and GCC compiler: Cortex_M4F which supports hard FPU, and Cortex_M4 which supports soft FPU. Could it be that you need to import the libalgobsec.a file from the appropriate folder matching your project's settings?
05-18-2020 07:13 PM
Ok thats where I went wrong, thanks for pointing out my mistake.