summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Gatti <a.gatti@frob.it>2025-12-11 03:42:33 +0100
committerDamien George <damien@micropython.org>2025-12-19 17:06:53 +1100
commit634125820744efa33679fb95a6e441dadaa4f6a7 (patch)
tree340d5b753fd9e4593c76e04290d2b4f38404d790
parentec5f2bc686a51aad903518c0f84d7d39d3b3432c (diff)
esp32/mpconfigport: Enable Zcmp opcodes for ESP32P4.HEADorigin/masterorigin/HEADmaster
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>
-rw-r--r--ports/esp32/esp32_common.cmake6
-rw-r--r--ports/esp32/mpconfigport.h3
2 files changed, 8 insertions, 1 deletions
diff --git a/ports/esp32/esp32_common.cmake b/ports/esp32/esp32_common.cmake
index e3b1b81ca..ea60c395a 100644
--- a/ports/esp32/esp32_common.cmake
+++ b/ports/esp32/esp32_common.cmake
@@ -244,7 +244,11 @@ set(MICROPY_TARGET ${COMPONENT_TARGET})
if(CONFIG_IDF_TARGET_ARCH_XTENSA)
set(MICROPY_CROSS_FLAGS -march=xtensawin)
elseif(CONFIG_IDF_TARGET_ARCH_RISCV)
- set(MICROPY_CROSS_FLAGS -march=rv32imc)
+ if (CONFIG_IDF_TARGET_ESP32P4)
+ set(MICROPY_CROSS_FLAGS "-march=rv32imc -march-flags=zcmp")
+ else()
+ set(MICROPY_CROSS_FLAGS -march=rv32imc)
+ endif()
endif()
# Set compile options for this port.
diff --git a/ports/esp32/mpconfigport.h b/ports/esp32/mpconfigport.h
index 55503ff0b..69419ce00 100644
--- a/ports/esp32/mpconfigport.h
+++ b/ports/esp32/mpconfigport.h
@@ -44,6 +44,9 @@
#define MICROPY_EMIT_RV32 (0)
#else
#define MICROPY_EMIT_RV32 (1)
+#if CONFIG_IDF_TARGET_ESP32P4
+#define MICROPY_EMIT_RV32_ZCMP (1)
+#endif
#endif
#else
#define MICROPY_EMIT_XTENSAWIN (1)