Skip to content

Commit a8dab19

Browse files
committed
Add support for custom partition types and sub-types
1 parent 2c6f25f commit a8dab19

File tree

3 files changed

+172
-44
lines changed

3 files changed

+172
-44
lines changed

espflash/src/error.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::{
1313
elf::{FlashFrequency, FlashMode},
1414
flasher::FlashSize,
1515
image_format::ImageFormatId,
16-
partition_table::{SubType, Type},
16+
partition_table::{CoreType, SubType, Type},
1717
Chip,
1818
};
1919

@@ -413,9 +413,10 @@ impl CSVError {
413413
help = format!(
414414
"the following sub-types are supported:
415415
{} for data partitions
416-
{} for app partitions\n\n",
417-
Type::Data.subtype_hint(),
418-
Type::App.subtype_hint()
416+
{} for app partitions
417+
0x00-0xFE for custom partitions\n\n",
418+
CoreType::Data.subtype_hint(),
419+
CoreType::App.subtype_hint()
419420
)
420421
}
421422

espflash/src/image_format/esp32bootloader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::{
1313
error::{Error, FlashDetectError},
1414
flasher::FlashSize,
1515
image_format::{EspCommonHeader, ImageFormat, SegmentHeader, ESP_MAGIC, WP_PIN_DISABLED},
16-
partition_table::Type,
16+
partition_table::{CoreType, Type},
1717
Chip, PartitionTable,
1818
};
1919

@@ -158,7 +158,7 @@ impl<'a> Esp32BootloaderFormat<'a> {
158158
// partition, and use any available "app" partitions if not present.
159159
let factory_partition = partition_table
160160
.find("factory")
161-
.or_else(|| partition_table.find_by_type(Type::App))
161+
.or_else(|| partition_table.find_by_type(Type::CoreType(CoreType::App)))
162162
.unwrap();
163163

164164
let flash_segment = RomSegment {

0 commit comments

Comments
 (0)