-
Notifications
You must be signed in to change notification settings - Fork 120
Expand file tree
/
Copy pathesp32_toolchain.cmake.in
More file actions
48 lines (37 loc) · 1.7 KB
/
Copy pathesp32_toolchain.cmake.in
File metadata and controls
48 lines (37 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
include(CMakeForceCompiler)
set(CMAKE_SYSTEM_NAME Generic)
set(idf_target "@IDF_TARGET@")
set(idf_path "@IDF_PATH@")
set(RISCV_TARGETS "esp32c3" "esp32c6")
if("${idf_target}" IN_LIST RISCV_TARGETS)
set(CMAKE_SYSTEM_PROCESSOR riscv)
set(FLAGS "-ffunction-sections -fdata-sections" CACHE STRING "" FORCE)
else()
set(CMAKE_SYSTEM_PROCESSOR xtensa)
set(FLAGS "-mlongcalls -ffunction-sections -fdata-sections" CACHE STRING "" FORCE)
endif()
include("@BUILD_CONFIG_DIR@/sdkconfig.cmake" OPTIONAL)
if(CONFIG_LIBC_PICOLIBC)
set(FLAGS "${FLAGS} --specs=picolibc.specs" CACHE STRING "" FORCE)
# `__STDC_WANT_LIB_EXT1__` (C11 Annex K) is only implemented by picolibc.
# Temporary workaround for ros2/rcutils#552. Remove this once micro-ROS/rcutils picks up ros2/rcutils#555
add_compile_definitions(__STDC_WANT_LIB_EXT1__=1)
endif()
set(CMAKE_CROSSCOMPILING 1)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
set(PLATFORM_NAME "LwIP")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_C_COMPILER @CMAKE_C_COMPILER@)
set(CMAKE_CXX_COMPILER @CMAKE_CXX_COMPILER@)
if(NOT MICROROS_TOOLCHAIN_FLAGS_APPLIED)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS} ${IDF_INCLUDES}" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti ${FLAGS} ${IDF_INCLUDES}" CACHE STRING "" FORCE)
set(MICROROS_TOOLCHAIN_FLAGS_APPLIED TRUE CACHE INTERNAL "micro-ROS toolchain flags were applied")
endif()
add_compile_definitions(ESP_PLATFORM LWIP_IPV4 LWIP_IPV6 PLATFORM_NAME_FREERTOS)
include_directories(
"@BUILD_CONFIG_DIR@"
${idf_path}/components/soc/${idf_target}/include
)