From 0f5d1c1c46c1710cbfeabbed1233153464f463cb Mon Sep 17 00:00:00 2001 From: morris Date: Wed, 27 Jan 2021 12:07:05 +0800 Subject: [PATCH] rtc: supported disable rom log temporarily --- components/esp_rom/include/esp32/rom/rtc.h | 18 +++++++++++++++++ components/esp_rom/include/esp32c3/rom/rtc.h | 20 +++++++++++++++++++ components/esp_rom/include/esp32s2/rom/rtc.h | 20 +++++++++++++++++++ components/esp_rom/include/esp32s3/rom/rtc.h | 19 ++++++++++++++++++ components/esp_rom/include/esp_rom_sys.h | 7 +------ components/esp_system/sleep_modes.c | 2 +- .../ulp_adc/main/ulp_adc_example_main.c | 2 -- 7 files changed, 79 insertions(+), 9 deletions(-) diff --git a/components/esp_rom/include/esp32/rom/rtc.h b/components/esp_rom/include/esp32/rom/rtc.h index fa00b71bb9..79ad9b0acc 100644 --- a/components/esp_rom/include/esp32/rom/rtc.h +++ b/components/esp_rom/include/esp32/rom/rtc.h @@ -184,6 +184,24 @@ uint32_t calc_rtc_memory_crc(uint32_t start_addr, uint32_t crc_len); */ void set_rtc_memory_crc(void); +/** + * @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. + * + * @param None + * + * @return None + */ +static inline void rtc_suppress_rom_log(void) +{ + /* To disable logging in the ROM, only the least significant bit of the register is used, + * but since this register is also used to store the frequency of the main crystal (RTC_XTAL_FREQ_REG), + * you need to write to this register in the same format. + * Namely, the upper 16 bits and lower should be the same. + */ + REG_SET_BIT(RTC_CNTL_STORE4_REG, RTC_DISABLE_ROM_LOG); +} + /** * @brief Software Reset digital core. * diff --git a/components/esp_rom/include/esp32c3/rom/rtc.h b/components/esp_rom/include/esp32c3/rom/rtc.h index ef0c5daaba..fcbfddc1c0 100644 --- a/components/esp_rom/include/esp32c3/rom/rtc.h +++ b/components/esp_rom/include/esp32c3/rom/rtc.h @@ -71,6 +71,8 @@ extern "C" { #define RTC_RESET_CAUSE_REG RTC_CNTL_STORE6_REG #define RTC_MEMORY_CRC_REG RTC_CNTL_STORE7_REG +#define RTC_DISABLE_ROM_LOG ((1 << 0) | (1 << 16)) //!< Disable logging from the ROM code. + typedef enum { AWAKE = 0, //