diff --git a/components/bootloader_support/src/bootloader_common_loader.c b/components/bootloader_support/src/bootloader_common_loader.c index 909a35732ce..f8c40d29cf3 100644 --- a/components/bootloader_support/src/bootloader_common_loader.c +++ b/components/bootloader_support/src/bootloader_common_loader.c @@ -5,6 +5,7 @@ */ #include "string.h" +#include #include "sdkconfig.h" #include "esp_err.h" #include "esp_log.h" @@ -253,7 +254,9 @@ rtc_retain_mem_t* bootloader_common_get_rtc_retain_mem(void) #endif //ESP_ROM_HAS_LP_ROM #if CONFIG_SECURE_BOOT && ESP_ROM_SUPPORT_SECURE_BOOT_FAST_WAKEUP - static rtc_retain_mem_t *const s_bootloader_retain_mem = (rtc_retain_mem_t *)RTC_RETAIN_MEM_ADDR - ESP_SECURE_BOOT_DIGEST_LEN; + /* ROM stores the verified image digest in the last ESP_SECURE_BOOT_DIGEST_LEN + * bytes of LP/RTC RAM on deep-sleep wake. Keep retain mem below that region. */ + static rtc_retain_mem_t *const s_bootloader_retain_mem = (rtc_retain_mem_t *)((uintptr_t)RTC_RETAIN_MEM_ADDR - ESP_SECURE_BOOT_DIGEST_LEN); #else static rtc_retain_mem_t *const s_bootloader_retain_mem = (rtc_retain_mem_t *)RTC_RETAIN_MEM_ADDR; #endif