From a2433e06b653e0f9a47f17af0fef6bd4c5e90a4e Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Wed, 4 Dec 2024 12:05:58 +0100 Subject: [PATCH] cmake: removing manual linking of libgcc.a This commit removes the manual lookup and linking of libgcc.a. Linking of C and runtime libraries are the responsibility of the higher level build system which handles the toolchain and building of the executable. Current sidewalk implementation is broken in the sense that it fails to consider the CPU architecture and just looks up any libgcc.a file. For example the code might discover `arm-zephyr-eabi/12.2.0/libgcc.a` when instead `arm-zephyr-eabi/12.2.0/thumb/v8-m.main+fp/hard/libgcc.a` should be used, and thus causiong link errors such as: > error: /.../12.2.0/libgcc.a(_arm_muldf3.o): > conflicting CPU architectures 17/2 and: > error: zephyr/zephyr_pre0.elf uses VFP register arguments, > /.../12.2.0/libgcc.a(_fixunsdfdi.o) does not Signed-off-by: Torsten Rasmussen --- lib/cortex-m33/lora_fsk/CMakeLists.txt | 7 +------ lib/cortex-m4/lora_fsk/CMakeLists.txt | 6 +----- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/lib/cortex-m33/lora_fsk/CMakeLists.txt b/lib/cortex-m33/lora_fsk/CMakeLists.txt index fb27e88d9d..e6ec27bf93 100644 --- a/lib/cortex-m33/lora_fsk/CMakeLists.txt +++ b/lib/cortex-m33/lora_fsk/CMakeLists.txt @@ -6,11 +6,6 @@ set(SID_LIB_DIR ${ZEPHYR_BASE}/../sidewalk/lib/cortex-m33/lora_fsk) -set(GCC_LIB_DIR ${ZEPHYR_SDK_INSTALL_DIR}/arm-zephyr-eabi/lib/gcc/arm-zephyr-eabi) -find_library(LIB_GCC NAMES gcc libgcc.a HINTS ${GCC_LIB_DIR}/* REQUIRED) - -zephyr_library_link_libraries(${SID_LIB_DIR}/libsid_protocol_all.a - ${LIB_GCC} -) +zephyr_library_link_libraries(${SID_LIB_DIR}/libsid_protocol_all.a) zephyr_link_libraries_ifndef(CONFIG_SIDEWALK_PAL_RADIO_SOURCE ${SID_LIB_DIR}/libsid_pal_radio_sx126x_impl.a) diff --git a/lib/cortex-m4/lora_fsk/CMakeLists.txt b/lib/cortex-m4/lora_fsk/CMakeLists.txt index cd18d0db8d..8c94a09cf4 100644 --- a/lib/cortex-m4/lora_fsk/CMakeLists.txt +++ b/lib/cortex-m4/lora_fsk/CMakeLists.txt @@ -6,11 +6,7 @@ set(SID_LIB_DIR ${ZEPHYR_BASE}/../sidewalk/lib/cortex-m4/lora_fsk) -set(GCC_LIB_DIR ${ZEPHYR_SDK_INSTALL_DIR}/arm-zephyr-eabi/lib/gcc/arm-zephyr-eabi) -find_library(LIB_GCC NAMES gcc libgcc.a HINTS ${GCC_LIB_DIR}/* REQUIRED) -zephyr_library_link_libraries(${SID_LIB_DIR}/libsid_protocol_all.a - ${LIB_GCC} -) +zephyr_library_link_libraries(${SID_LIB_DIR}/libsid_protocol_all.a) zephyr_link_libraries_ifndef(CONFIG_SIDEWALK_PAL_RADIO_SOURCE ${SID_LIB_DIR}/libsid_pal_radio_sx126x_impl.a)