mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
feat(build): add RISC-V ZCMP post-link workaround check
Validate linked RISC-V executables when CONFIG_COMPILER_ENABLE_RISCV_ZCMP is enabled on affected chips. Disassemble each function and reject mstatus.MIE clears that lack an earlier mintthresh write of 0xff. Handle csrrci, csrrw, and register-mask csrrc patterns while ignoring csrrs. Add build-only coverage for valid and invalid sequences with CMake v1 and v2. Stop the hardware stack guard before switching stacks during restart, and keep ZCMP disabled for TEE test apps that still require the workaround.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -70,20 +70,6 @@ FORCE_INLINE_ATTR void restore_csr_enable_global_int(uint32_t mstatus_val, uint3
|
||||
#endif
|
||||
}
|
||||
|
||||
#if __riscv_zcmp && SOC_CPU_ZCMP_WORKAROUND
|
||||
FORCE_INLINE_ATTR uint32_t save_mintthresh_and_disable_global_int(void)
|
||||
{
|
||||
/* Due to the reason described in IDF-14279, when mie is set to 0, mintthresh needs to be set to 0xff. */
|
||||
// TODO: IDF-14279 DIG-661
|
||||
return RV_READ_MINTTHRESH_AND_DISABLE_INTR();
|
||||
}
|
||||
|
||||
FORCE_INLINE_ATTR void restore_mintthresh(uint32_t mintthresh_val)
|
||||
{
|
||||
RV_RESTORE_MINTTHRESH(mintthresh_val);
|
||||
}
|
||||
#endif
|
||||
|
||||
static IRAM_ATTR RvCoreNonCriticalSleepFrame * rv_core_noncritical_regs_save(void)
|
||||
{
|
||||
assert(s_cpu_retention.retent.non_critical_frame);
|
||||
|
||||
Reference in New Issue
Block a user