feat(partitions): Adds new partition types and subtypes for bootloader and partition_table

This commit is contained in:
Konstantin Kondrashov
2024-08-12 12:49:27 +03:00
parent 0db772efff
commit d5f37b526d
7 changed files with 90 additions and 8 deletions

View File

@@ -67,6 +67,12 @@ typedef enum {
* @internal Keep this enum in sync with PartitionDefinition class gen_esp32part.py @endinternal
*/
typedef enum {
ESP_PARTITION_SUBTYPE_BOOTLOADER_PRIMARY = 0x00, //!< Primary Bootloader
ESP_PARTITION_SUBTYPE_BOOTLOADER_OTA = 0x01, //!< Temporary OTA storage for Bootloader, where the OTA uploads a new Bootloader image
ESP_PARTITION_SUBTYPE_PARTITION_TABLE_PRIMARY = 0x00, //!< Primary Partition table
ESP_PARTITION_SUBTYPE_PARTITION_TABLE_OTA = 0x01, //!< Temporary OTA storage for Partition table, where the OTA uploads a new Partition table image
ESP_PARTITION_SUBTYPE_APP_FACTORY = 0x00, //!< Factory application partition
ESP_PARTITION_SUBTYPE_APP_OTA_MIN = 0x10, //!< Base for OTA partition subtypes
ESP_PARTITION_SUBTYPE_APP_OTA_0 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 0, //!< OTA partition 0

View File

@@ -67,6 +67,8 @@ const char *esp_partition_type_to_str(const uint32_t type)
switch (type) {
case PART_TYPE_APP: return "app";
case PART_TYPE_DATA: return "data";
case PART_TYPE_BOOTLOADER: return "bootloader";
case PART_TYPE_PARTITION_TABLE: return "partition_table";
default: return "unknown";
}
}
@@ -74,6 +76,18 @@ const char *esp_partition_type_to_str(const uint32_t type)
const char *esp_partition_subtype_to_str(const uint32_t type, const uint32_t subtype)
{
switch (type) {
case PART_TYPE_BOOTLOADER:
switch (subtype) {
case PART_SUBTYPE_BOOTLOADER_PRIMARY: return "primary";
case PART_SUBTYPE_BOOTLOADER_OTA: return "ota";
default: return "unknown";
}
case PART_TYPE_PARTITION_TABLE:
switch (subtype) {
case PART_SUBTYPE_PARTITION_TABLE_PRIMARY: return "primary";
case PART_SUBTYPE_PARTITION_TABLE_OTA: return "ota";
default: return "unknown";
}
case PART_TYPE_APP:
switch (subtype) {
case PART_SUBTYPE_FACTORY: return "factory";