Skip to content

Commit

Permalink
cmake: removing manual linking of libgcc.a
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
tejlmand authored and carlescufi committed Dec 4, 2024
1 parent 5131d3d commit a2433e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
7 changes: 1 addition & 6 deletions lib/cortex-m33/lora_fsk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
6 changes: 1 addition & 5 deletions lib/cortex-m4/lora_fsk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit a2433e0

Please sign in to comment.