1 /*
2  * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #pragma once
8 
9 /* Magic is derived from sha256sum of the string "espmcuboot"
10  * The application header magic must match this number
11  */
12 #define ESP_LOAD_HEADER_MAGIC 0xace637d3
13 #define ESP_PROGRAM_HEADER_MAGIC ESP_LOAD_HEADER_MAGIC
14 
15 /* Load header that should be a part of application image
16  * for MCUboot-Espressif port booting.
17  * The header can use up to 96 Bytes (or 24 DWords).
18  */
19 typedef struct esp_program_header {
20     uint32_t header_magic;             /* Magic for load header */
21     uint32_t entry_addr;               /* Application entry address */
22     uint32_t iram_dest_addr;           /* Destination address(VMA) for IRAM region */
23     uint32_t iram_flash_offset;        /* Flash offset(LMA) for start of IRAM region */
24     uint32_t iram_size;                /* Size of IRAM region */
25     uint32_t dram_dest_addr;           /* Destination address(VMA) for DRAM region */
26     uint32_t dram_flash_offset;        /* Flash offset(LMA) for start of DRAM region */
27     uint32_t dram_size;                /* Size of DRAM region */
28     uint32_t lp_rtc_iram_dest_addr;    /* Destination address (VMA) for LP_IRAM region */
29     uint32_t lp_rtc_iram_flash_offset; /* Flash offset (LMA) for LP_IRAM region */
30     uint32_t lp_rtc_iram_size;         /* Size of LP_IRAM region */
31     uint32_t lp_rtc_dram_dest_addr;    /* Destination address (VMA) for LP_DRAM region */
32     uint32_t lp_rtc_dram_flash_offset; /* Flash offset (LMA) for LP_DRAM region */
33     uint32_t lp_rtc_dram_size;         /* Size of LP_DRAM region */
34     uint32_t irom_map_addr;            /* Mapped address (VMA) for IROM region */
35     uint32_t irom_flash_offset;        /* Flash offset (LMA) for IROM region */
36     uint32_t irom_size;                /* Size of IROM region */
37     uint32_t drom_map_addr;            /* Mapped address (VMA) for DROM region */
38     uint32_t drom_flash_offset;        /* Flash offset (LMA) for DROM region */
39     uint32_t drom_size;                /* Size of DROM region */
40     uint32_t _reserved[4];             /* Up to 24 words reserved for the header */
41 } esp_program_header_t;
42 
43 typedef esp_program_header_t esp_image_load_header_t;
44