Commit a1d641d5 authored by Almir Okato's avatar Almir Okato Committed by Gustavo Henrique Nihei
Browse files

espressif:esp32: Add multi image support



Changes on configuration and flash area organization for supporting
multi image and implementation for booting on different processors
on esp32

Signed-off-by: default avatarAlmir Okato <almir.okato@espressif.com>
parent 20e02098
Loading
Loading
Loading
Loading
+22 −2
Original line number Diff line number Diff line
@@ -3,13 +3,33 @@
# SPDX-License-Identifier: Apache-2.0

CONFIG_ESP_BOOTLOADER_SIZE=0xF000
CONFIG_ESP_APPLICATION_PRIMARY_START_ADDRESS=0x10000
CONFIG_ESP_IMAGE0_PRIMARY_START_ADDRESS=0x10000
CONFIG_ESP_APPLICATION_SIZE=0x100000
CONFIG_ESP_APPLICATION_SECONDARY_START_ADDRESS=0x110000
CONFIG_ESP_IMAGE0_SECONDARY_START_ADDRESS=0x110000
CONFIG_ESP_MCUBOOT_WDT_ENABLE=y
CONFIG_ESP_SCRATCH_OFFSET=0x210000
CONFIG_ESP_SCRATCH_SIZE=0x40000

# Enables multi image, if it is not defined, it is assumed
# only one updatable image
# CONFIG_ESP_IMAGE_NUMBER=2

# Enables multi image boot on independent processors
# (main host OS is not responsible for booting the second image)
# Use only with CONFIG_ESP_IMAGE_NUMBER=2
# CONFIG_ESP_MULTI_PROCESSOR_BOOT=y

# Example of values to be used when multi image is enabled
# Notice that the OS layer and update agent must be aware
# of these regions
# CONFIG_ESP_APPLICATION_SIZE=0x50000
# CONFIG_ESP_IMAGE0_PRIMARY_START_ADDRESS=0x10000
# CONFIG_ESP_IMAGE0_SECONDARY_START_ADDRESS=0x60000
# CONFIG_ESP_IMAGE1_PRIMARY_START_ADDRESS=0xB0000
# CONFIG_ESP_IMAGE1_SECONDARY_START_ADDRESS=0x100000
# CONFIG_ESP_SCRATCH_OFFSET=0x150000
# CONFIG_ESP_SCRATCH_SIZE=0x40000

# CONFIG_ESP_SIGN_EC256=y
# CONFIG_ESP_SIGN_ED25519=n
# CONFIG_ESP_SIGN_RSA=n
+1 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ set(hal_srcs
    ${src_dir}/flash_encrypt.c
    ${src_dir}/${MCUBOOT_TARGET}/bootloader_init.c
    ${esp_idf_dir}/components/hal/mpu_hal.c
    ${esp_idf_dir}/components/hal/soc_hal.c
    ${esp_idf_dir}/components/bootloader_support/src/bootloader_common_loader.c
    ${esp_idf_dir}/components/bootloader_support/src/bootloader_console_loader.c
    ${esp_idf_dir}/components/bootloader_support/src/bootloader_flash.c
+11 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2022 Espressif Systems (Shanghai) Co., Ltd.
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#pragma once

#include <stdint.h>

void appcpu_start(uint32_t entry_addr);
+6 −0
Original line number Diff line number Diff line
@@ -10,6 +10,12 @@ list(APPEND hal_srcs
    ${esp_idf_dir}/components/efuse/src/esp_efuse_api_key_esp32.c
    )

if (DEFINED CONFIG_ESP_MULTI_PROCESSOR_BOOT)
    list(APPEND hal_srcs
        ${src_dir}/${MCUBOOT_TARGET}/app_cpu_start.c
        )
endif()

list(APPEND LINKER_SCRIPTS
    -T${esp_idf_dir}/components/esp_rom/${MCUBOOT_TARGET}/ld/${MCUBOOT_TARGET}.rom.newlib-funcs.ld
    -T${esp_idf_dir}/components/esp_rom/${MCUBOOT_TARGET}/ld/${MCUBOOT_TARGET}.rom.eco3.ld
+4 −0
Original line number Diff line number Diff line
@@ -98,7 +98,11 @@

/* Default number of separately updateable images; change in case of
 * multiple images. */
#if defined(CONFIG_ESP_IMAGE_NUMBER)
#define MCUBOOT_IMAGE_NUMBER CONFIG_ESP_IMAGE_NUMBER
#else
#define MCUBOOT_IMAGE_NUMBER 1
#endif

/*
 * Logging
Loading