Initial commit
Initial commit.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* 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);
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
void bootloader_wdt_feed(void);
|
||||
@@ -0,0 +1,32 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
list(APPEND hal_srcs
|
||||
${esp_hal_dir}/components/esp_hw_support/port/${MCUBOOT_TARGET}/rtc_init.c
|
||||
${esp_hal_dir}/components/efuse/src/efuse_controller/keys/without_key_purposes/three_key_blocks/esp_efuse_api_key.c
|
||||
)
|
||||
|
||||
if (DEFINED CONFIG_ESP_MULTI_PROCESSOR_BOOT)
|
||||
list(APPEND hal_srcs
|
||||
${src_dir}/${MCUBOOT_TARGET}/app_cpu_start.c
|
||||
${esp_hal_dir}/components/esp_hw_support/cpu.c
|
||||
)
|
||||
endif()
|
||||
|
||||
if (DEFINED CONFIG_ESP_CONSOLE_UART_CUSTOM)
|
||||
list(APPEND hal_srcs
|
||||
${src_dir}/${MCUBOOT_TARGET}/console_uart_custom.c
|
||||
)
|
||||
endif()
|
||||
|
||||
list(APPEND LINKER_SCRIPTS
|
||||
-T${esp_hal_dir}/components/esp_rom/${MCUBOOT_TARGET}/ld/${MCUBOOT_TARGET}.rom.newlib-funcs.ld
|
||||
-T${esp_hal_dir}/components/esp_rom/${MCUBOOT_TARGET}/ld/${MCUBOOT_TARGET}.rom.eco3.ld
|
||||
)
|
||||
|
||||
set_source_files_properties(
|
||||
${esp_hal_dir}/components/bootloader_support/src/esp32/bootloader_esp32.c
|
||||
${esp_hal_dir}/components/bootloader_support/bootloader_flash/src/bootloader_flash.c
|
||||
PROPERTIES COMPILE_FLAGS
|
||||
"-Wno-unused-variable -Wno-unused-but-set-variable")
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define BOOTLOADER_BUILD 1
|
||||
#define CONFIG_IDF_FIRMWARE_CHIP_ID 0x0000
|
||||
#define CONFIG_IDF_TARGET_ESP32 1
|
||||
#define CONFIG_ESP32_REV_MIN_3 1
|
||||
#define CONFIG_ESP32_REV_MIN_FULL 300
|
||||
#define CONFIG_ESP_REV_MIN_FULL CONFIG_ESP32_REV_MIN_FULL
|
||||
#define CONFIG_ESP32_REV_MIN 3
|
||||
#define CONFIG_ESP32_REV_MAX_FULL 399
|
||||
#define CONFIG_ESP_REV_MAX_FULL CONFIG_ESP32_REV_MAX_FULL
|
||||
#define CONFIG_SPI_FLASH_ROM_DRIVER_PATCH 1
|
||||
#define CONFIG_MMU_PAGE_SIZE 0x10000
|
||||
#define CONFIG_ESP32_XTAL_FREQ 40
|
||||
#define CONFIG_XTAL_FREQ 40
|
||||
#define CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_160 1
|
||||
#define CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ 160
|
||||
#define CONFIG_MCUBOOT 1
|
||||
#define NDEBUG 1
|
||||
#define CONFIG_BOOTLOADER_WDT_TIME_MS 9000
|
||||
#define CONFIG_ESP_CONSOLE_UART_BAUDRATE 115200
|
||||
#define CONFIG_BOOTLOADER_OFFSET_IN_FLASH 0x1000
|
||||
#define CONFIG_PARTITION_TABLE_OFFSET 0x10000
|
||||
#define CONFIG_EFUSE_VIRTUAL_OFFSET 0x250000
|
||||
#define CONFIG_EFUSE_VIRTUAL_SIZE 0x2000
|
||||
#define CONFIG_EFUSE_MAX_BLK_LEN 192
|
||||
#define CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT 1
|
||||
@@ -0,0 +1,29 @@
|
||||
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
list(APPEND hal_srcs
|
||||
${esp_hal_dir}/components/esp_hw_support/port/${MCUBOOT_TARGET}/rtc_init.c
|
||||
${esp_hal_dir}/components/hal/cache_hal.c
|
||||
${esp_hal_dir}/components/efuse/${MCUBOOT_TARGET}/esp_efuse_table.c
|
||||
${esp_hal_dir}/components/efuse/src/efuse_controller/keys/without_key_purposes/one_key_block/esp_efuse_api_key.c
|
||||
)
|
||||
|
||||
if (DEFINED CONFIG_ESP_CONSOLE_UART_CUSTOM)
|
||||
list(APPEND hal_srcs
|
||||
${src_dir}/${MCUBOOT_TARGET}/console_uart_custom.c
|
||||
)
|
||||
endif()
|
||||
|
||||
list(APPEND LINKER_SCRIPTS
|
||||
-T${esp_hal_dir}/components/esp_rom/${MCUBOOT_TARGET}/ld/${MCUBOOT_TARGET}.rom.newlib.ld
|
||||
)
|
||||
|
||||
set_source_files_properties(
|
||||
${esp_hal_dir}/components/bootloader_support/src/esp_image_format.c
|
||||
${esp_hal_dir}/components/bootloader_support/bootloader_flash/src/bootloader_flash.c
|
||||
${esp_hal_dir}/components/bootloader_support/bootloader_flash/src/bootloader_flash_config_${MCUBOOT_TARGET}.c
|
||||
${esp_hal_dir}/components/hal/mmu_hal.c
|
||||
${esp_hal_dir}/components/hal/cache_hal.c
|
||||
PROPERTIES COMPILE_FLAGS
|
||||
"-Wno-logical-op")
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define BOOTLOADER_BUILD 1
|
||||
#define CONFIG_IDF_FIRMWARE_CHIP_ID 0x000C
|
||||
#define CONFIG_IDF_TARGET_ESP32C2 1
|
||||
#define CONFIG_ESP32C2_REV_MIN_0 1
|
||||
#define CONFIG_ESP32C2_REV_MIN_FULL 3
|
||||
#define CONFIG_ESP_REV_MIN_FULL CONFIG_ESP32C2_REV_MIN_FULL
|
||||
#define CONFIG_ESP32C2_REV_MIN 3
|
||||
#define CONFIG_ESP32C2_REV_MAX_FULL 99
|
||||
#define CONFIG_ESP_REV_MAX_FULL CONFIG_ESP32C2_REV_MAX_FULL
|
||||
#define CONFIG_IDF_TARGET_ARCH_RISCV 1
|
||||
#define CONFIG_MMU_PAGE_SIZE 0x10000
|
||||
#define CONFIG_XTAL_FREQ_26 1
|
||||
#define CONFIG_XTAL_FREQ 26
|
||||
#define CONFIG_SPI_FLASH_ROM_DRIVER_PATCH 1
|
||||
#define CONFIG_MCUBOOT 1
|
||||
#define NDEBUG 1
|
||||
#define CONFIG_BOOTLOADER_WDT_TIME_MS 9000
|
||||
#define CONFIG_ESP_CONSOLE_UART_BAUDRATE 115200
|
||||
#define CONFIG_BOOTLOADER_OFFSET_IN_FLASH 0x0000
|
||||
#define CONFIG_PARTITION_TABLE_OFFSET 0x10000
|
||||
#define CONFIG_EFUSE_VIRTUAL_OFFSET 0x250000
|
||||
#define CONFIG_EFUSE_VIRTUAL_SIZE 0x2000
|
||||
#define CONFIG_EFUSE_MAX_BLK_LEN 256
|
||||
#define CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT 1
|
||||
@@ -0,0 +1,20 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
list(APPEND hal_srcs
|
||||
${esp_hal_dir}/components/esp_hw_support/port/${MCUBOOT_TARGET}/rtc_init.c
|
||||
${esp_hal_dir}/components/hal/cache_hal.c
|
||||
${esp_hal_dir}/components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c
|
||||
)
|
||||
|
||||
if (DEFINED CONFIG_ESP_CONSOLE_UART_CUSTOM)
|
||||
list(APPEND hal_srcs
|
||||
${src_dir}/${MCUBOOT_TARGET}/console_uart_custom.c
|
||||
)
|
||||
endif()
|
||||
|
||||
list(APPEND LINKER_SCRIPTS
|
||||
-T${esp_hal_dir}/components/esp_rom/${MCUBOOT_TARGET}/ld/${MCUBOOT_TARGET}.rom.newlib.ld
|
||||
-T${esp_hal_dir}/components/esp_rom/${MCUBOOT_TARGET}/ld/${MCUBOOT_TARGET}.rom.eco3.ld
|
||||
)
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define BOOTLOADER_BUILD 1
|
||||
#define CONFIG_IDF_FIRMWARE_CHIP_ID 0x0005
|
||||
#define CONFIG_IDF_TARGET_ESP32C3 1
|
||||
#define CONFIG_ESP32C3_REV_MIN_3 1
|
||||
#define CONFIG_ESP32C3_REV_MIN_FULL 3
|
||||
#define CONFIG_ESP_REV_MIN_FULL CONFIG_ESP32C3_REV_MIN_FULL
|
||||
#define CONFIG_ESP32C3_REV_MIN 3
|
||||
#define CONFIG_ESP32C3_REV_MAX_FULL 99
|
||||
#define CONFIG_ESP_REV_MAX_FULL CONFIG_ESP32C3_REV_MAX_FULL
|
||||
#define CONFIG_IDF_TARGET_ARCH_RISCV 1
|
||||
#define CONFIG_MMU_PAGE_SIZE 0x10000
|
||||
#define CONFIG_XTAL_FREQ 40
|
||||
#define CONFIG_SPI_FLASH_ROM_DRIVER_PATCH 1
|
||||
#define CONFIG_MCUBOOT 1
|
||||
#define NDEBUG 1
|
||||
#define CONFIG_BOOTLOADER_WDT_TIME_MS 9000
|
||||
#define CONFIG_ESP_CONSOLE_UART_BAUDRATE 115200
|
||||
#define CONFIG_BOOTLOADER_OFFSET_IN_FLASH 0x0000
|
||||
#define CONFIG_PARTITION_TABLE_OFFSET 0x10000
|
||||
#define CONFIG_EFUSE_VIRTUAL_OFFSET 0x250000
|
||||
#define CONFIG_EFUSE_VIRTUAL_SIZE 0x2000
|
||||
#define CONFIG_EFUSE_MAX_BLK_LEN 256
|
||||
#define CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT 1
|
||||
@@ -0,0 +1,34 @@
|
||||
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
list(APPEND include_dirs
|
||||
${esp_hal_dir}/components/esp_hw_support/port/${MCUBOOT_TARGET}/private_include
|
||||
)
|
||||
|
||||
list(APPEND hal_srcs
|
||||
${esp_hal_dir}/components/hal/cache_hal.c
|
||||
${esp_hal_dir}/components/hal/lp_timer_hal.c
|
||||
${esp_hal_dir}/components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c
|
||||
${esp_hal_dir}/components/esp_rom/patches/esp_rom_hp_regi2c_${MCUBOOT_TARGET}.c
|
||||
${esp_hal_dir}/components/esp_hw_support/port/${MCUBOOT_TARGET}/pmu_param.c
|
||||
)
|
||||
|
||||
if (DEFINED CONFIG_ESP_CONSOLE_UART_CUSTOM)
|
||||
list(APPEND hal_srcs
|
||||
${src_dir}/${MCUBOOT_TARGET}/console_uart_custom.c
|
||||
)
|
||||
endif()
|
||||
|
||||
list(APPEND LINKER_SCRIPTS
|
||||
-T${esp_hal_dir}/components/esp_rom/${MCUBOOT_TARGET}/ld/${MCUBOOT_TARGET}.rom.newlib.ld
|
||||
)
|
||||
|
||||
set_source_files_properties(
|
||||
${esp_hal_dir}/components/bootloader_support/src/esp_image_format.c
|
||||
${esp_hal_dir}/components/bootloader_support/bootloader_flash/src/bootloader_flash.c
|
||||
${esp_hal_dir}/components/bootloader_support/bootloader_flash/src/bootloader_flash_config_${MCUBOOT_TARGET}.c
|
||||
${esp_hal_dir}/components/hal/mmu_hal.c
|
||||
${esp_hal_dir}/components/hal/cache_hal.c
|
||||
PROPERTIES COMPILE_FLAGS
|
||||
"-Wno-logical-op")
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define BOOTLOADER_BUILD 1
|
||||
#define CONFIG_IDF_FIRMWARE_CHIP_ID 0x000D
|
||||
#define CONFIG_IDF_TARGET_ESP32C6 1
|
||||
#define CONFIG_ESP32C6_REV_MIN_0 1
|
||||
#define CONFIG_ESP32C6_REV_MIN_FULL 0
|
||||
#define CONFIG_ESP_REV_MIN_FULL CONFIG_ESP32C6_REV_MIN_FULL
|
||||
#define CONFIG_ESP32C6_REV_MIN 0
|
||||
#define CONFIG_ESP32C6_REV_MAX_FULL 99
|
||||
#define CONFIG_ESP_REV_MAX_FULL CONFIG_ESP32C6_REV_MAX_FULL
|
||||
#define CONFIG_IDF_TARGET_ARCH_RISCV 1
|
||||
#define CONFIG_MMU_PAGE_SIZE 0x10000
|
||||
#define SOC_MMU_PAGE_SIZE CONFIG_MMU_PAGE_SIZE /* from soc/CMakeLists */
|
||||
#define CONFIG_XTAL_FREQ 40
|
||||
#define CONFIG_SPI_FLASH_ROM_DRIVER_PATCH 1
|
||||
#define CONFIG_MCUBOOT 1
|
||||
#define NDEBUG 1
|
||||
#define CONFIG_BOOTLOADER_WDT_TIME_MS 9000
|
||||
#define CONFIG_ESP_CONSOLE_UART_BAUDRATE 115200
|
||||
#define CONFIG_BOOTLOADER_OFFSET_IN_FLASH 0x0000
|
||||
#define CONFIG_PARTITION_TABLE_OFFSET 0x10000
|
||||
#define CONFIG_EFUSE_VIRTUAL_OFFSET 0x250000
|
||||
#define CONFIG_EFUSE_VIRTUAL_SIZE 0x2000
|
||||
#define CONFIG_EFUSE_MAX_BLK_LEN 256
|
||||
#define CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT 1
|
||||
@@ -0,0 +1,34 @@
|
||||
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
list(APPEND include_dirs
|
||||
${esp_hal_dir}/components/esp_hw_support/port/${MCUBOOT_TARGET}/private_include
|
||||
)
|
||||
|
||||
list(APPEND hal_srcs
|
||||
${esp_hal_dir}/components/hal/cache_hal.c
|
||||
${esp_hal_dir}/components/hal/lp_timer_hal.c
|
||||
${esp_hal_dir}/components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c
|
||||
${esp_hal_dir}/components/esp_rom/patches/esp_rom_regi2c_${MCUBOOT_TARGET}.c
|
||||
${esp_hal_dir}/components/esp_hw_support/port/${MCUBOOT_TARGET}/pmu_param.c
|
||||
)
|
||||
|
||||
if (DEFINED CONFIG_ESP_CONSOLE_UART_CUSTOM)
|
||||
list(APPEND hal_srcs
|
||||
${src_dir}/${MCUBOOT_TARGET}/console_uart_custom.c
|
||||
)
|
||||
endif()
|
||||
|
||||
list(APPEND LINKER_SCRIPTS
|
||||
-T${esp_hal_dir}/components/esp_rom/${MCUBOOT_TARGET}/ld/${MCUBOOT_TARGET}.rom.newlib.ld
|
||||
)
|
||||
|
||||
set_source_files_properties(
|
||||
${esp_hal_dir}/components/bootloader_support/src/esp_image_format.c
|
||||
${esp_hal_dir}/components/bootloader_support/bootloader_flash/src/bootloader_flash.c
|
||||
${esp_hal_dir}/components/bootloader_support/bootloader_flash/src/bootloader_flash_config_${MCUBOOT_TARGET}.c
|
||||
${esp_hal_dir}/components/hal/mmu_hal.c
|
||||
${esp_hal_dir}/components/hal/cache_hal.c
|
||||
PROPERTIES COMPILE_FLAGS
|
||||
"-Wno-logical-op")
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define BOOTLOADER_BUILD 1
|
||||
#define CONFIG_IDF_FIRMWARE_CHIP_ID 0x0010
|
||||
#define CONFIG_IDF_TARGET_ESP32H2 1
|
||||
#define CONFIG_ESP32H2_REV_MIN_0 1
|
||||
#define CONFIG_ESP32H2_REV_MIN_FULL 0
|
||||
#define CONFIG_ESP_REV_MIN_FULL CONFIG_ESP32H2_REV_MIN_FULL
|
||||
#define CONFIG_ESP32H2_REV_MIN 0
|
||||
#define CONFIG_ESP32H2_REV_MAX_FULL 99
|
||||
#define CONFIG_ESP_REV_MAX_FULL CONFIG_ESP32H2_REV_MAX_FULL
|
||||
#define CONFIG_IDF_TARGET_ARCH_RISCV 1
|
||||
#define CONFIG_MMU_PAGE_SIZE 0x10000
|
||||
#define SOC_MMU_PAGE_SIZE CONFIG_MMU_PAGE_SIZE /* from soc/CMakeLists */
|
||||
#define CONFIG_XTAL_FREQ_32 1
|
||||
#define CONFIG_XTAL_FREQ 32
|
||||
#define CONFIG_SPI_FLASH_ROM_DRIVER_PATCH 1
|
||||
#define CONFIG_MCUBOOT 1
|
||||
#define NDEBUG 1
|
||||
#define CONFIG_BOOTLOADER_WDT_TIME_MS 9000
|
||||
#define CONFIG_ESP_CONSOLE_UART_BAUDRATE 115200
|
||||
#define CONFIG_BOOTLOADER_OFFSET_IN_FLASH 0x0000
|
||||
#define CONFIG_PARTITION_TABLE_OFFSET 0x10000
|
||||
#define CONFIG_EFUSE_VIRTUAL_OFFSET 0x250000
|
||||
#define CONFIG_EFUSE_VIRTUAL_SIZE 0x2000
|
||||
#define CONFIG_EFUSE_MAX_BLK_LEN 256
|
||||
#define CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT 1
|
||||
@@ -0,0 +1,22 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
list(APPEND hal_srcs
|
||||
${esp_hal_dir}/components/esp_hw_support/port/${MCUBOOT_TARGET}/rtc_init.c
|
||||
${esp_hal_dir}/components/hal/cache_hal.c
|
||||
${esp_hal_dir}/components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c
|
||||
${esp_hal_dir}/components/esp_rom/patches/esp_rom_crc.c
|
||||
${esp_hal_dir}/components/esp_rom/patches/esp_rom_regi2c_esp32s2.c
|
||||
|
||||
)
|
||||
|
||||
list(APPEND LINKER_SCRIPTS
|
||||
-T${esp_hal_dir}/components/esp_rom/${MCUBOOT_TARGET}/ld/${MCUBOOT_TARGET}.rom.newlib-funcs.ld
|
||||
-T${esp_hal_dir}/components/esp_rom/${MCUBOOT_TARGET}/ld/${MCUBOOT_TARGET}.rom.spiflash.ld
|
||||
)
|
||||
|
||||
set_source_files_properties(
|
||||
${esp_hal_dir}/components/bootloader_support/src/esp32s2/bootloader_esp32s2.c
|
||||
PROPERTIES COMPILE_FLAGS
|
||||
"-Wno-unused-but-set-variable")
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define BOOTLOADER_BUILD 1
|
||||
#define CONFIG_IDF_FIRMWARE_CHIP_ID 0x0002
|
||||
#define CONFIG_IDF_TARGET_ESP32S2 1
|
||||
#define CONFIG_ESP32S2_REV_MIN_0 1
|
||||
#define CONFIG_ESP32S2_REV_MIN_FULL 0
|
||||
#define CONFIG_ESP_REV_MIN_FULL CONFIG_ESP32S2_REV_MIN_FULL
|
||||
#define CONFIG_ESP32S2_REV_MIN 0
|
||||
#define CONFIG_ESP32S2_REV_MAX_FULL 99
|
||||
#define CONFIG_ESP_REV_MAX_FULL CONFIG_ESP32S2_REV_MAX_FULL
|
||||
#define CONFIG_MMU_PAGE_SIZE 0x10000
|
||||
#define CONFIG_XTAL_FREQ 40
|
||||
#define CONFIG_SPI_FLASH_ROM_DRIVER_PATCH 1
|
||||
#define CONFIG_ESP32S2_XTAL_FREQ 40
|
||||
#define CONFIG_MCUBOOT 1
|
||||
#define NDEBUG 1
|
||||
#define CONFIG_BOOTLOADER_WDT_TIME_MS 9000
|
||||
#define CONFIG_ESP_CONSOLE_UART_BAUDRATE 115200
|
||||
#define CONFIG_BOOTLOADER_OFFSET_IN_FLASH 0x1000
|
||||
#define CONFIG_PARTITION_TABLE_OFFSET 0x10000
|
||||
#define CONFIG_EFUSE_VIRTUAL_OFFSET 0x250000
|
||||
#define CONFIG_EFUSE_VIRTUAL_SIZE 0x2000
|
||||
#define CONFIG_EFUSE_MAX_BLK_LEN 256
|
||||
#define CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT 1
|
||||
@@ -0,0 +1,25 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
list(APPEND hal_srcs
|
||||
${esp_hal_dir}/components/esp_hw_support/port/${MCUBOOT_TARGET}/rtc_init.c
|
||||
${esp_hal_dir}/components/hal/cache_hal.c
|
||||
${esp_hal_dir}/components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c
|
||||
)
|
||||
|
||||
if (DEFINED CONFIG_ESP_MULTI_PROCESSOR_BOOT)
|
||||
list(APPEND hal_srcs
|
||||
${src_dir}/${MCUBOOT_TARGET}/app_cpu_start.c
|
||||
${esp_hal_dir}/components/esp_hw_support/cpu.c
|
||||
)
|
||||
endif()
|
||||
|
||||
list(APPEND LINKER_SCRIPTS
|
||||
-T${esp_hal_dir}/components/esp_rom/${MCUBOOT_TARGET}/ld/${MCUBOOT_TARGET}.rom.newlib.ld
|
||||
)
|
||||
|
||||
set_source_files_properties(
|
||||
${esp_hal_dir}/components/bootloader_support/src/esp32s3/bootloader_esp32s3.c
|
||||
PROPERTIES COMPILE_FLAGS
|
||||
"-Wno-unused-variable -Wno-unused-but-set-variable")
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define BOOTLOADER_BUILD 1
|
||||
#define CONFIG_IDF_FIRMWARE_CHIP_ID 0x0009
|
||||
#define CONFIG_IDF_TARGET_ESP32S3 1
|
||||
#define CONFIG_ESP32S3_REV_MIN_0 1
|
||||
#define CONFIG_ESP32S3_REV_MIN_FULL 0
|
||||
#define CONFIG_ESP_REV_MIN_FULL CONFIG_ESP32S3_REV_MIN_FULL
|
||||
#define CONFIG_ESP32S3_REV_MIN 0
|
||||
#define CONFIG_ESP32S3_REV_MAX_FULL 99
|
||||
#define CONFIG_ESP_REV_MAX_FULL CONFIG_ESP32S3_REV_MAX_FULL
|
||||
#define CONFIG_MMU_PAGE_SIZE 0x10000
|
||||
#define CONFIG_XTAL_FREQ 40
|
||||
#define CONFIG_SPI_FLASH_ROM_DRIVER_PATCH 1
|
||||
#define CONFIG_MCUBOOT 1
|
||||
#define NDEBUG 1
|
||||
#define CONFIG_BOOTLOADER_WDT_TIME_MS 9000
|
||||
#define CONFIG_ESP_CONSOLE_UART_BAUDRATE 115200
|
||||
#define CONFIG_BOOTLOADER_OFFSET_IN_FLASH 0x0000
|
||||
#define CONFIG_PARTITION_TABLE_OFFSET 0x10000
|
||||
#define CONFIG_EFUSE_VIRTUAL_OFFSET 0x250000
|
||||
#define CONFIG_EFUSE_VIRTUAL_SIZE 0x2000
|
||||
#define CONFIG_EFUSE_MAX_BLK_LEN 256
|
||||
29
bootloader/mcuboot/boot/espressif/hal/include/esp_log.h
Normal file
29
bootloader/mcuboot/boot/espressif/hal/include/esp_log.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <inttypes.h>
|
||||
#include <mcuboot_config/mcuboot_logging.h>
|
||||
|
||||
/* Log levels from IDF are similar to MCUboot's */
|
||||
|
||||
#ifndef CONFIG_BOOTLOADER_LOG_LEVEL
|
||||
#define CONFIG_BOOTLOADER_LOG_LEVEL MCUBOOT_LOG_LEVEL
|
||||
#endif
|
||||
|
||||
#define ESP_LOGE(tag, fmt, ...) MCUBOOT_LOG_ERR("[%s] " fmt, tag, ##__VA_ARGS__)
|
||||
#define ESP_LOGW(tag, fmt, ...) MCUBOOT_LOG_WRN("[%s] " fmt, tag, ##__VA_ARGS__)
|
||||
#define ESP_LOGI(tag, fmt, ...) MCUBOOT_LOG_INF("[%s] " fmt, tag, ##__VA_ARGS__)
|
||||
#define ESP_LOGD(tag, fmt, ...) MCUBOOT_LOG_DBG("[%s] " fmt, tag, ##__VA_ARGS__)
|
||||
#define ESP_LOGV(tag, fmt, ...) MCUBOOT_LOG_DBG("[%s] " fmt, tag, ##__VA_ARGS__)
|
||||
|
||||
#define ESP_EARLY_LOGE(tag, fmt, ...) MCUBOOT_LOG_ERR("[%s] " fmt, tag, ##__VA_ARGS__)
|
||||
#define ESP_EARLY_LOGW(tag, fmt, ...) MCUBOOT_LOG_WRN("[%s] " fmt, tag, ##__VA_ARGS__)
|
||||
#define ESP_EARLY_LOGI(tag, fmt, ...) MCUBOOT_LOG_INF("[%s] " fmt, tag, ##__VA_ARGS__)
|
||||
#define ESP_EARLY_LOGD(tag, fmt, ...) MCUBOOT_LOG_DBG("[%s] " fmt, tag, ##__VA_ARGS__)
|
||||
#define ESP_EARLY_LOGV(tag, fmt, ...) MCUBOOT_LOG_DBG("[%s] " fmt, tag, ##__VA_ARGS__)
|
||||
|
||||
uint32_t esp_log_early_timestamp(void);
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/* Magic is derived from sha256sum of the string "espmcuboot"
|
||||
* The application header magic must match this number
|
||||
*/
|
||||
#define ESP_LOAD_HEADER_MAGIC 0xace637d3
|
||||
|
||||
/* Load header that should be a part of application image
|
||||
* for MCUboot-Espressif port booting.
|
||||
*/
|
||||
typedef struct esp_image_load_header {
|
||||
uint32_t header_magic; /* Magic for load header */
|
||||
uint32_t entry_addr; /* Application entry address */
|
||||
uint32_t iram_dest_addr; /* Destination address(VMA) for IRAM region */
|
||||
uint32_t iram_flash_offset; /* Flash offset(LMA) for start of IRAM region */
|
||||
uint32_t iram_size; /* Size of IRAM region */
|
||||
uint32_t dram_dest_addr; /* Destination address(VMA) for DRAM region */
|
||||
uint32_t dram_flash_offset; /* Flash offset(LMA) for start of DRAM region */
|
||||
uint32_t dram_size; /* Size of DRAM region */
|
||||
} esp_image_load_header_t;
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
extern void mcuboot_assert_handler(const char *file, int line, const char *func);
|
||||
|
||||
#ifdef assert
|
||||
#undef assert
|
||||
#endif
|
||||
#define assert(arg) \
|
||||
do { \
|
||||
if (!(arg)) { \
|
||||
mcuboot_assert_handler(__FILE__, __LINE__, __func__); \
|
||||
} \
|
||||
} while(0)
|
||||
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef __MCUBOOT_CONFIG_H__
|
||||
#define __MCUBOOT_CONFIG_H__
|
||||
|
||||
/*
|
||||
* Signature types
|
||||
*
|
||||
* You must choose exactly one signature type - check bootloader.conf
|
||||
* configuration file
|
||||
*/
|
||||
|
||||
/* Uncomment for RSA signature support */
|
||||
#if defined(CONFIG_ESP_SIGN_RSA)
|
||||
#define MCUBOOT_SIGN_RSA
|
||||
# if (CONFIG_ESP_SIGN_RSA_LEN != 2048 && \
|
||||
CONFIG_ESP_SIGN_RSA_LEN != 3072)
|
||||
# error "Invalid RSA key size (must be 2048 or 3072)"
|
||||
# else
|
||||
# define MCUBOOT_SIGN_RSA_LEN CONFIG_ESP_SIGN_RSA_LEN
|
||||
# endif
|
||||
#elif defined(CONFIG_ESP_SIGN_EC256)
|
||||
#define MCUBOOT_SIGN_EC256
|
||||
#elif defined(CONFIG_ESP_SIGN_ED25519)
|
||||
#define MCUBOOT_SIGN_ED25519
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SECURE_FLASH_ENC_ENABLED)
|
||||
#define MCUBOOT_BOOT_MAX_ALIGN 32
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Upgrade mode
|
||||
*
|
||||
* The default is to support A/B image swapping with rollback. Other modes
|
||||
* with simpler code path, which only supports overwriting the existing image
|
||||
* with the update image or running the newest image directly from its flash
|
||||
* partition, are also available.
|
||||
*
|
||||
* You can enable only one mode at a time from the list below to override
|
||||
* the default upgrade mode.
|
||||
*/
|
||||
|
||||
/* Uncomment to enable the overwrite-only code path. */
|
||||
/* #define MCUBOOT_OVERWRITE_ONLY */
|
||||
|
||||
#ifdef MCUBOOT_OVERWRITE_ONLY
|
||||
/* Uncomment to only erase and overwrite those primary slot sectors needed
|
||||
* to install the new image, rather than the entire image slot. */
|
||||
/* #define MCUBOOT_OVERWRITE_ONLY_FAST */
|
||||
#endif
|
||||
|
||||
/* Uncomment to enable the direct-xip code path. */
|
||||
/* #define MCUBOOT_DIRECT_XIP */
|
||||
|
||||
/* Uncomment to enable the ram-load code path. */
|
||||
/* #define MCUBOOT_RAM_LOAD */
|
||||
|
||||
/*
|
||||
* Cryptographic settings
|
||||
*
|
||||
* You must choose between Mbed TLS and Tinycrypt as source of
|
||||
* cryptographic primitives. Other cryptographic settings are also
|
||||
* available.
|
||||
*/
|
||||
|
||||
/* Uncomment to use Mbed TLS cryptographic primitives */
|
||||
#if defined(CONFIG_ESP_USE_MBEDTLS)
|
||||
#define MCUBOOT_USE_MBED_TLS
|
||||
#else
|
||||
/* MCUboot requires the definition of a crypto lib,
|
||||
* using Tinycrypt as default */
|
||||
#define MCUBOOT_USE_TINYCRYPT
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Always check the signature of the image in the primary slot before booting,
|
||||
* even if no upgrade was performed. This is recommended if the boot
|
||||
* time penalty is acceptable.
|
||||
*/
|
||||
#define MCUBOOT_VALIDATE_PRIMARY_SLOT
|
||||
|
||||
#ifdef CONFIG_ESP_DOWNGRADE_PREVENTION
|
||||
#define MCUBOOT_DOWNGRADE_PREVENTION 1
|
||||
/* MCUBOOT_DOWNGRADE_PREVENTION_SECURITY_COUNTER is used later as bool value so it is
|
||||
* always defined, (unlike MCUBOOT_DOWNGRADE_PREVENTION which is only used in
|
||||
* preprocessor condition and my be not defined) */
|
||||
# ifdef CONFIG_ESP_DOWNGRADE_PREVENTION_SECURITY_COUNTER
|
||||
# define MCUBOOT_DOWNGRADE_PREVENTION_SECURITY_COUNTER 1
|
||||
# else
|
||||
# define MCUBOOT_DOWNGRADE_PREVENTION_SECURITY_COUNTER 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Flash abstraction
|
||||
*/
|
||||
|
||||
/* Uncomment if your flash map API supports flash_area_get_sectors().
|
||||
* See the flash APIs for more details. */
|
||||
#define MCUBOOT_USE_FLASH_AREA_GET_SECTORS
|
||||
|
||||
/* Default maximum number of flash sectors per image slot; change
|
||||
* as desirable. */
|
||||
#define MCUBOOT_MAX_IMG_SECTORS 512
|
||||
|
||||
/* 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
|
||||
*/
|
||||
|
||||
/*
|
||||
* If logging is enabled the following functions must be defined by the
|
||||
* platform:
|
||||
*
|
||||
* MCUBOOT_LOG_MODULE_REGISTER(domain)
|
||||
* Register a new log module and add the current C file to it.
|
||||
*
|
||||
* MCUBOOT_LOG_MODULE_DECLARE(domain)
|
||||
* Add the current C file to an existing log module.
|
||||
*
|
||||
* MCUBOOT_LOG_ERR(...)
|
||||
* MCUBOOT_LOG_WRN(...)
|
||||
* MCUBOOT_LOG_INF(...)
|
||||
* MCUBOOT_LOG_DBG(...)
|
||||
*
|
||||
* The function priority is:
|
||||
*
|
||||
* MCUBOOT_LOG_ERR > MCUBOOT_LOG_WRN > MCUBOOT_LOG_INF > MCUBOOT_LOG_DBG
|
||||
*/
|
||||
#define MCUBOOT_HAVE_LOGGING 1
|
||||
/* #define MCUBOOT_LOG_LEVEL MCUBOOT_LOG_LEVEL_INFO */
|
||||
|
||||
/*
|
||||
* Assertions
|
||||
*/
|
||||
|
||||
/* Uncomment if your platform has its own mcuboot_config/mcuboot_assert.h.
|
||||
* If so, it must provide an ASSERT macro for use by bootutil. Otherwise,
|
||||
* "assert" is used. */
|
||||
#define MCUBOOT_HAVE_ASSERT_H 1
|
||||
|
||||
#ifdef CONFIG_ESP_MCUBOOT_SERIAL
|
||||
#define CONFIG_MCUBOOT_SERIAL
|
||||
#endif
|
||||
|
||||
/*
|
||||
* When a serial recovery process is receiving the image data, this option
|
||||
* enables it to erase flash progressively (by sectors) instead of the
|
||||
* default behavior that is erasing whole image size of flash area after
|
||||
* receiving first frame.
|
||||
* Enabling this options prevents stalling the beginning of transfer
|
||||
* for the time needed to erase large chunk of flash.
|
||||
*/
|
||||
#ifdef CONFIG_ESP_MCUBOOT_ERASE_PROGRESSIVELY
|
||||
#define MCUBOOT_ERASE_PROGRESSIVELY
|
||||
#endif
|
||||
|
||||
/* Serial extensions are not implemented
|
||||
*/
|
||||
#define MCUBOOT_PERUSER_MGMT_GROUP_ENABLED 0
|
||||
|
||||
/*
|
||||
* Watchdog feeding
|
||||
*/
|
||||
|
||||
/* This macro might be implemented if the OS / HW watchdog is enabled while
|
||||
* doing a swap upgrade and the time it takes for a swapping is long enough
|
||||
* to cause an unwanted reset. If implementing this, the OS main.c must also
|
||||
* enable the watchdog (if required)!
|
||||
*/
|
||||
#include <bootloader_wdt.h>
|
||||
#define MCUBOOT_WATCHDOG_FEED() \
|
||||
do { \
|
||||
bootloader_wdt_feed(); \
|
||||
} while (0)
|
||||
|
||||
#define MCUBOOT_CPU_IDLE() \
|
||||
do { \
|
||||
} while (0)
|
||||
|
||||
#endif /* __MCUBOOT_CONFIG_H__ */
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include "mcuboot_config.h"
|
||||
|
||||
extern int ets_printf(const char *fmt, ...);
|
||||
|
||||
#define MCUBOOT_LOG_LEVEL_OFF 0
|
||||
#define MCUBOOT_LOG_LEVEL_ERROR 1
|
||||
#define MCUBOOT_LOG_LEVEL_WARNING 2
|
||||
#define MCUBOOT_LOG_LEVEL_INFO 3
|
||||
#define MCUBOOT_LOG_LEVEL_DEBUG 4
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#define TARGET "[esp32]"
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||
#define TARGET "[esp32s2]"
|
||||
#elif CONFIG_IDF_TARGET_ESP32S3
|
||||
#define TARGET "[esp32s3]"
|
||||
#elif CONFIG_IDF_TARGET_ESP32C3
|
||||
#define TARGET "[esp32c3]"
|
||||
#elif CONFIG_IDF_TARGET_ESP32C6
|
||||
#define TARGET "[esp32c6]"
|
||||
#elif CONFIG_IDF_TARGET_ESP32C2
|
||||
#define TARGET "[esp32c2]"
|
||||
#elif CONFIG_IDF_TARGET_ESP32H2
|
||||
#define TARGET "[esp32h2]"
|
||||
#else
|
||||
#error "Selected target not supported."
|
||||
#endif
|
||||
|
||||
#ifndef MCUBOOT_LOG_LEVEL
|
||||
#define MCUBOOT_LOG_LEVEL MCUBOOT_LOG_LEVEL_INFO
|
||||
#endif
|
||||
|
||||
#if MCUBOOT_LOG_LEVEL >= MCUBOOT_LOG_LEVEL_ERROR
|
||||
#define MCUBOOT_LOG_ERR(_fmt, ...) \
|
||||
do { \
|
||||
ets_printf(TARGET " [ERR] " _fmt "\n\r", ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#else
|
||||
#define MCUBOOT_LOG_ERR(_fmt, ...)
|
||||
#endif
|
||||
|
||||
#if MCUBOOT_LOG_LEVEL >= MCUBOOT_LOG_LEVEL_WARNING
|
||||
#define MCUBOOT_LOG_WRN(_fmt, ...) \
|
||||
do { \
|
||||
ets_printf(TARGET " [WRN] " _fmt "\n\r", ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#else
|
||||
#define MCUBOOT_LOG_WRN(_fmt, ...)
|
||||
#endif
|
||||
|
||||
#if MCUBOOT_LOG_LEVEL >= MCUBOOT_LOG_LEVEL_INFO
|
||||
#define MCUBOOT_LOG_INF(_fmt, ...) \
|
||||
do { \
|
||||
ets_printf(TARGET " [INF] " _fmt "\n\r", ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#else
|
||||
#define MCUBOOT_LOG_INF(_fmt, ...)
|
||||
#endif
|
||||
|
||||
#if MCUBOOT_LOG_LEVEL >= MCUBOOT_LOG_LEVEL_DEBUG
|
||||
#define MCUBOOT_LOG_DBG(_fmt, ...) \
|
||||
do { \
|
||||
ets_printf(TARGET " [DBG] " _fmt "\n\r", ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#else
|
||||
#define MCUBOOT_LOG_DBG(_fmt, ...)
|
||||
#endif
|
||||
|
||||
#define MCUBOOT_LOG_MODULE_DECLARE(...)
|
||||
#define MCUBOOT_LOG_MODULE_REGISTER(...)
|
||||
15
bootloader/mcuboot/boot/espressif/hal/include/soc_log.h
Normal file
15
bootloader/mcuboot/boot/espressif/hal/include/soc_log.h
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <mcuboot_config/mcuboot_logging.h>
|
||||
#include <esp_rom_sys.h>
|
||||
|
||||
#define SOC_LOGE(tag, fmt, ...) MCUBOOT_LOG_ERR("[%s] " fmt, tag, ##__VA_ARGS__)
|
||||
#define SOC_LOGW(tag, fmt, ...) MCUBOOT_LOG_WRN("[%s] " fmt, tag, ##__VA_ARGS__)
|
||||
#define SOC_LOGI(tag, fmt, ...) MCUBOOT_LOG_INF("[%s] " fmt, tag, ##__VA_ARGS__)
|
||||
#define SOC_LOGD(tag, fmt, ...) MCUBOOT_LOG_DBG("[%s] " fmt, tag, ##__VA_ARGS__)
|
||||
Reference in New Issue
Block a user