Skip to content

Commit 42e679d

Browse files
almir-okatoutzig
authored andcommitted
espressif:esp32s3: Add esp32s3 initial support
ESP32-S3 target and related files added to the Espressif port. Signed-off-by: Almir Okato <almir.okato@espressif.com>
1 parent 553315c commit 42e679d

File tree

15 files changed

+573
-28
lines changed

15 files changed

+573
-28
lines changed

.github/workflows/espressif.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
environment:
1919
strategy:
2020
matrix:
21-
targets: [esp32, esp32s2, esp32c3]
21+
targets: [esp32, esp32s2, esp32s3, esp32c3]
2222
features:
2323
- "sign-rsa2048,sign-rsa3072,sign-ec256,sign-ed25519"
2424
runs-on: ubuntu-latest

.gitmodules

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@
2525
[submodule "boot/espressif/hal/esp-idf"]
2626
path = boot/espressif/hal/esp-idf
2727
url = https://github.com/espressif/esp-idf.git
28-
branch = release/v4.3
28+
branch = release/v4.4

boot/espressif/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ project(mcuboot_${MCUBOOT_TARGET})
1313
add_definitions(-DMCUBOOT_TARGET=${MCUBOOT_TARGET})
1414

1515
if ("${MCUBOOT_TARGET}" STREQUAL "esp32" OR
16-
"${MCUBOOT_TARGET}" STREQUAL "esp32s2")
16+
"${MCUBOOT_TARGET}" STREQUAL "esp32s2" OR
17+
"${MCUBOOT_TARGET}" STREQUAL "esp32s3")
1718
set(MCUBOOT_ARCH "xtensa")
1819
elseif("${MCUBOOT_TARGET}" STREQUAL "esp32c3")
1920
set(MCUBOOT_ARCH "riscv")

boot/espressif/hal/CMakeLists.txt

