mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
fix(esp_hw_support): guard CSR_PRV_MODE usage in esp_cpu_get_curr_privilege_level
CSR_PRV_MODE is only defined for a subset of RISC-V targets. Targets that lack it (e.g. esp32h21, esp32h4, esp32s31) caused an assembler error. Fall back to returning -1 (unsupported) when the CSR is not defined. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -154,8 +154,10 @@ FORCE_INLINE_ATTR __attribute__((always_inline)) int esp_cpu_get_curr_privilege_
|
||||
#else
|
||||
#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C2
|
||||
return PRV_M;
|
||||
#else
|
||||
#elif defined(CSR_PRV_MODE)
|
||||
return RV_READ_CSR(CSR_PRV_MODE);
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user