Skip to content

Commit

Permalink
esp32c3-generic: add simple boot support
Browse files Browse the repository at this point in the history
The Simple Boot feature for Espressif chips is a method of booting
that doesn't depend on a 2nd stage bootloader. Its not the
intention to replace a 2nd stage bootloader such as MCUboot and
ESP-IDF bootloader, but to have a minimal and straight-forward way
of booting, and also simplify the building.

This commit also makes this bootloader configuration as default
for esp32c3-generic target and removes the need for running
'make bootloader' command for it.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
  • Loading branch information
almir-okato committed Jan 22, 2024
1 parent 02acf2d commit cb14874
Show file tree
Hide file tree
Showing 10 changed files with 693 additions and 71 deletions.
5 changes: 5 additions & 0 deletions arch/risc-v/src/espressif/Bootloader.mk
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ else
} >> $(BOOTLOADER_CONFIG)
endif

ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),y)
bootloader:
$(Q) echo "Using direct bootloader to boot NuttX."
else
ifeq ($(CONFIG_ESPRESSIF_BOOTLOADER_MCUBOOT),y)

BOOTLOADER_BIN = $(TOPDIR)/mcuboot-$(CHIP_SERIES).bin
Expand Down Expand Up @@ -123,3 +127,4 @@ clean_bootloader:
$(call DELFILE,$(TOPDIR)/partition-table-$(CHIP_SERIES).bin)

endif
endif
28 changes: 25 additions & 3 deletions arch/risc-v/src/espressif/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ config ESPRESSIF_ESP32C3
select ARCH_RV_ISA_M
select ARCH_RV_ISA_C
select ARCH_VECNOTIRQ
select ARCH_HAVE_BOOTLOADER
select ARCH_HAVE_BOOTLOADER if !ESPRESSIF_SIMPLE_BOOT
select ARCH_HAVE_MPU
select ARCH_HAVE_RESET
select ARCH_HAVE_RNG
Expand Down Expand Up @@ -121,6 +121,10 @@ config ESPRESSIF_FLASH_DETECT
---help---
Auto detect flash size when flashing.

config ESPRESSIF_NUM_CPUS
int
default 1 if ESPRESSIF_ESP32C3 || ESPRESSIF_ESP32C6 || ESPRESSIF_ESP32H2

choice ESPRESSIF_CPU_FREQ
prompt "CPU frequency"
default ESPRESSIF_CPU_FREQ_160 if ESPRESSIF_ESP32C3 || ESPRESSIF_ESP32C6
Expand Down Expand Up @@ -213,14 +217,32 @@ config ESPRESSIF_SOC_RTC_MEM_SUPPORTED

menu "Bootloader and Image Configuration"

choice
prompt "Bootloader type"
default ESPRESSIF_SIMPLE_BOOT
depends on ESPRESSIF_ESP32C3
---help---
Bootloader type

config ESPRESSIF_BOOTLOADER_MCUBOOT
bool "Enable Native MCUboot"
select ESPRESSIF_HAVE_OTA_PARTITION
depends on ESPRESSIF_ESP32C3
default n
---help---
Enables the Espressif port of MCUboot bootloader.

config ESPRESSIF_SIMPLE_BOOT
bool "Enable Simple Boot mode"
depends on ESPRESSIF_ESP32C3
---help---
Enables the Simple Boot, a method of booting that doesn't depend on a
2nd stage bootloader. Please note that some of the ESP-IDF bootloader
features are not available using direct boot, such as partition tables
and OTA. However, most of these features are implemented in NuttX and
MCUboot.

endchoice

config ESPRESSIF_MCUBOOT_VERSION
string "MCUboot version"
depends on ESPRESSIF_BOOTLOADER_MCUBOOT
Expand Down Expand Up @@ -259,7 +281,7 @@ config ESPRESSIF_APP_MCUBOOT_HEADER_SIZE
config ESPRESSIF_PARTITION_TABLE_OFFSET
hex "Partition Table offset"
default 0x8000
depends on !ESPRESSIF_BOOTLOADER_MCUBOOT
depends on !ESPRESSIF_BOOTLOADER_MCUBOOT && !ESPRESSIF_SIMPLE_BOOT

config ESPRESSIF_HAVE_OTA_PARTITION
bool
Expand Down
2 changes: 1 addition & 1 deletion arch/risc-v/src/espressif/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ endif

ESP_HAL_3RDPARTY_REPO = esp-hal-3rdparty
ifndef ESP_HAL_3RDPARTY_VERSION
ESP_HAL_3RDPARTY_VERSION = 22804823777dbbb7f43925b7729b3a32331aa7cd
ESP_HAL_3RDPARTY_VERSION = b6a943764f5e5a12d12edd8a6d71bdecc505428c
endif

ifndef ESP_HAL_3RDPARTY_URL
Expand Down
Loading

0 comments on commit cb14874

Please sign in to comment.