+6-24
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@ list(APPEND include_dirs
1919
${esp_idf_dir}/components/esp_common/include
2020
${esp_idf_dir}/components/esp_rom/include
2121
${esp_idf_dir}/components/esp_rom/include/${MCUBOOT_TARGET}
22+
${esp_idf_dir}/components/esp_rom/${MCUBOOT_TARGET}
2223
${esp_idf_dir}/components/spi_flash/include
2324
${esp_idf_dir}/components/spi_flash/include/spi_flash
24-
${esp_idf_dir}/components/soc/include
25-
${esp_idf_dir}/components/soc/${MCUBOOT_TARGET}/include
2625
${esp_idf_dir}/components/esp_hw_support/include
2726
${esp_idf_dir}/components/esp_hw_support/include/soc
27+
${esp_idf_dir}/components/esp_hw_support/include/soc/${MCUBOOT_TARGET}
28+
${esp_idf_dir}/components/esp_hw_support/port/include
2829
${esp_idf_dir}/components/esp_hw_support/port/${MCUBOOT_TARGET}
2930
${esp_idf_dir}/components/esp_hw_support/port/${MCUBOOT_TARGET}/private_include
31+
${esp_idf_dir}/components/soc/include
32+
${esp_idf_dir}/components/soc/${MCUBOOT_TARGET}/include
3033
${esp_idf_dir}/components/bootloader_support/include
3134
${esp_idf_dir}/components/bootloader_support/include_bootloader
3235
${esp_idf_dir}/components/hal/include
@@ -41,12 +44,6 @@ list(APPEND include_dirs
4144
${esp_idf_dir}/components/newlib/platform_include
4245
)
4346

44-
if("${MCUBOOT_TARGET}" STREQUAL "esp32")
45-
list(APPEND include_dirs
46-
${esp_idf_dir}/components/${MCUBOOT_TARGET}/include
47-
)
48-
endif()
49-
5047
if("${MCUBOOT_ARCH}" STREQUAL "xtensa")
5148
list(APPEND include_dirs
5249
${esp_idf_dir}/components/${MCUBOOT_ARCH}/${MCUBOOT_TARGET}/include
@@ -72,6 +69,7 @@ set(hal_srcs
7269
${esp_idf_dir}/components/bootloader_support/src/bootloader_utility.c
7370
${esp_idf_dir}/components/bootloader_support/src/esp_image_format.c
7471
${esp_idf_dir}/components/bootloader_support/src/secure_boot_v2/secure_boot_signatures_bootloader.c
72+
${esp_idf_dir}/components/bootloader_support/src/${MCUBOOT_TARGET}/bootloader_soc.c
7573
${esp_idf_dir}/components/bootloader_support/src/${MCUBOOT_TARGET}/bootloader_sha.c
7674
${esp_idf_dir}/components/bootloader_support/src/${MCUBOOT_TARGET}/secure_boot_secure_features.c
7775
${esp_idf_dir}/components/bootloader_support/src/${MCUBOOT_TARGET}/flash_encryption_secure_features.c
@@ -93,16 +91,6 @@ set(hal_srcs
9391
${esp_idf_dir}/components/efuse/${MCUBOOT_TARGET}/esp_efuse_utility.c
9492
)
9593

96-
if("${MCUBOOT_TARGET}" STREQUAL "esp32")
97-
list(APPEND hal_srcs
98-
${esp_idf_dir}/components/efuse/src/esp_efuse_api_key_esp32.c
99-
)
100-
else()
101-
list(APPEND hal_srcs
102-
${esp_idf_dir}/components/efuse/src/esp_efuse_api_key_esp32xx.c
103-
)
104-
endif()
105-
10694
if("${MCUBOOT_ARCH}" STREQUAL "xtensa")
10795
list(APPEND hal_srcs
10896
${esp_idf_dir}/components/esp_rom/patches/esp_rom_longjmp.S
@@ -165,12 +153,6 @@ set(LINKER_SCRIPTS
165153
-T${esp_idf_dir}/components/soc/${MCUBOOT_TARGET}/ld/${MCUBOOT_TARGET}.peripherals.ld
166154
)
167155

168-
if("${MCUBOOT_TARGET}" STREQUAL "esp32" OR "${MCUBOOT_TARGET}" STREQUAL "esp32c3")
169-
list(APPEND LINKER_SCRIPTS
170-
-T${esp_idf_dir}/components/esp_rom/${MCUBOOT_TARGET}/ld/${MCUBOOT_TARGET}.rom.eco3.ld
171-
)
172-
endif()
173-
174156
include(${CMAKE_CURRENT_LIST_DIR}/include/${MCUBOOT_TARGET}/${MCUBOOT_TARGET}.cmake)
175157

176158
add_library(hal STATIC ${hal_srcs} ${include_dirs})

boot/espressif/hal/esp-idf

Submodule esp-idf updated 293 files
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
list(APPEND include_dirs
6+
${esp_idf_dir}/components/${MCUBOOT_TARGET}/include
7+
)
8+
9+
list(APPEND hal_srcs
10+
${esp_idf_dir}/components/efuse/src/esp_efuse_api_key_esp32.c
11+
)
12+
113
list(APPEND LINKER_SCRIPTS
214
-T${esp_idf_dir}/components/esp_rom/${MCUBOOT_TARGET}/ld/${MCUBOOT_TARGET}.rom.newlib-funcs.ld
15+
-T${esp_idf_dir}/components/esp_rom/${MCUBOOT_TARGET}/ld/${MCUBOOT_TARGET}.rom.eco3.ld
316
)

boot/espressif/hal/include/esp32c3/esp32c3.cmake

+6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
15
list(APPEND hal_srcs
26
${esp_idf_dir}/components/bootloader_support/src/flash_qio_mode.c
37
${esp_idf_dir}/components/esp_hw_support/port/${MCUBOOT_TARGET}/cpu_util_esp32c3.c
8+
${esp_idf_dir}/components/efuse/src/esp_efuse_api_key_esp32xx.c
49
)
510

611
list(APPEND LINKER_SCRIPTS
712
-T${esp_idf_dir}/components/esp_rom/${MCUBOOT_TARGET}/ld/${MCUBOOT_TARGET}.rom.newlib.ld
13+
-T${esp_idf_dir}/components/esp_rom/${MCUBOOT_TARGET}/ld/${MCUBOOT_TARGET}.rom.eco3.ld
814
)
915

1016
set_source_files_properties(

boot/espressif/hal/include/esp32s2/esp32s2.cmake

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
15
list(APPEND hal_srcs
26
${esp_idf_dir}/components/esp_hw_support/port/${MCUBOOT_TARGET}/regi2c_ctrl.c
7+
${esp_idf_dir}/components/efuse/src/esp_efuse_api_key_esp32xx.c
38
)
49

510
list(APPEND LINKER_SCRIPTS
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
list(APPEND hal_srcs
6+
${esp_idf_dir}/components/efuse/src/esp_efuse_api_key_esp32xx.c
7+
)
8+
9+
list(APPEND LINKER_SCRIPTS
10+
-T${esp_idf_dir}/components/esp_rom/${MCUBOOT_TARGET}/ld/${MCUBOOT_TARGET}.rom.newlib.ld
11+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#define BOOTLOADER_BUILD 1
8+
#define CONFIG_IDF_FIRMWARE_CHIP_ID 0x0009
9+
#define CONFIG_IDF_TARGET_ESP32S3 1
10+
#define CONFIG_SPI_FLASH_ROM_DRIVER_PATCH 1
11+
#define CONFIG_MCUBOOT 1
12+
#define NDEBUG 1
13+
#define CONFIG_BOOTLOADER_WDT_TIME_MS 9000
14+
#define CONFIG_ESP_CONSOLE_UART_BAUDRATE 115200
15+
#define CONFIG_BOOTLOADER_OFFSET_IN_FLASH 0x0000
16+
#define CONFIG_PARTITION_TABLE_OFFSET 0x10000
17+
#define CONFIG_EFUSE_VIRTUAL_OFFSET 0x250000
18+
#define CONFIG_EFUSE_VIRTUAL_SIZE 0x2000
19+
#define CONFIG_EFUSE_MAX_BLK_LEN 256

boot/espressif/hal/include/mcuboot_config/mcuboot_logging.h

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ extern int ets_printf(const char *fmt, ...);
2121
#define TARGET "[esp32]"
2222
#elif CONFIG_IDF_TARGET_ESP32S2
2323
#define TARGET "[esp32s2]"
24+
#elif CONFIG_IDF_TARGET_ESP32S3
25+
#define TARGET "[esp32s3]"
2426
#elif CONFIG_IDF_TARGET_ESP32C3
2527
#define TARGET "[esp32c3]"
2628
#else

0 commit comments

Comments
 (0)