Skip to content

Commit 6341258

Browse files
agattidpgeorge
authored andcommitted
esp32/mpconfigport: Enable Zcmp opcodes for ESP32P4.
This commit enables support for Zcmp opcodes when the firmware is built to target ESP32P4 microcontrollers. The ESP32P4 explicitly supports the Zcmp extension for reducing the amount of code needed for function prologues and epilogues (see section 4.1.1.1 of the ESP32P4 datasheet). Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
1 parent ec5f2bc commit 6341258

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

ports/esp32/esp32_common.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,11 @@ set(MICROPY_TARGET ${COMPONENT_TARGET})
244244
if(CONFIG_IDF_TARGET_ARCH_XTENSA)
245245
set(MICROPY_CROSS_FLAGS -march=xtensawin)
246246
elseif(CONFIG_IDF_TARGET_ARCH_RISCV)
247-
set(MICROPY_CROSS_FLAGS -march=rv32imc)
247+
if (CONFIG_IDF_TARGET_ESP32P4)
248+
set(MICROPY_CROSS_FLAGS "-march=rv32imc -march-flags=zcmp")
249+
else()
250+
set(MICROPY_CROSS_FLAGS -march=rv32imc)
251+
endif()
248252
endif()
249253

250254
# Set compile options for this port.

ports/esp32/mpconfigport.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
#define MICROPY_EMIT_RV32 (0)
4545
#else
4646
#define MICROPY_EMIT_RV32 (1)
47+
#if CONFIG_IDF_TARGET_ESP32P4
48+
#define MICROPY_EMIT_RV32_ZCMP (1)
49+
#endif
4750
#endif
4851
#else
4952
#define MICROPY_EMIT_XTENSAWIN (1)

0 commit comments

Comments
 (0)