mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 02:37:19 +02:00
fix(esp_system): Correct address used to fetch application image header
This commit is contained in:
committed by
Aditya Patwardhan
parent
4143156926
commit
4acc6d3482
@ -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
|
||||
|
Reference in New Issue
Block a user