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 0fae99e
Show file tree
Hide file tree
Showing 3 changed files with 11 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
4 changes: 4 additions & 0 deletions espflash/src/cli/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use directories::ProjectDirs;
use log::debug;
use miette::{IntoDiagnostic, Result, WrapErr};
use serde::{Deserialize, Serialize};
use serde_hex::{CompactPfx, SerHexOpt};
use serialport::UsbPortInfo;

use crate::error::Error;
Expand Down Expand Up @@ -87,6 +88,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 0fae99e

Please sign in to comment.