Skip to content

Commit

Permalink
Adding support for 0.18 zephyr sdk
Browse files Browse the repository at this point in the history
* Changes have been partly taken from here:
zephyrproject-rtos/zephyr@15c3776#diff-529decabf18d860968a987c34f75a7102c007194f1ee3a845fd6016b9b7538f7
* This is needed because of change to the folder structure:

Old: opt/zephyr-sdk/arm-zephyr-eabi
New: opt/zephyr-sdk/gnu/arm-zephyr-eabi
     opt/zephyr-sdk/llvm/arm-zephyr-eabi

This structure has been adapet from the zephyr toolchain install script.

Signed-off-by: Sebastian Wezel <[email protected]>
  • Loading branch information
DatGizmo committed Feb 18, 2025
1 parent 4789325 commit 5d4bed5
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cmake/modules/FindHostTools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ zephyr_file(APPLICATION_ROOT TOOLCHAIN_ROOT)

# Host-tools don't unconditionally set TOOLCHAIN_HOME anymore,
# but in case Zephyr's SDK toolchain is used, set TOOLCHAIN_HOME
if("${ZEPHYR_TOOLCHAIN_VARIANT}" STREQUAL "zephyr")
if("${ZEPHYR_TOOLCHAIN_VARIANT}" STREQUAL "zephyr-gnu")
set(TOOLCHAIN_HOME ${HOST_TOOLS_HOME})
endif()

Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/FindZephyr-sdk.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ endif()
# 1) Zephyr specified as toolchain (ZEPHYR_SDK_INSTALL_DIR still used if defined)
# 2) No toolchain specified == Default to Zephyr toolchain
# Until we completely deprecate it
if(("zephyr" STREQUAL ${ZEPHYR_TOOLCHAIN_VARIANT}) OR
if(("zephyr-gnu" STREQUAL ${ZEPHYR_TOOLCHAIN_VARIANT}) OR
(NOT DEFINED ZEPHYR_TOOLCHAIN_VARIANT) OR
(DEFINED ZEPHYR_SDK_INSTALL_DIR) OR
(Zephyr-sdk_FIND_REQUIRED))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: Apache-2.0

include(${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/generic.cmake)
include(${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/gnu/generic.cmake)

set(TOOLCHAIN_KCONFIG_DIR ${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr)

Expand Down
3 changes: 3 additions & 0 deletions cmake/toolchain/zephyr-gnu/target.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0

include(${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/gnu/target.cmake)
7 changes: 7 additions & 0 deletions cmake/toolchain/zephyr-llvm/generic.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-License-Identifier: Apache-2.0

include(${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/llvm/generic.cmake)

set(TOOLCHAIN_KCONFIG_DIR ${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr)

message(STATUS "Found toolchain: zephyr ${SDK_VERSION} (${ZEPHYR_SDK_INSTALL_DIR})")
3 changes: 3 additions & 0 deletions cmake/toolchain/zephyr-llvm/target.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0

include(${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/llvm/target.cmake)
3 changes: 0 additions & 3 deletions cmake/toolchain/zephyr/target.cmake

This file was deleted.

8 changes: 6 additions & 2 deletions modules/trusted-firmware-m/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,14 @@ if (CONFIG_BUILD_WITH_TFM)
# Get the toolchain variant
# TODO: Add support for cross-compile toolchain variant
# TODO: Enforce GCC version check against TF-M compiler requirements
if(${ZEPHYR_TOOLCHAIN_VARIANT} STREQUAL "zephyr")
if(${ZEPHYR_TOOLCHAIN_VARIANT} STREQUAL "zephyr-gnu")
set(TFM_TOOLCHAIN_FILE "toolchain_GNUARM.cmake")
set(TFM_TOOLCHAIN_PREFIX "arm-zephyr-eabi")
set(TFM_TOOLCHAIN_PATH ${ZEPHYR_SDK_INSTALL_DIR}/arm-zephyr-eabi/bin)
set(TFM_TOOLCHAIN_PATH ${ZEPHYR_SDK_INSTALL_DIR}/gnu/arm-zephyr-eabi/bin)
elseif(${ZEPHYR_TOOLCHAIN_VARIANT} STREQUAL "zephyr-llvm")
set(TFM_TOOLCHAIN_FILE "toolchain_GNUARM.cmake")
set(TFM_TOOLCHAIN_PREFIX "arm-zephyr-eabi")
set(TFM_TOOLCHAIN_PATH ${ZEPHYR_SDK_INSTALL_DIR}/llvm/bin)
elseif(${ZEPHYR_TOOLCHAIN_VARIANT} STREQUAL "gnuarmemb")
set(TFM_TOOLCHAIN_FILE "toolchain_GNUARM.cmake")
set(TFM_TOOLCHAIN_PREFIX "arm-none-eabi")
Expand Down

0 comments on commit 5d4bed5

Please sign in to comment.