Skip to content

Commit

Permalink
Allow partition_table_offset to be specified in the config file. (for
Browse files Browse the repository at this point in the history
  • Loading branch information
jnross committed Nov 1, 2024
1 parent 95539cc commit b62056f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions espflash/src/cli/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ pub struct Config {
/// Partition table path
#[serde(default)]
pub partition_table: Option<PathBuf>,
/// Partition table offset
#[serde(default)]
pub partition_table_offset: Option<u32>,
/// Preferred USB devices
#[serde(default)]
pub usb_device: Vec<UsbDevice>,
Expand Down
6 changes: 5 additions & 1 deletion espflash/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand All @@ -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,
Expand Down

0 comments on commit b62056f

Please sign in to comment.