Merge branch 'bugfix/update_esp_rom_rtc_header' into 'master'

update esp rom rtc header

See merge request espressif/esp-idf!21802
This commit is contained in:
Jiang Guang Ming
2022-12-29 18:16:13 +08:00
13 changed files with 92 additions and 134 deletions

View File

@@ -219,9 +219,15 @@ static void __attribute__((section(".rtc.entry.text"))) esp_wake_stub_entry(void
{ {
#define _SYM2STR(s) # s #define _SYM2STR(s) # s
#define SYM2STR(s) _SYM2STR(s) #define SYM2STR(s) _SYM2STR(s)
#ifdef __riscv
__asm__ __volatile__ ("call " SYM2STR(esp_wake_stub_start) "\n");
#else
// call4 has a larger effective addressing range (-524284 to 524288 bytes), // call4 has a larger effective addressing range (-524284 to 524288 bytes),
// which is sufficient for instruction addressing in RTC fast memory. // which is sufficient for instruction addressing in RTC fast memory.
__asm__ __volatile__ ("call4 " SYM2STR(esp_wake_stub_start) "\n"); __asm__ __volatile__ ("call4 " SYM2STR(esp_wake_stub_start) "\n");
#endif
} }
#endif // SOC_PM_SUPPORT_DEEPSLEEP_CHECK_STUB_ONLY #endif // SOC_PM_SUPPORT_DEEPSLEEP_CHECK_STUB_ONLY

View File

@@ -161,17 +161,6 @@ RESET_REASON rtc_get_reset_reason(int cpu_no);
*/ */
WAKEUP_REASON rtc_get_wakeup_cause(void); WAKEUP_REASON rtc_get_wakeup_cause(void);
/**
* @brief Get CRC for Fast RTC Memory.
*
* @param uint32_t start_addr : 0 - 0x7ff for Fast RTC Memory.
*
* @param uint32_t crc_len : 0 - 0x7ff, 0 for 4 byte, 0x7ff for 0x2000 byte.
*
* @return uint32_t : CRC32 result
*/
uint32_t calc_rtc_memory_crc(uint32_t start_addr, uint32_t crc_len);
/** /**
* @brief Suppress ROM log by setting specific RTC control register. * @brief Suppress ROM log by setting specific RTC control register.
* @note This is not a permanent disable of ROM logging since the RTC register can not retain after chip reset. * @note This is not a permanent disable of ROM logging since the RTC register can not retain after chip reset.
@@ -190,26 +179,6 @@ static inline void rtc_suppress_rom_log(void)
REG_SET_BIT(RTC_CNTL_STORE4_REG, RTC_DISABLE_ROM_LOG); REG_SET_BIT(RTC_CNTL_STORE4_REG, RTC_DISABLE_ROM_LOG);
} }
/**
* @brief Set CRC of Fast RTC memory 0-0x7ff into RTC STORE7.
*
* @param None
*
* @return None
*/
void set_rtc_memory_crc(void);
/**
* @brief Fetch entry from RTC memory and RTC STORE reg
*
* @param uint32_t * entry_addr : the address to save entry
*
* @param RESET_REASON reset_reason : reset reason this time
*
* @return None
*/
void rtc_boot_control(uint32_t *entry_addr, RESET_REASON reset_reason);
/** /**
* @brief Software Reset digital core. * @brief Software Reset digital core.
* *

View File

@@ -4,10 +4,7 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#ifndef _ROM_RTC_H_ #pragma once
#define _ROM_RTC_H_
#include "ets_sys.h"
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
@@ -67,7 +64,6 @@ extern "C" {
#define RTC_DISABLE_ROM_LOG ((1 << 0) | (1 << 16)) //!< Disable logging from the ROM code. #define RTC_DISABLE_ROM_LOG ((1 << 0) | (1 << 16)) //!< Disable logging from the ROM code.
typedef enum { typedef enum {
AWAKE = 0, //<CPU ON AWAKE = 0, //<CPU ON
LIGHT_SLEEP = BIT0, //CPU waiti, PLL ON. We don't need explicitly set this mode. LIGHT_SLEEP = BIT0, //CPU waiti, PLL ON. We don't need explicitly set this mode.
@@ -172,16 +168,31 @@ RESET_REASON rtc_get_reset_reason(int cpu_no);
*/ */
WAKEUP_REASON rtc_get_wakeup_cause(void); WAKEUP_REASON rtc_get_wakeup_cause(void);
typedef void (* esp_rom_wake_func_t)(void);
/** /**
* @brief Get CRC for Fast RTC Memory. * @brief Read stored RTC wake function address
* *
* @param uint32_t start_addr : 0 - 0x7ff for Fast RTC Memory. * Returns pointer to wake address if a value is set in RTC registers, and stored length & CRC all valid.
* *
* @param uint32_t crc_len : 0 - 0x7ff, 0 for 4 byte, 0x7ff for 0x2000 byte. * @param None
* *
* @return uint32_t : CRC32 result * @return esp_rom_wake_func_t : Returns pointer to wake address if a value is set in RTC registers
*/ */
uint32_t calc_rtc_memory_crc(uint32_t start_addr, uint32_t crc_len); esp_rom_wake_func_t esp_rom_get_rtc_wake_addr(void);
/**
* @brief Store new RTC wake function address
*
* Set a new RTC wake address function. If a non-NULL function pointer is set then the function
* memory is calculated and stored also.
*
* @param entry_addr Address of function. If NULL, length is ignored and all registers are cleared to 0.
* @param length of function in RTC fast memory. cannot be larger than RTC Fast memory size.
*
* @return None
*/
void esp_rom_set_rtc_wake_addr(esp_rom_wake_func_t entry_addr, size_t length);
/** /**
* @brief Suppress ROM log by setting specific RTC control register. * @brief Suppress ROM log by setting specific RTC control register.
@@ -201,26 +212,6 @@ static inline void rtc_suppress_rom_log(void)
REG_SET_BIT(LP_AON_STORE4_REG, RTC_DISABLE_ROM_LOG); REG_SET_BIT(LP_AON_STORE4_REG, RTC_DISABLE_ROM_LOG);
} }
/**
* @brief Set CRC of Fast RTC memory 0-0x7ff into RTC STORE7.
*
* @param None
*
* @return None
*/
void set_rtc_memory_crc(void);
/**
* @brief Fetch entry from RTC memory and RTC STORE reg
*
* @param uint32_t * entry_addr : the address to save entry
*
* @param RESET_REASON reset_reason : reset reason this time
*
* @return None
*/
void rtc_boot_control(uint32_t *entry_addr, RESET_REASON reset_reason);
/** /**
* @brief Software Reset digital core. * @brief Software Reset digital core.
* *
@@ -252,5 +243,3 @@ void software_reset_cpu(int cpu_no);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* _ROM_RTC_H_ */

View File

@@ -4,10 +4,7 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#ifndef _ROM_RTC_H_ #pragma once
#define _ROM_RTC_H_
#include "ets_sys.h"
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
@@ -67,7 +64,6 @@ extern "C" {
#define RTC_DISABLE_ROM_LOG ((1 << 0) | (1 << 16)) //!< Disable logging from the ROM code. #define RTC_DISABLE_ROM_LOG ((1 << 0) | (1 << 16)) //!< Disable logging from the ROM code.
typedef enum { typedef enum {
AWAKE = 0, //<CPU ON AWAKE = 0, //<CPU ON
LIGHT_SLEEP = BIT0, //CPU waiti, PLL ON. We don't need explicitly set this mode. LIGHT_SLEEP = BIT0, //CPU waiti, PLL ON. We don't need explicitly set this mode.
@@ -173,16 +169,31 @@ RESET_REASON rtc_get_reset_reason(int cpu_no);
*/ */
WAKEUP_REASON rtc_get_wakeup_cause(void); WAKEUP_REASON rtc_get_wakeup_cause(void);
typedef void (* esp_rom_wake_func_t)(void);
/** /**
* @brief Get CRC for Fast RTC Memory. * @brief Read stored RTC wake function address
* *
* @param uint32_t start_addr : 0 - 0x7ff for Fast RTC Memory. * Returns pointer to wake address if a value is set in RTC registers, and stored length & CRC all valid.
* *
* @param uint32_t crc_len : 0 - 0x7ff, 0 for 4 byte, 0x7ff for 0x2000 byte. * @param None
* *
* @return uint32_t : CRC32 result * @return esp_rom_wake_func_t : Returns pointer to wake address if a value is set in RTC registers
*/ */
uint32_t calc_rtc_memory_crc(uint32_t start_addr, uint32_t crc_len); esp_rom_wake_func_t esp_rom_get_rtc_wake_addr(void);
/**
* @brief Store new RTC wake function address
*
* Set a new RTC wake address function. If a non-NULL function pointer is set then the function
* memory is calculated and stored also.
*
* @param entry_addr Address of function. If NULL, length is ignored and all registers are cleared to 0.
* @param length of function in RTC fast memory. cannot be larger than RTC Fast memory size.
*
* @return None
*/
void esp_rom_set_rtc_wake_addr(esp_rom_wake_func_t entry_addr, size_t length);
/** /**
* @brief Suppress ROM log by setting specific RTC control register. * @brief Suppress ROM log by setting specific RTC control register.
@@ -202,26 +213,6 @@ static inline void rtc_suppress_rom_log(void)
REG_SET_BIT(LP_AON_STORE4_REG, RTC_DISABLE_ROM_LOG); REG_SET_BIT(LP_AON_STORE4_REG, RTC_DISABLE_ROM_LOG);
} }
/**
* @brief Set CRC of Fast RTC memory 0-0x7ff into RTC STORE7.
*
* @param None
*
* @return None
*/
void set_rtc_memory_crc(void);
/**
* @brief Fetch entry from RTC memory and RTC STORE reg
*
* @param uint32_t * entry_addr : the address to save entry
*
* @param RESET_REASON reset_reason : reset reason this time
*
* @return None
*/
void rtc_boot_control(uint32_t *entry_addr, RESET_REASON reset_reason);
/** /**
* @brief Software Reset digital core. * @brief Software Reset digital core.
* *
@@ -253,5 +244,3 @@ void software_reset_cpu(int cpu_no);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* _ROM_RTC_H_ */

View File

@@ -4,16 +4,11 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#ifndef _ROM_RTC_H_ #pragma once
#define _ROM_RTC_H_
#include "ets_sys.h"
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include "esp_assert.h" #include "esp_assert.h"
#include "soc/soc.h"
#include "soc/rtc_cntl_reg.h" #include "soc/rtc_cntl_reg.h"
#include "soc/reset_reasons.h" #include "soc/reset_reasons.h"
@@ -67,7 +62,6 @@ extern "C" {
#define RTC_DISABLE_ROM_LOG ((1 << 0) | (1 << 16)) //!< Disable logging from the ROM code. #define RTC_DISABLE_ROM_LOG ((1 << 0) | (1 << 16)) //!< Disable logging from the ROM code.
typedef enum { typedef enum {
AWAKE = 0, //<CPU ON AWAKE = 0, //<CPU ON
LIGHT_SLEEP = BIT0, //CPU waiti, PLL ON. We don't need explicitly set this mode. LIGHT_SLEEP = BIT0, //CPU waiti, PLL ON. We don't need explicitly set this mode.
@@ -175,16 +169,31 @@ RESET_REASON rtc_get_reset_reason(int cpu_no);
*/ */
WAKEUP_REASON rtc_get_wakeup_cause(void); WAKEUP_REASON rtc_get_wakeup_cause(void);
typedef void (* esp_rom_wake_func_t)(void);
/** /**
* @brief Get CRC for Fast RTC Memory. * @brief Read stored RTC wake function address
* *
* @param uint32_t start_addr : 0 - 0x7ff for Fast RTC Memory. * Returns pointer to wake address if a value is set in RTC registers, and stored length & CRC all valid.
* *
* @param uint32_t crc_len : 0 - 0x7ff, 0 for 4 byte, 0x7ff for 0x2000 byte. * @param None
* *
* @return uint32_t : CRC32 result * @return esp_rom_wake_func_t : Returns pointer to wake address if a value is set in RTC registers
*/ */
uint32_t calc_rtc_memory_crc(uint32_t start_addr, uint32_t crc_len); esp_rom_wake_func_t esp_rom_get_rtc_wake_addr(void);
/**
* @brief Store new RTC wake function address
*
* Set a new RTC wake address function. If a non-NULL function pointer is set then the function
* memory is calculated and stored also.
*
* @param entry_addr Address of function. If NULL, length is ignored and all registers are cleared to 0.
* @param length of function in RTC fast memory. cannot be larger than RTC Fast memory size.
*
* @return None
*/
void esp_rom_set_rtc_wake_addr(esp_rom_wake_func_t entry_addr, size_t length);
/** /**
* @brief Suppress ROM log by setting specific RTC control register. * @brief Suppress ROM log by setting specific RTC control register.
@@ -204,26 +213,6 @@ static inline void rtc_suppress_rom_log(void)
REG_SET_BIT(RTC_CNTL_STORE4_REG, RTC_DISABLE_ROM_LOG); REG_SET_BIT(RTC_CNTL_STORE4_REG, RTC_DISABLE_ROM_LOG);
} }
/**
* @brief Set CRC of Fast RTC memory 0-0x7ff into RTC STORE7.
*
* @param None
*
* @return None
*/
void set_rtc_memory_crc(void);
/**
* @brief Fetch entry from RTC memory and RTC STORE reg
*
* @param uint32_t * entry_addr : the address to save entry
*
* @param RESET_REASON reset_reason : reset reason this time
*
* @return None
*/
void rtc_boot_control(uint32_t *entry_addr, RESET_REASON reset_reason);
/** /**
* @brief Software Reset digital core. * @brief Software Reset digital core.
* *
@@ -255,5 +244,3 @@ void software_reset_cpu(int cpu_no);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* _ROM_RTC_H_ */

View File

@@ -931,6 +931,10 @@ config SOC_PM_SUPPORT_RC_FAST_PD
bool bool
default y default y
config SOC_PM_SUPPORT_DEEPSLEEP_CHECK_STUB_ONLY
bool
default y
config SOC_CLK_RC_FAST_SUPPORT_CALIBRATION config SOC_CLK_RC_FAST_SUPPORT_CALIBRATION
bool bool
default y default y

View File

@@ -428,6 +428,8 @@
#define SOC_PM_SUPPORT_RC32K_PD (1) #define SOC_PM_SUPPORT_RC32K_PD (1)
#define SOC_PM_SUPPORT_RC_FAST_PD (1) #define SOC_PM_SUPPORT_RC_FAST_PD (1)
#define SOC_PM_SUPPORT_DEEPSLEEP_CHECK_STUB_ONLY (1) /*!<Supports CRC only the stub code in RTC memory */
/*-------------------------- CLOCK SUBSYSTEM CAPS ----------------------------------------*/ /*-------------------------- CLOCK SUBSYSTEM CAPS ----------------------------------------*/
#define SOC_CLK_RC_FAST_SUPPORT_CALIBRATION (1) #define SOC_CLK_RC_FAST_SUPPORT_CALIBRATION (1)
#define SOC_MODEM_CLOCK_IS_INDEPENDENT (1) #define SOC_MODEM_CLOCK_IS_INDEPENDENT (1)

View File

@@ -751,6 +751,10 @@ config SOC_PM_SUPPORT_RC_FAST_PD
bool bool
default y default y
config SOC_PM_SUPPORT_DEEPSLEEP_CHECK_STUB_ONLY
bool
default y
config SOC_TEMPERATURE_SENSOR_SUPPORT_FAST_RC config SOC_TEMPERATURE_SENSOR_SUPPORT_FAST_RC
bool bool
default y default y

View File

@@ -411,6 +411,8 @@
#define SOC_PM_SUPPORT_BT_PD (1) #define SOC_PM_SUPPORT_BT_PD (1)
#define SOC_PM_SUPPORT_RC_FAST_PD (1) #define SOC_PM_SUPPORT_RC_FAST_PD (1)
#define SOC_PM_SUPPORT_DEEPSLEEP_CHECK_STUB_ONLY (1) /*!<Supports CRC only the stub code in RTC memory */
// TODO: IDF-6229 (Copy from esp32c6, need check) // TODO: IDF-6229 (Copy from esp32c6, need check)
/*-------------------------- Temperature Sensor CAPS -------------------------------------*/ /*-------------------------- Temperature Sensor CAPS -------------------------------------*/
#define SOC_TEMPERATURE_SENSOR_SUPPORT_FAST_RC (1) #define SOC_TEMPERATURE_SENSOR_SUPPORT_FAST_RC (1)

View File

@@ -775,6 +775,10 @@ config SOC_PM_SUPPORT_RC_FAST_PD
bool bool
default y default y
config SOC_PM_SUPPORT_DEEPSLEEP_CHECK_STUB_ONLY
bool
default y
config SOC_TEMPERATURE_SENSOR_SUPPORT_FAST_RC config SOC_TEMPERATURE_SENSOR_SUPPORT_FAST_RC
bool bool
default y default y

View File

@@ -368,6 +368,8 @@
#define SOC_PM_SUPPORT_BT_PD (1) #define SOC_PM_SUPPORT_BT_PD (1)
#define SOC_PM_SUPPORT_RC_FAST_PD (1) #define SOC_PM_SUPPORT_RC_FAST_PD (1)
#define SOC_PM_SUPPORT_DEEPSLEEP_CHECK_STUB_ONLY (1) /*!<Supports CRC only the stub code in RTC memory */
/*-------------------------- Temperature Sensor CAPS -------------------------------------*/ /*-------------------------- Temperature Sensor CAPS -------------------------------------*/
#define SOC_TEMPERATURE_SENSOR_SUPPORT_FAST_RC (1) #define SOC_TEMPERATURE_SENSOR_SUPPORT_FAST_RC (1)
#define SOC_TEMPERATURE_SENSOR_SUPPORT_XTAL (1) #define SOC_TEMPERATURE_SENSOR_SUPPORT_XTAL (1)

View File

@@ -963,10 +963,6 @@ config SOC_PM_SUPPORT_TOUCH_SENSOR_WAKEUP
bool bool
default y default y
config SOC_PM_SUPPORT_DEEPSLEEP_CHECK_STUB_ONLY
bool
default y
config SOC_PM_SUPPORT_CPU_PD config SOC_PM_SUPPORT_CPU_PD
bool bool
default y default y
@@ -983,6 +979,10 @@ config SOC_PM_SUPPORT_RC_FAST_PD
bool bool
default y default y
config SOC_PM_SUPPORT_DEEPSLEEP_CHECK_STUB_ONLY
bool
default y
config SOC_CLK_RC_FAST_D256_SUPPORTED config SOC_CLK_RC_FAST_D256_SUPPORTED
bool bool
default y default y

View File

@@ -400,13 +400,13 @@
#define SOC_PM_SUPPORT_WIFI_WAKEUP (1) #define SOC_PM_SUPPORT_WIFI_WAKEUP (1)
#define SOC_PM_SUPPORT_BT_WAKEUP (1) #define SOC_PM_SUPPORT_BT_WAKEUP (1)
#define SOC_PM_SUPPORT_TOUCH_SENSOR_WAKEUP (1) /*!<Supports waking up from touch pad trigger */ #define SOC_PM_SUPPORT_TOUCH_SENSOR_WAKEUP (1) /*!<Supports waking up from touch pad trigger */
#define SOC_PM_SUPPORT_DEEPSLEEP_CHECK_STUB_ONLY (1)
#define SOC_PM_SUPPORT_CPU_PD (1) #define SOC_PM_SUPPORT_CPU_PD (1)
#define SOC_PM_SUPPORT_TAGMEM_PD (1) #define SOC_PM_SUPPORT_TAGMEM_PD (1)
#define SOC_PM_SUPPORT_RTC_PERIPH_PD (1) #define SOC_PM_SUPPORT_RTC_PERIPH_PD (1)
#define SOC_PM_SUPPORT_RC_FAST_PD (1) #define SOC_PM_SUPPORT_RC_FAST_PD (1)
#define SOC_PM_SUPPORT_DEEPSLEEP_CHECK_STUB_ONLY (1) /*!<Supports CRC only the stub code in RTC memory */
/*--------------------------- CLOCK SUBSYSTEM CAPS -------------------------- */ /*--------------------------- CLOCK SUBSYSTEM CAPS -------------------------- */
#define SOC_CLK_RC_FAST_D256_SUPPORTED (1) #define SOC_CLK_RC_FAST_D256_SUPPORTED (1)