Skip to content

Commit

Permalink
toolchain: xt-clang: enable support for newlib
Browse files Browse the repository at this point in the history
This sets the variable TOOLCHAIN_HAS_NEWLIB to true for
xt-clang so we can use the built-in newlib provided by
the Xtensa toolchain.

Note that C++ STL support with newlib is broken (same
as xcc), so exclude xt-clang from the libcxx tests
for now.

Signed-off-by: Daniel Leung <[email protected]>
  • Loading branch information
dcpleung committed Aug 2, 2023
1 parent bed34fc commit 9ee1fa3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
2 changes: 0 additions & 2 deletions cmake/toolchain/xcc/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,3 @@ set(SYSROOT_DIR ${TOOLCHAIN_HOME}/${SYSROOT_TARGET})
set(NOSYSDEF_CFLAG "")

list(APPEND TOOLCHAIN_C_FLAGS -fms-extensions)

set(TOOLCHAIN_HAS_NEWLIB OFF CACHE BOOL "True if toolchain supports newlib")
2 changes: 2 additions & 0 deletions cmake/toolchain/xcc/generic.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ list(APPEND TOOLCHAIN_C_FLAGS
set(CMAKE_ASM_COMPILER_ID "GNU")

message(STATUS "Found toolchain: xcc (${XTENSA_TOOLCHAIN_PATH})")

set(TOOLCHAIN_HAS_NEWLIB OFF CACHE BOOL "True if toolchain supports newlib")
8 changes: 8 additions & 0 deletions cmake/toolchain/xt-clang/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2023 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0

config TOOLCHAIN_XT_CLANG
def_bool y
select COMMON_LIBC_STRNLEN if NEWLIB_LIBC
select NEWLIB_LIBC_IN_TOOLCHAIN_IS_ANCIENT if NEWLIB_LIBC
2 changes: 2 additions & 0 deletions cmake/toolchain/xt-clang/generic.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ set(C++ clang++)
set(LINKER xt-ld)

message(STATUS "Found toolchain: xt-clang (${XTENSA_TOOLCHAIN_PATH})")

set(TOOLCHAIN_HAS_NEWLIB ON CACHE BOOL "True if toolchain supports newlib")
6 changes: 3 additions & 3 deletions tests/lib/cpp/libcxx/testcase.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
tests:
cpp.libcxx.glibcxx.newlib:
filter: TOOLCHAIN_HAS_NEWLIB == 1
toolchain_exclude: xcc
toolchain_exclude: xcc xt-clang
min_flash: 54
min_ram: 24
tags: cpp
Expand All @@ -13,7 +13,7 @@ tests:
- mps2_an385
cpp.libcxx.glibcxx.newlib_nano:
filter: TOOLCHAIN_HAS_NEWLIB == 1
toolchain_exclude: xcc
toolchain_exclude: xcc xt-clang
min_flash: 54
tags: cpp
timeout: 60
Expand All @@ -25,7 +25,7 @@ tests:
- mps2_an385
cpp.libcxx.glibcxx.picolibc:
filter: TOOLCHAIN_HAS_PICOLIBC == 1
toolchain_exclude: xcc
toolchain_exclude: xcc xt-clang
tags: cpp
timeout: 60
extra_configs:
Expand Down

0 comments on commit 9ee1fa3

Please sign in to comment.