From 0641b71d44616275140c4c5032008f860e68b545 Mon Sep 17 00:00:00 2001 From: Joseph Ross Date: Sat, 2 Nov 2024 01:01:35 -0700 Subject: [PATCH] Allow `partition_table_offset` to be specified in the config file. (for #699) (#700) --- CHANGELOG.md | 2 ++ espflash/src/cli/config.rs | 3 +++ espflash/src/cli/mod.rs | 6 +++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de5c4a5e..f65e5af7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Allow `partition_table_offset` to be specified in the config file. (for #699) + ### Changed ### Fixed diff --git a/espflash/src/cli/config.rs b/espflash/src/cli/config.rs index 61a825cf..6e4d7b2d 100644 --- a/espflash/src/cli/config.rs +++ b/espflash/src/cli/config.rs @@ -87,6 +87,9 @@ pub struct Config { /// Partition table path #[serde(default)] pub partition_table: Option, + /// Partition table offset + #[serde(default)] + pub partition_table_offset: Option, /// Preferred USB devices #[serde(default)] pub usb_device: Vec, diff --git a/espflash/src/cli/mod.rs b/espflash/src/cli/mod.rs index 62ee4f5b..5166aced 100644 --- a/espflash/src/cli/mod.rs +++ b/espflash/src/cli/mod.rs @@ -826,6 +826,10 @@ pub fn make_flash_data( .or(config.partition_table.as_deref()) .or(default_partition_table); + let partition_table_offset = image_args + .partition_table_offset + .or(config.partition_table_offset); + if let Some(path) = &bootloader { println!("Bootloader: {}", path.display()); } @@ -837,7 +841,7 @@ pub fn make_flash_data( FlashData::new( bootloader, partition_table, - image_args.partition_table_offset, + partition_table_offset, image_args.target_app_partition, flash_settings, image_args.min_chip_rev,