mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-28 01:04:48 +03:00
fix(bootloader_support): fix RTC retain mem offset for secure boot fast wakeup
Pointer arithmetic on rtc_retain_mem_t* subtracted ESP_SECURE_BOOT_DIGEST_LEN in struct units instead of bytes. Cast through uintptr_t so retain mem stays below the ROM verified-image digest region on deep-sleep wake. Partial backport of !51265 (bootloader_common_loader.c only).
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "string.h"
|
||||
#include <stdint.h>
|
||||
#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
|
||||
|
||||
Reference in New Issue
Block a user