Loading boot/espressif/include/esp_loader.h +5 −0 Changes for boot/espressif/include/esp_loader.h: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -6,4 +6,9 @@ #pragma once void start_cpu0_image(int image_index, int slot, unsigned int hdr_offset); #ifdef CONFIG_ESP_MULTI_PROCESSOR_BOOT void start_cpu1_image(int image_index, int slot, unsigned int hdr_offset); #endif void esp_app_image_load(int image_index, int slot, unsigned int hdr_offset, unsigned int *entry_addr); boot/espressif/main.c +2 −10 Changes for boot/espressif/main.c: 2 added lines, 10 removed lines. Original line number Diff line number Diff line Loading @@ -22,9 +22,6 @@ #ifdef CONFIG_SECURE_FLASH_ENC_ENABLED #include "esp_flash_encrypt.h" #endif #ifdef CONFIG_ESP_MULTI_PROCESSOR_BOOT #include "app_cpu_start.h" #endif #include "esp_loader.h" #include "os/os_malloc.h" Loading @@ -41,13 +38,10 @@ extern esp_err_t check_and_generate_secure_boot_keys(void); void do_boot(struct boot_rsp *rsp) { unsigned int entry_addr; BOOT_LOG_INF("br_image_off = 0x%x", rsp->br_image_off); BOOT_LOG_INF("ih_hdr_size = 0x%x", rsp->br_hdr->ih_hdr_size); int slot = (rsp->br_image_off == CONFIG_ESP_IMAGE0_PRIMARY_START_ADDRESS) ? PRIMARY_SLOT : SECONDARY_SLOT; esp_app_image_load(IMAGE_INDEX_0, slot, rsp->br_hdr->ih_hdr_size, &entry_addr); ((void (*)(void))entry_addr)(); /* Call to application entry address should not return */ FIH_PANIC; /* It should not get here */ start_cpu0_image(IMAGE_INDEX_0, slot, rsp->br_hdr->ih_hdr_size); } #ifdef CONFIG_ESP_MULTI_PROCESSOR_BOOT Loading Loading @@ -79,15 +73,13 @@ done: void do_boot_appcpu(uint32_t img_index, uint32_t slot) { unsigned int entry_addr; struct image_header img_header; if (read_image_header(img_index, slot, &img_header) != 0) { FIH_PANIC; } esp_app_image_load(img_index, slot, img_header.ih_hdr_size, &entry_addr); appcpu_start(entry_addr); start_cpu1_image(img_index, slot, img_header.ih_hdr_size); } #endif Loading boot/espressif/port/esp32/ld/bootloader.ld +1 −0 Changes for boot/espressif/port/esp32/ld/bootloader.ld: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ SECTIONS *libhal.a:esp_efuse_api.*(.literal .text .literal.* .text.*) *libhal.a:esp_efuse_utility.*(.literal .text .literal.* .text.*) *libhal.a:esp_efuse_api_key_esp32.*(.literal .text .literal.* .text.*) *libhal.a:app_cpu_start.*(.literal .text .literal.* .text.*) *esp_mcuboot.*(.literal .text .literal.* .text.*) *esp_loader.*(.literal .text .literal.* .text.*) *(.fini.literal) Loading boot/espressif/port/esp_loader.c +21 −0 Changes for boot/espressif/port/esp_loader.c: 21 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -27,6 +27,10 @@ #include "esp_loader.h" #include "flash_map_backend/flash_map_backend.h" #ifdef CONFIG_ESP_MULTI_PROCESSOR_BOOT #include "app_cpu_start.h" #endif static int load_segment(const struct flash_area *fap, uint32_t data_addr, uint32_t data_len, uint32_t load_addr) { const uint32_t *data = (const uint32_t *)bootloader_mmap((fap->fa_off + data_addr), data_len); Loading Loading @@ -90,3 +94,20 @@ void esp_app_image_load(int image_index, int slot, unsigned int hdr_offset, unsi assert(entry_addr != NULL); *entry_addr = load_header.entry_addr; } void start_cpu0_image(int image_index, int slot, unsigned int hdr_offset) { unsigned int entry_addr; esp_app_image_load(image_index, slot, hdr_offset, &entry_addr); ((void (*)(void))entry_addr)(); /* Call to application entry address should not return */ FIH_PANIC; /* It should not get here */ } #ifdef CONFIG_ESP_MULTI_PROCESSOR_BOOT void start_cpu1_image(int image_index, int slot, unsigned int hdr_offset) { unsigned int entry_addr; esp_app_image_load(image_index, slot, hdr_offset, &entry_addr); appcpu_start(entry_addr); } #endif Loading
boot/espressif/include/esp_loader.h +5 −0 Changes for boot/espressif/include/esp_loader.h: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -6,4 +6,9 @@ #pragma once void start_cpu0_image(int image_index, int slot, unsigned int hdr_offset); #ifdef CONFIG_ESP_MULTI_PROCESSOR_BOOT void start_cpu1_image(int image_index, int slot, unsigned int hdr_offset); #endif void esp_app_image_load(int image_index, int slot, unsigned int hdr_offset, unsigned int *entry_addr);
boot/espressif/main.c +2 −10 Changes for boot/espressif/main.c: 2 added lines, 10 removed lines. Original line number Diff line number Diff line Loading @@ -22,9 +22,6 @@ #ifdef CONFIG_SECURE_FLASH_ENC_ENABLED #include "esp_flash_encrypt.h" #endif #ifdef CONFIG_ESP_MULTI_PROCESSOR_BOOT #include "app_cpu_start.h" #endif #include "esp_loader.h" #include "os/os_malloc.h" Loading @@ -41,13 +38,10 @@ extern esp_err_t check_and_generate_secure_boot_keys(void); void do_boot(struct boot_rsp *rsp) { unsigned int entry_addr; BOOT_LOG_INF("br_image_off = 0x%x", rsp->br_image_off); BOOT_LOG_INF("ih_hdr_size = 0x%x", rsp->br_hdr->ih_hdr_size); int slot = (rsp->br_image_off == CONFIG_ESP_IMAGE0_PRIMARY_START_ADDRESS) ? PRIMARY_SLOT : SECONDARY_SLOT; esp_app_image_load(IMAGE_INDEX_0, slot, rsp->br_hdr->ih_hdr_size, &entry_addr); ((void (*)(void))entry_addr)(); /* Call to application entry address should not return */ FIH_PANIC; /* It should not get here */ start_cpu0_image(IMAGE_INDEX_0, slot, rsp->br_hdr->ih_hdr_size); } #ifdef CONFIG_ESP_MULTI_PROCESSOR_BOOT Loading Loading @@ -79,15 +73,13 @@ done: void do_boot_appcpu(uint32_t img_index, uint32_t slot) { unsigned int entry_addr; struct image_header img_header; if (read_image_header(img_index, slot, &img_header) != 0) { FIH_PANIC; } esp_app_image_load(img_index, slot, img_header.ih_hdr_size, &entry_addr); appcpu_start(entry_addr); start_cpu1_image(img_index, slot, img_header.ih_hdr_size); } #endif Loading
boot/espressif/port/esp32/ld/bootloader.ld +1 −0 Changes for boot/espressif/port/esp32/ld/bootloader.ld: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ SECTIONS *libhal.a:esp_efuse_api.*(.literal .text .literal.* .text.*) *libhal.a:esp_efuse_utility.*(.literal .text .literal.* .text.*) *libhal.a:esp_efuse_api_key_esp32.*(.literal .text .literal.* .text.*) *libhal.a:app_cpu_start.*(.literal .text .literal.* .text.*) *esp_mcuboot.*(.literal .text .literal.* .text.*) *esp_loader.*(.literal .text .literal.* .text.*) *(.fini.literal) Loading
boot/espressif/port/esp_loader.c +21 −0 Changes for boot/espressif/port/esp_loader.c: 21 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -27,6 +27,10 @@ #include "esp_loader.h" #include "flash_map_backend/flash_map_backend.h" #ifdef CONFIG_ESP_MULTI_PROCESSOR_BOOT #include "app_cpu_start.h" #endif static int load_segment(const struct flash_area *fap, uint32_t data_addr, uint32_t data_len, uint32_t load_addr) { const uint32_t *data = (const uint32_t *)bootloader_mmap((fap->fa_off + data_addr), data_len); Loading Loading @@ -90,3 +94,20 @@ void esp_app_image_load(int image_index, int slot, unsigned int hdr_offset, unsi assert(entry_addr != NULL); *entry_addr = load_header.entry_addr; } void start_cpu0_image(int image_index, int slot, unsigned int hdr_offset) { unsigned int entry_addr; esp_app_image_load(image_index, slot, hdr_offset, &entry_addr); ((void (*)(void))entry_addr)(); /* Call to application entry address should not return */ FIH_PANIC; /* It should not get here */ } #ifdef CONFIG_ESP_MULTI_PROCESSOR_BOOT void start_cpu1_image(int image_index, int slot, unsigned int hdr_offset) { unsigned int entry_addr; esp_app_image_load(image_index, slot, hdr_offset, &entry_addr); appcpu_start(entry_addr); } #endif