mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 04:02:27 +00:00
ulp-riscv: Added API ulp_riscv_reset to reset the ULP core
This commit adds a new API ulp_reisv_reset() to enable reseting of the ULP core from the main core. This is particularly necessary in case the ULP crashes due to any reason. Earlier the only way to recover the ULP was to do a power reset. This commit also adds new test cases which exercise this scenario.
This commit is contained in:
@@ -92,6 +92,15 @@ void ulp_riscv_timer_resume(void);
|
||||
*/
|
||||
void ulp_riscv_halt(void);
|
||||
|
||||
/**
|
||||
* @brief Resets the ULP-RISC-V core from the main CPU
|
||||
*
|
||||
* @note This will reset the ULP core from the main CPU. It is intended to be used when the
|
||||
* ULP is in a bad state and cannot run as intended due to a corrupt firmware or any other reason.
|
||||
* The main core can reset the ULP core with this API and then re-initilialize the ULP.
|
||||
*/
|
||||
void ulp_riscv_reset(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -142,6 +142,15 @@ void ulp_riscv_halt(void)
|
||||
SET_PERI_REG_MASK(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_SHUT_RESET_EN);
|
||||
}
|
||||
|
||||
void ulp_riscv_reset()
|
||||
{
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_SHUT | RTC_CNTL_COCPU_DONE);
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_SHUT_RESET_EN);
|
||||
esp_rom_delay_us(20);
|
||||
SET_PERI_REG_MASK(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_SHUT | RTC_CNTL_COCPU_DONE);
|
||||
SET_PERI_REG_MASK(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_SHUT_RESET_EN);
|
||||
}
|
||||
|
||||
esp_err_t ulp_riscv_load_binary(const uint8_t* program_binary, size_t program_size_bytes)
|
||||
{
|
||||
if (program_binary == NULL) {
|
||||
|
Reference in New Issue
Block a user