mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 23:03:27 +08:00
xtensa/esp32: Refactor and reorganize Partition Table related configs
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
793266d39e
commit
b555b3f89e
@@ -907,6 +907,23 @@ config ESP32_SPIFLASH_DEBUG
|
|||||||
Enable this option, read and write of SPI Flash
|
Enable this option, read and write of SPI Flash
|
||||||
will show input arguments and result.
|
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
|
endmenu # ESP32_SPIFLASH
|
||||||
|
|
||||||
menu "SPI RAM Config"
|
menu "SPI RAM Config"
|
||||||
@@ -1337,32 +1354,12 @@ config ESP32_APP_MCUBOOT_HEADER_SIZE
|
|||||||
default 32
|
default 32
|
||||||
depends on ESP32_APP_FORMAT_MCUBOOT
|
depends on ESP32_APP_FORMAT_MCUBOOT
|
||||||
|
|
||||||
endmenu # Application Image Configuration
|
config ESP32_PARTITION_TABLE_OFFSET
|
||||||
|
hex "Partition Table offset"
|
||||||
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"
|
|
||||||
default "0x8000"
|
default "0x8000"
|
||||||
|
depends on ESP32_APP_FORMAT_LEGACY
|
||||||
|
|
||||||
config ESP32_PARTITION_MOUNT
|
endmenu # Application Image Configuration
|
||||||
string "Partition mount point"
|
|
||||||
default "/dev/esp/partition/"
|
|
||||||
|
|
||||||
endmenu # Partition Configuration
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
config ESP32_AUTO_SLEEP
|
config ESP32_AUTO_SLEEP
|
||||||
bool "Auto-sleep"
|
bool "Auto-sleep"
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ ifeq ($(CONFIG_ESP32_FREERUN),y)
|
|||||||
CHIP_CSRCS += esp32_freerun.c
|
CHIP_CSRCS += esp32_freerun.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ESP32_PARTITION),y)
|
ifeq ($(CONFIG_ESP32_PARTITION_TABLE),y)
|
||||||
CHIP_CSRCS += esp32_partition.c
|
CHIP_CSRCS += esp32_partition.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -59,11 +59,11 @@
|
|||||||
|
|
||||||
/* Partition offset in SPI Flash */
|
/* 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 */
|
/* Partition MTD device mount point */
|
||||||
|
|
||||||
#define ESP32_PARTITION_MOUNT CONFIG_ESP32_PARTITION_MOUNT
|
#define PARTITION_MOUNT_POINT CONFIG_ESP32_PARTITION_MOUNTPT
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Types
|
* Private Types
|
||||||
@@ -566,7 +566,7 @@ int esp32_partition_init(void)
|
|||||||
struct mtd_dev_priv *mtd_priv;
|
struct mtd_dev_priv *mtd_priv;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
const int num = PARTITION_MAX_SIZE / sizeof(struct partition_info_priv);
|
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 label[PARTITION_LABEL_LEN + 1];
|
||||||
char path[PARTITION_LABEL_LEN + sizeof(path_base)];
|
char path[PARTITION_LABEL_LEN + sizeof(path_base)];
|
||||||
|
|
||||||
@@ -594,8 +594,7 @@ int esp32_partition_init(void)
|
|||||||
goto errout_with_mtd;
|
goto errout_with_mtd;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = MTD_READ(mtd, ESP32_PARTITION_OFFSET,
|
ret = MTD_READ(mtd, PARTITION_TABLE_OFFSET, PARTITION_MAX_SIZE, pbuf);
|
||||||
PARTITION_MAX_SIZE, pbuf);
|
|
||||||
if (ret != PARTITION_MAX_SIZE)
|
if (ret != PARTITION_MAX_SIZE)
|
||||||
{
|
{
|
||||||
ferr("ERROR: Failed to get read data from MTD\n");
|
ferr("ERROR: Failed to get read data from MTD\n");
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ int esp32_bringup(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_ESP32_PARTITION
|
#ifdef CONFIG_ESP32_PARTITION_TABLE
|
||||||
ret = esp32_partition_init();
|
ret = esp32_partition_init();
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ int esp32_bringup(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_ESP32_PARTITION
|
#ifdef CONFIG_ESP32_PARTITION_TABLE
|
||||||
ret = esp32_partition_init();
|
ret = esp32_partition_init();
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ int esp32_bringup(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_ESP32_PARTITION
|
#ifdef CONFIG_ESP32_PARTITION_TABLE
|
||||||
ret = esp32_partition_init();
|
ret = esp32_partition_init();
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ int esp32_bringup(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_ESP32_PARTITION
|
#ifdef CONFIG_ESP32_PARTITION_TABLE
|
||||||
ret = esp32_partition_init();
|
ret = esp32_partition_init();
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user