File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
components/esp_system/port Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 1313
1414#include "esp_log.h"
1515#include "esp_chip_info.h"
16+ #include "esp_app_format.h"
1617
1718#include "esp_private/cache_err_int.h"
1819#include "esp_clk_internal.h"
@@ -787,9 +788,13 @@ void IRAM_ATTR call_start_cpu0(void)
787788 // Read the application binary image header. This will also decrypt the header if the image is encrypted.
788789 __attribute__((unused )) esp_image_header_t fhdr = {0 };
789790
790- // This assumes that DROM is the first segment in the application binary, i.e. that we can read
791- // the binary header through cache by accessing SOC_DROM_LOW address.
792- hal_memcpy (& fhdr , (void * ) SOC_DROM_LOW , sizeof (fhdr ));
791+ // We can access the image header through the cache by reading from the memory-mapped virtual DROM start offset
792+ uint32_t fhdr_src_addr = (uint32_t )(& _rodata_reserved_start ) - sizeof (esp_image_header_t ) - sizeof (esp_image_segment_header_t );
793+ hal_memcpy (& fhdr , (void * ) fhdr_src_addr , sizeof (fhdr ));
794+ if (fhdr .magic != ESP_IMAGE_HEADER_MAGIC ) {
795+ ESP_EARLY_LOGE (TAG , "Invalid app image header" );
796+ abort ();
797+ }
793798
794799#if CONFIG_IDF_TARGET_ESP32
795800#if !CONFIG_SPIRAM_BOOT_INIT
You can’t perform that action at this time.
0 commit comments