mirror of
https://github.com/espressif/esp-idf
synced 2025-03-14 03:29:11 -04:00
Merge branch 'fix/fetch_image_hdr_v5.3' into 'release/v5.3'
fix(esp_system): Correct address used to fetch application image header (v5.3) See merge request espressif/esp-idf!34628
This commit is contained in:
commit
ecc5f36e49
@ -13,6 +13,7 @@
|
||||
|
||||
#include "esp_log.h"
|
||||
#include "esp_chip_info.h"
|
||||
#include "esp_app_format.h"
|
||||
|
||||
#include "esp_private/cache_err_int.h"
|
||||
#include "esp_clk_internal.h"
|
||||
@ -797,9 +798,13 @@ void IRAM_ATTR call_start_cpu0(void)
|
||||
// Read the application binary image header. This will also decrypt the header if the image is encrypted.
|
||||
__attribute__((unused)) esp_image_header_t fhdr = {0};
|
||||
|
||||
// This assumes that DROM is the first segment in the application binary, i.e. that we can read
|
||||
// the binary header through cache by accessing SOC_DROM_LOW address.
|
||||
hal_memcpy(&fhdr, (void *) SOC_DROM_LOW, sizeof(fhdr));
|
||||
// We can access the image header through the cache by reading from the memory-mapped virtual DROM start offset
|
||||
uint32_t fhdr_src_addr = (uint32_t)(&_rodata_reserved_start) - sizeof(esp_image_header_t) - sizeof(esp_image_segment_header_t);
|
||||
hal_memcpy(&fhdr, (void *) fhdr_src_addr, sizeof(fhdr));
|
||||
if (fhdr.magic != ESP_IMAGE_HEADER_MAGIC) {
|
||||
ESP_EARLY_LOGE(TAG, "Invalid app image header");
|
||||
abort();
|
||||
}
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#if !CONFIG_SPIRAM_BOOT_INIT
|
||||
|
Loading…
x
Reference in New Issue
Block a user