Skip to content

Commit

Permalink
mcuboot: loader: use flash rom functions
Browse files Browse the repository at this point in the history
Modify the loader to use only flash ROM functions.
This allows mcuboot stage not to depend on multithreading
or spi flash driver.

Signed-off-by: Sylvio Alves <[email protected]>
  • Loading branch information
sylvioalves committed Feb 12, 2025
1 parent 5527588 commit e22c5f3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions zephyr/port/boot/esp_image_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@
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);
const uint32_t *data = (const uint32_t *)bootloader_mmap_rom((fap->fa_off + data_addr), data_len);
if (!data) {
BOOT_LOG_ERR("%s: Bootloader mmap failed", __func__);
return -1;
}
memcpy((void *)load_addr, data, data_len);
bootloader_munmap(data);
bootloader_munmap_rom(data);
return 0;
}

Expand All @@ -88,11 +88,11 @@ void esp_app_image_load(int image_index, int slot,
BOOT_LOG_INF("Loading image %d - slot %d from flash, area id: %d",
image_index, slot, area_id);

const uint32_t *data = (const uint32_t *)bootloader_mmap((fap->fa_off + hdr_offset),
const uint32_t *data = (const uint32_t *)bootloader_mmap_rom((fap->fa_off + hdr_offset),
sizeof(esp_image_load_header_t));
esp_image_load_header_t load_header = {0};
memcpy((void *)&load_header, data, sizeof(esp_image_load_header_t));
bootloader_munmap(data);
bootloader_munmap_rom(data);

if (load_header.header_magic != ESP_LOAD_HEADER_MAGIC) {
BOOT_LOG_ERR("Load header magic verification failed. Aborting");
Expand Down

0 comments on commit e22c5f3

Please sign in to comment.