Skip to content

Commit 9a04b23

Browse files
committed
ThreadX: Add xtensa.cmake
1 parent 03361ee commit 9a04b23

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

cmake/xtensa.cmake

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
set(CMAKE_SYSTEM_NAME Generic)
2+
set(CMAKE_SYSTEM_PROCESSOR xtensa)
3+
4+
set(CMAKE_C_COMPILER xt-clang)
5+
set(CMAKE_CXX_COMPILER xt-clang++)
6+
set(AS xt-clang)
7+
set(AR xt-ar)
8+
set(OBJCOPY xt-objcopy)
9+
set(OBJDUMP xt-objdump)
10+
set(SIZE xt-size)
11+
12+
set(THREADX_ARCH "xtensa")
13+
set(THREADX_TOOLCHAIN "xcc")
14+
15+
if (DEFINED ENV{XCC_OPTS})
16+
set(XCC_OPTS $ENV{XCC_OPTS})
17+
else()
18+
set(XCC_OPTS "")
19+
endif()
20+
21+
set(XCC_FLAGS "${XCC_OPTS} -mlongcalls -mno-l32r-flix -mno-coproc -Wall -Wextra -Werror")
22+
23+
set(CMAKE_C_FLAGS "${XCC_FLAGS} -Os -g" CACHE INTERNAL "c compiler flags")
24+
set(CMAKE_CXX_FLAGS "${XCC_FLAGS} -Os -g -fno-rtti -fno-exceptions" CACHE INTERNAL "cxx compiler flags")
25+
set(CMAKE_ASM_FLAGS "${XCC_FLAGS} -Os -g" CACHE INTERNAL "asm compiler flags")
26+
set(CMAKE_EXE_LINKER_FLAGS "${XCC_FLAGS} ${LD_FLAGS} -Wl,--gc-sections" CACHE INTERNAL "exe link flags")
27+
28+
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g" CACHE INTERNAL "c debug compiler flags")
29+
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g" CACHE INTERNAL "cxx debug compiler flags")
30+
SET(CMAKE_ASM_FLAGS_DEBUG "-O0 -g" CACHE INTERNAL "asm debug compiler flags")
31+
32+
SET(CMAKE_C_FLAGS_RELEASE "-Os -g" CACHE INTERNAL "c release compiler flags")
33+
SET(CMAKE_CXX_FLAGS_RELEASE "-Os -g" CACHE INTERNAL "cxx release compiler flags")
34+
SET(CMAKE_ASM_FLAGS_RELEASE "-Os -g" CACHE INTERNAL "asm release compiler flags")
35+
36+
# this makes the test compiles use static library option so that we don't need to pre-set linker flags and scripts
37+
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)

0 commit comments

Comments
 (0)