I am working on nrf5340 DK using segger embedded studio. Using peripheral_uart example and i added SPI interface code. I need to integrate ICM20948 library to this application. Added all icm20948 related source code in CMakeList.txt ( Inside peripheral uart folder ). But while compiling getting undefined reference to 'sqrt' error. These function actually using in Icm20948DataConverter.c file inside ICM20948 library.
I am attaching modified CMakeList.txt
#
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
cmake_minimum_required(VERSION 3.20.0)
set(PM_STATIC_YML_FILE
${CMAKE_CURRENT_SOURCE_DIR}/boards/pm_static_${BOARD}.yml
)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(NONE)
# NORDIC SDK APP START
target_sources(app PRIVATE
src/main.c
)
target_sources(app PRIVATE
scs/sh_sensor.c
)
target_sources(app PRIVATE
src/icm_spi.c
../../../../thirdparty/eMD/EMD-Core/sources/Invn/Devices/Drivers/ICM20948/Icm20948Setup.c
../../../../thirdparty/eMD/EMD-Core/sources/Invn/Devices/Drivers/ICM20948/Icm20948DataBaseDriver.c
../../../../thirdparty/eMD/EMD-Core/sources/Invn/Devices/Drivers/ICM20948/Icm20948Transport.c
../../../../thirdparty/eMD/EMD-Core/sources/Invn/Devices/Drivers/ICM20948/Icm20948AuxCompassAkm.c
../../../../thirdparty/eMD/EMD-Core/sources/Invn/Devices/Drivers/ICM20948/Icm20948Augmented.c
../../../../thirdparty/eMD/EMD-Core/sources/Invn/Devices/Drivers/ICM20948/Icm20948AuxTransport.c
../../../../thirdparty/eMD/EMD-Core/sources/Invn/Devices/Drivers/ICM20948/Icm20948DataBaseControl.c
../../../../thirdparty/eMD/EMD-Core/sources/Invn/Devices/Drivers/ICM20948/Icm20948Dmp3Driver.c
../../../../thirdparty/eMD/EMD-Core/sources/Invn/Devices/Drivers/ICM20948/Icm20948LoadFirmware.c
../../../../thirdparty/eMD/EMD-Core/sources/Invn/Devices/Drivers/ICM20948/Icm20948MPUFifoControl.c
../../../../thirdparty/eMD/EMD-Core/sources/Invn/Devices/Drivers/ICM20948/Icm20948DataConverter.c
../../../../thirdparty/eMD/EMD-Core/sources/Invn/Devices/Drivers/ICM20948/Icm20948SelfTest.c
../../../../thirdparty/eMD/EMD-Core/sources/Invn/DynamicProtocol/DynProtocol.c
../../../../thirdparty/eMD/EMD-Core/sources/Invn/DynamicProtocol/DynProtocolTransportUart.c
../../../../thirdparty/eMD/EMD-Core/sources/Invn/EmbUtils/DataConverter.c
../../../../thirdparty/eMD/EMD-Core/sources/Invn/EmbUtils/InvScheduler.c
../../../../thirdparty/eMD/EMD-Core/sources/Invn/Devices/Sensor.c
)
# Include UART ASYNC API adapter
target_sources_ifdef(CONFIG_BT_NUS_UART_ASYNC_ADAPTER app PRIVATE
src/uart_async_adapter.c
)
# Preinitialization related to Thingy:53 DFU
target_sources_ifdef(CONFIG_BOARD_THINGY53_NRF5340_CPUAPP app PRIVATE
boards/thingy53.c
)
target_sources_ifdef(CONFIG_BOARD_THINGY53_NRF5340_CPUAPP_NS app PRIVATE
boards/thingy53.c
)
# NORDIC SDK APP END
zephyr_library_include_directories(.)
Pls help me to solve this issue!
Note: SPI is working and ICM20948 library integration also working fine , i am getting all sensor data. Only issue is undefined reference to 'sqrtf' , 'cosf when iam calling some API,s. I think its because of math.h library linking issue. I don't know how to link standard library in CMakeList.txt ,