xtensa/esp32: Refactor and reorganize Partition Table related configs

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
This commit is contained in:
Gustavo Henrique Nihei 2021-10-08 13:42:23 -03:00 committed by Alan Carvalho de Assis
parent 793266d39e
commit b555b3f89e
7 changed files with 30 additions and 34 deletions

View File

@ -907,6 +907,23 @@ config ESP32_SPIFLASH_DEBUG
Enable this option, read and write of SPI Flash
will show input arguments and result.
if ESP32_APP_FORMAT_LEGACY
comment "Partition Table configuration"
config ESP32_PARTITION_TABLE
bool "Create MTD partitions from Partition Table"
default n
---help---
Decode partition table and initialize partitions as MTD.
config ESP32_PARTITION_MOUNTPT
string "Partition mount point"
default "/dev/esp/partition/"
depends on ESP32_PARTITION_TABLE
endif
endmenu # ESP32_SPIFLASH
menu "SPI RAM Config"
@ -1337,32 +1354,12 @@ config ESP32_APP_MCUBOOT_HEADER_SIZE
default 32
depends on ESP32_APP_FORMAT_MCUBOOT
endmenu # Application Image Configuration
if ESP32_APP_FORMAT_LEGACY
config ESP32_PARTITION
bool "ESP32 Partition"
default n
select ESP32_SPIFLASH
---help---
Decode esp-idf's partition file and initialize
partition by nuttx MTD.
menu "Partition Configuration"
depends on ESP32_PARTITION
config ESP32_PARTITION_OFFSET
hex "Partition offset"
config ESP32_PARTITION_TABLE_OFFSET
hex "Partition Table offset"
default "0x8000"
depends on ESP32_APP_FORMAT_LEGACY
config ESP32_PARTITION_MOUNT
string "Partition mount point"
default "/dev/esp/partition/"
endmenu # Partition Configuration
endif
endmenu # Application Image Configuration
config ESP32_AUTO_SLEEP
bool "Auto-sleep"

View File

@ -167,7 +167,7 @@ ifeq ($(CONFIG_ESP32_FREERUN),y)
CHIP_CSRCS += esp32_freerun.c
endif
ifeq ($(CONFIG_ESP32_PARTITION),y)
ifeq ($(CONFIG_ESP32_PARTITION_TABLE),y)
CHIP_CSRCS += esp32_partition.c
endif

View File

@ -59,11 +59,11 @@
/* Partition offset in SPI Flash */
#define ESP32_PARTITION_OFFSET CONFIG_ESP32_PARTITION_OFFSET
#define PARTITION_TABLE_OFFSET CONFIG_ESP32_PARTITION_TABLE_OFFSET
/* Partition MTD device mount point */
#define ESP32_PARTITION_MOUNT CONFIG_ESP32_PARTITION_MOUNT
#define PARTITION_MOUNT_POINT CONFIG_ESP32_PARTITION_MOUNTPT
/****************************************************************************
* Private Types
@ -566,7 +566,7 @@ int esp32_partition_init(void)
struct mtd_dev_priv *mtd_priv;
int ret = 0;
const int num = PARTITION_MAX_SIZE / sizeof(struct partition_info_priv);
const char path_base[] = ESP32_PARTITION_MOUNT;
const char path_base[] = PARTITION_MOUNT_POINT;
char label[PARTITION_LABEL_LEN + 1];
char path[PARTITION_LABEL_LEN + sizeof(path_base)];
@ -594,8 +594,7 @@ int esp32_partition_init(void)
goto errout_with_mtd;
}
ret = MTD_READ(mtd, ESP32_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");

View File

@ -206,7 +206,7 @@ int esp32_bringup(void)
}
#endif
#ifdef CONFIG_ESP32_PARTITION
#ifdef CONFIG_ESP32_PARTITION_TABLE
ret = esp32_partition_init();
if (ret < 0)
{

View File

@ -151,7 +151,7 @@ int esp32_bringup(void)
}
#endif
#ifdef CONFIG_ESP32_PARTITION
#ifdef CONFIG_ESP32_PARTITION_TABLE
ret = esp32_partition_init();
if (ret < 0)
{

View File

@ -185,7 +185,7 @@ int esp32_bringup(void)
}
#endif
#ifdef CONFIG_ESP32_PARTITION
#ifdef CONFIG_ESP32_PARTITION_TABLE
ret = esp32_partition_init();
if (ret < 0)
{

View File

@ -176,7 +176,7 @@ int esp32_bringup(void)
}
#endif
#ifdef CONFIG_ESP32_PARTITION
#ifdef CONFIG_ESP32_PARTITION_TABLE
ret = esp32_partition_init();
if (ret < 0)
{