Skip to content

Commit b6be487

Browse files
dcpleungkartben
authored andcommitted
xtensa: update HAL path for custom compilations
Xtensa arch layer has some custom compilation commands to generate the interrupt dispatchers and the core-isa* files. However, the include path to find core-isa.h does not work for Espressif ESP32. So update the mechanism to use correct path pointing to Espressif HAL when targeting ESP32 family SoCs. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
1 parent f8450e4 commit b6be487

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

arch/xtensa/core/CMakeLists.txt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ if("${ZEPHYR_TOOLCHAIN_VARIANT}" STREQUAL "xcc")
3939
zephyr_library_sources(xcc_stubs.c)
4040
endif()
4141

42+
# ...where to find core-isa.h for custom compilation commands below.
43+
if(CONFIG_SOC_FAMILY_ESPRESSIF_ESP32)
44+
set(XTENSA_CONFIG_HAL_INCLUDE_DIR
45+
-I${ZEPHYR_HAL_ESPRESSIF_MODULE_DIR}/components/xtensa/${CONFIG_SOC}/include
46+
)
47+
else()
48+
set(XTENSA_CONFIG_HAL_INCLUDE_DIR
49+
-I${ZEPHYR_XTENSA_MODULE_DIR}/zephyr/soc/${CONFIG_SOC}
50+
)
51+
endif()
52+
4253
add_subdirectory(startup)
4354

4455
# This produces a preprocessed and regenerated (in the sense of gcc
@@ -54,7 +65,7 @@ set(CORE_ISA_IN ${CMAKE_BINARY_DIR}/zephyr/include/generated/core-isa-dM.c)
5465
file(WRITE ${CORE_ISA_IN} "#include <xtensa/config/core-isa.h>\n")
5566
add_custom_command(OUTPUT ${CORE_ISA_DM}
5667
COMMAND ${CMAKE_C_COMPILER} -E -dM -U__XCC__ ${XTENSA_CORE_LOCAL_C_FLAG}
57-
-I${ZEPHYR_XTENSA_MODULE_DIR}/zephyr/soc/${CONFIG_SOC}
68+
${XTENSA_CONFIG_HAL_INCLUDE_DIR}
5869
-I${SOC_FULL_DIR}
5970
${CORE_ISA_IN} -o ${CORE_ISA_DM})
6071

@@ -98,7 +109,7 @@ set(HANDLERS ${CMAKE_BINARY_DIR}/zephyr/include/generated/xtensa_handlers)
98109
add_custom_command(
99110
OUTPUT ${HANDLERS}_tmp.c
100111
COMMAND ${CMAKE_C_COMPILER} -E -U__XCC__
101-
-I${ZEPHYR_XTENSA_MODULE_DIR}/zephyr/soc/${CONFIG_SOC}
112+
${XTENSA_CONFIG_HAL_INCLUDE_DIR}
102113
-o ${HANDLERS}_tmp.c
103114
- < ${CMAKE_CURRENT_SOURCE_DIR}/xtensa_intgen.tmpl)
104115

0 commit comments

Comments
 (0)