fix(clk): add an inevitable kconfig option to be selected to use rc32k

This commit is contained in:
Song Ruo Jing
2024-12-25 20:07:26 +08:00
parent 610b334c26
commit 47c9382cc2
13 changed files with 15 additions and 43 deletions
-4
View File
@@ -16,10 +16,6 @@ if(${target} STREQUAL "esp32c6")
list(APPEND priv_requires hal)
endif()
if(CONFIG_RTC_CLK_SRC_INT_RC32K)
message(WARNING "Internal RC32K clock is unstable at extreme temperatures and is not recommended for use.")
endif()
set(srcs "cpu.c" "port/${IDF_TARGET}/esp_cpu_intr.c" "esp_memory_utils.c" "port/${IDF_TARGET}/cpu_region_protect.c")
if(NOT BOOTLOADER_BUILD)
list(APPEND srcs "esp_clk.c"
@@ -13,12 +13,18 @@ choice RTC_CLK_SRC
bool "External 32kHz oscillator at 32K_XP pin"
select ESP_SYSTEM_RTC_EXT_OSC
config RTC_CLK_SRC_INT_RC32K
bool "Internal 32kHz RC oscillator"
bool "Internal 32kHz RC oscillator (NOT RECOMMENDED TO USE, READ DOCS FIRST)"
depends on RTC_CLK_SRC_USE_DANGEROUS_RC32K_ALLOWED
help
Internal RC32K clock is unstable at extreme temperatures and is not recommended for use.
To be able to select this option, please select `RTC_CLK_SRC_USE_DANGEROUS_RC32K_ALLOWED` first.
This option will be removed in IDF v6.0.
endchoice
config RTC_CLK_SRC_USE_DANGEROUS_RC32K_ALLOWED
bool "Confirm to use the unrecommended 32 kHz RC oscillator (READ DOCS FIRST)"
help
Internal RC32K clock is unstable at extreme temperatures and is not recommended for use.
config RTC_CLK_CAL_CYCLES
int "Number of cycles for RTC_SLOW_CLK calibration"
default 3000 if RTC_CLK_SRC_EXT_CRYS || RTC_CLK_SRC_EXT_OSC || RTC_CLK_SRC_INT_RC32K
@@ -12,18 +12,13 @@ choice RTC_CLK_SRC
config RTC_CLK_SRC_EXT_OSC
bool "External 32kHz oscillator at 32K_XP pin"
select ESP_SYSTEM_RTC_EXT_OSC
config RTC_CLK_SRC_INT_RC32K
bool "Internal 32kHz RC oscillator"
help
Internal RC32K clock is unstable at extreme temperatures and is not recommended for use.
This option will be removed in IDF v6.0.
endchoice
config RTC_CLK_CAL_CYCLES
int "Number of cycles for RTC_SLOW_CLK calibration"
default 3000 if RTC_CLK_SRC_EXT_CRYS || RTC_CLK_SRC_EXT_OSC || RTC_CLK_SRC_INT_RC32K
default 3000 if RTC_CLK_SRC_EXT_CRYS || RTC_CLK_SRC_EXT_OSC
default 1024 if RTC_CLK_SRC_INT_RC
range 0 8190 if RTC_CLK_SRC_EXT_CRYS || RTC_CLK_SRC_EXT_OSC || RTC_CLK_SRC_INT_RC32K
range 0 8190 if RTC_CLK_SRC_EXT_CRYS || RTC_CLK_SRC_EXT_OSC
range 0 32766 if RTC_CLK_SRC_INT_RC
help
When the startup code initializes RTC_SLOW_CLK, it can perform
@@ -14,18 +14,13 @@ choice RTC_CLK_SRC
config RTC_CLK_SRC_EXT_OSC
bool "External 32kHz oscillator at 32K_XP pin"
select ESP_SYSTEM_RTC_EXT_OSC
config RTC_CLK_SRC_INT_RC32K
bool "Internal 32kHz RC oscillator"
help
Internal RC32K clock is unstable at extreme temperatures and is not recommended for use.
This option will be removed in IDF v6.0.
endchoice
config RTC_CLK_CAL_CYCLES
int "Number of cycles for RTC_SLOW_CLK calibration"
default 3000 if RTC_CLK_SRC_EXT_CRYS || RTC_CLK_SRC_EXT_OSC || RTC_CLK_SRC_INT_8MD256
default 3000 if RTC_CLK_SRC_EXT_CRYS || RTC_CLK_SRC_EXT_OSC
default 1024 if RTC_CLK_SRC_INT_RC
range 0 8190 if RTC_CLK_SRC_EXT_CRYS || RTC_CLK_SRC_INT_RC32K
range 0 8190 if RTC_CLK_SRC_EXT_CRYS
range 0 32766 if RTC_CLK_SRC_INT_RC
help
When the startup code initializes RTC_SLOW_CLK, it can perform
@@ -87,8 +87,6 @@ __attribute__((weak)) void esp_clk_init(void)
select_rtc_slow_clk(SOC_RTC_SLOW_CLK_SRC_XTAL32K);
#elif defined(CONFIG_RTC_CLK_SRC_EXT_OSC)
select_rtc_slow_clk(SOC_RTC_SLOW_CLK_SRC_OSC_SLOW);
#elif defined(CONFIG_RTC_CLK_SRC_INT_RC32K)
select_rtc_slow_clk(SOC_RTC_SLOW_CLK_SRC_RC32K);
#else
select_rtc_slow_clk(SOC_RTC_SLOW_CLK_SRC_RC_SLOW);
#endif
@@ -73,8 +73,6 @@ __attribute__((weak)) void esp_clk_init(void)
select_rtc_slow_clk(SOC_RTC_SLOW_CLK_SRC_XTAL32K);
#elif defined(CONFIG_RTC_CLK_SRC_EXT_OSC)
select_rtc_slow_clk(SOC_RTC_SLOW_CLK_SRC_OSC_SLOW);
#elif defined(CONFIG_RTC_CLK_SRC_INT_RC32K)
select_rtc_slow_clk(SOC_RTC_SLOW_CLK_SRC_RC32K);
#else
select_rtc_slow_clk(SOC_RTC_SLOW_CLK_SRC_RC_SLOW);
#endif
@@ -24,7 +24,7 @@ extern "C" {
* This RC oscillator generates a ~136kHz clock signal output as the RC_SLOW_CLK. The exact frequency of this clock
* can be computed in runtime through calibration.
*
* 4) Internal 32kHz RC Oscillator: RC32K
* 4) Internal 32kHz RC Oscillator: RC32K [NOT RECOMMENDED TO USE]
*
* The exact frequency of this clock can be computed in runtime through calibration.
*
@@ -24,7 +24,7 @@ extern "C" {
* This RC oscillator generates a ~136kHz clock signal output as the RC_SLOW_CLK. The exact frequency of this clock
* can be computed in runtime through calibration.
*
* 4) Internal 32kHz RC Oscillator: RC32K
* 4) Internal 32kHz RC Oscillator: RC32K [NOT RECOMMENDED TO USE]
*
* The exact frequency of this clock can be computed in runtime through calibration.
*
@@ -26,7 +26,7 @@ extern "C" {
* This RC oscillator generates a ~136kHz clock signal output as the RC_SLOW_CLK. The exact frequency of this clock
* can be computed in runtime through calibration.
*
* 4) Internal 32kHz RC Oscillator: RC32K
* 4) Internal 32kHz RC Oscillator: RC32K [NOT RECOMMENDED TO USE]
*
* The exact frequency of this clock can be computed in runtime through calibration.
*