Skip to content

Commit e0b6934

Browse files
committed
Merge branch 'feature/enable_zc_extensions_for_esp32p4' into 'master'
feat(tools): enable zc* extensions for esp32p4 revision >= 3.0 See merge request espressif/esp-idf!42166
2 parents 050de89 + d081549 commit e0b6934

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

components/esp_hw_support/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,12 @@ endif()
193193

194194
if(CONFIG_ESP32P4_SELECTS_REV_LESS_V3)
195195
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
196-
idf_build_set_property(COMPILE_OPTIONS "-mespv-spec=2p1" APPEND)
196+
# 1. Set xespv2p1 explicitly to override the default xespv2p2.
197+
# 2. Remove zc* extensions:
198+
# The ESP32-P4 has always supported the zc* extensions,
199+
# but revisions earlier than v3.0 are affected by hardware issue DIG-661
200+
# and lack the mintthresh_csr register needed for the workaround.
201+
idf_build_set_property(COMPILE_OPTIONS "-march=rv32imafc_zicsr_zifencei_zaamo_zalrsc_xesploop_xespv2p1" APPEND)
197202
endif()
198203
elseif(CONFIG_IDF_TARGET_ESP32P4)
199204
if(CMAKE_C_COMPILER_ID MATCHES "Clang") # TODO: LLVM-478

tools/cmake/toolchain-esp32p4.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ set(CMAKE_CXX_COMPILER riscv32-esp-elf-g++)
77
set(CMAKE_ASM_COMPILER riscv32-esp-elf-gcc)
88
set(_CMAKE_TOOLCHAIN_PREFIX riscv32-esp-elf-)
99

10-
set(_CMAKE_TOOLCHAIN_COMMON_FLAGS "-march=rv32imafc_zicsr_zifencei_zaamo_zalrsc_xespv_xesploop -mabi=ilp32f")
10+
set(_CMAKE_TOOLCHAIN_COMMON_FLAGS "-march=rv32imafc_zicsr_zifencei_zaamo_zalrsc_zcb_zcmp_zcmt_xesploop_xespv \
11+
-mabi=ilp32f \
12+
-mno-cm-popret -mno-cm-push-reverse")
1113

1214
remove_duplicated_flags("${_CMAKE_TOOLCHAIN_COMMON_FLAGS} -mtune=esp-base ${CMAKE_C_FLAGS}" UNIQ_CMAKE_C_FLAGS)
1315
set(CMAKE_C_FLAGS "${UNIQ_CMAKE_C_FLAGS}" CACHE STRING "C Compiler Base Flags" FORCE)

0 commit comments

Comments
 (0)