diff --git a/arch/risc-v/src/esp32c3/Kconfig b/arch/risc-v/src/esp32c3/Kconfig index 93056580fa8..e59e9aa6d02 100644 --- a/arch/risc-v/src/esp32c3/Kconfig +++ b/arch/risc-v/src/esp32c3/Kconfig @@ -895,6 +895,23 @@ config ESP32C3_SPIFLASH_DEBUG If this option is enabled, SPI Flash driver read and write functions will output input parameters and return values (if applicable). +if ESP32C3_APP_FORMAT_LEGACY + +comment "Partition Table configuration" + +config ESP32C3_PARTITION_TABLE + bool "Create MTD partitions from Partition Table" + default n + ---help--- + Decode partition table and initialize partitions as MTD. + +config ESP32C3_PARTITION_MOUNTPT + string "Partition mount point" + default "/dev/esp/partition/" + depends on ESP32C3_PARTITION_TABLE + +endif + endmenu # SPI Flash configuration menu "GDMA Configuration" @@ -1019,30 +1036,11 @@ config ESP32C3_APP_MCUBOOT_HEADER_SIZE default 32 depends on ESP32C3_APP_FORMAT_MCUBOOT +config ESP32C3_PARTITION_TABLE_OFFSET + hex "Partition Table offset" + default "0x8000" + depends on ESP32C3_APP_FORMAT_LEGACY + endmenu # Application Image Configuration -if ESP32C3_APP_FORMAT_LEGACY - -config ESP32C3_PARTITION - bool "ESP32-C3 Partition" - default n - select ESP32C3_SPIFLASH - ---help--- - Decode partition file and initialize partition as MTD. - -menu "Partition Configuration" - depends on ESP32C3_PARTITION - -config ESP32C3_PARTITION_OFFSET - hex "Partition offset" - default "0x8000" - -config ESP32C3_PARTITION_MOUNT - string "Partition mount point" - default "/dev/esp/partition/" - -endmenu # Partition Configuration - -endif - endif # ARCH_CHIP_ESP32C3 diff --git a/arch/risc-v/src/esp32c3/Make.defs b/arch/risc-v/src/esp32c3/Make.defs index 5ac41244b52..5c9039b9a51 100644 --- a/arch/risc-v/src/esp32c3/Make.defs +++ b/arch/risc-v/src/esp32c3/Make.defs @@ -83,7 +83,7 @@ ifeq ($(CONFIG_ESP32C3_SPIFLASH),y) CHIP_CSRCS += esp32c3_spiflash.c endif -ifeq ($(CONFIG_ESP32C3_PARTITION),y) +ifeq ($(CONFIG_ESP32C3_PARTITION_TABLE),y) CHIP_CSRCS += esp32c3_partition.c endif diff --git a/arch/risc-v/src/esp32c3/esp32c3_partition.c b/arch/risc-v/src/esp32c3/esp32c3_partition.c index 7fa1083d1c4..7850f67b58f 100644 --- a/arch/risc-v/src/esp32c3/esp32c3_partition.c +++ b/arch/risc-v/src/esp32c3/esp32c3_partition.c @@ -59,11 +59,11 @@ /* Partition offset in SPI Flash */ -#define ESP32C3_PARTITION_OFFSET CONFIG_ESP32C3_PARTITION_OFFSET +#define PARTITION_TABLE_OFFSET CONFIG_ESP32C3_PARTITION_TABLE_OFFSET /* Partition MTD device mount point */ -#define ESP32C3_PARTITION_MOUNT CONFIG_ESP32C3_PARTITION_MOUNT +#define PARTITION_MOUNT_POINT CONFIG_ESP32C3_PARTITION_MOUNTPT /**************************************************************************** * Private Types @@ -567,7 +567,7 @@ int esp32c3_partition_init(void) struct mtd_dev_priv_s *mtd_priv; int ret = 0; const int num = PARTITION_MAX_SIZE / sizeof(struct partition_info_priv_s); - const char path_base[] = ESP32C3_PARTITION_MOUNT; + const char path_base[] = PARTITION_MOUNT_POINT; char label[PARTITION_LABEL_LEN + 1]; char path[PARTITION_LABEL_LEN + sizeof(path_base)]; @@ -595,8 +595,7 @@ int esp32c3_partition_init(void) goto errout_with_mtd; } - ret = MTD_READ(mtd, ESP32C3_PARTITION_OFFSET, - PARTITION_MAX_SIZE, pbuf); + ret = MTD_READ(mtd, PARTITION_TABLE_OFFSET, PARTITION_MAX_SIZE, pbuf); if (ret != PARTITION_MAX_SIZE) { ferr("ERROR: Failed to get read data from MTD\n"); diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_bringup.c b/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_bringup.c index fc0de5ab31e..3ca88c26aa2 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_bringup.c +++ b/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_bringup.c @@ -155,7 +155,7 @@ int esp32c3_bringup(void) } #endif -#ifdef CONFIG_ESP32C3_PARTITION +#ifdef CONFIG_ESP32C3_PARTITION_TABLE ret = esp32c3_partition_init(); if (ret < 0) {