Skip to content

Commit

Permalink
fix: Rebase errors
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioGasquez committed Jan 4, 2024
1 parent fb82cc3 commit 4ffca64
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 41 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add `Serialize` and `Deserialize` to `FlashFrequency`, `FlashMode` and `FlashSize`. (#528)
- Add `checksum-md5` command (#536)
- Add verify and skipping of unchanged flash regions - add `--no-verify` and `--no-skip` (#538)
- Add --min-chip-rev argument to specify minimum chip revision (#252)

### Fixed

Expand Down
2 changes: 2 additions & 0 deletions cargo-espflash/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ fn flash(args: FlashArgs, config: &Config) -> Result<()> {
args.flash_args.format.or(metadata.format),
args.flash_args.target_app_partition,
flash_settings,
args.flash_args.min_chip_rev,
)?;

if args.flash_args.erase_parts.is_some() || args.flash_args.erase_data_parts.is_some() {
Expand Down Expand Up @@ -576,6 +577,7 @@ fn save_image(args: SaveImageArgs) -> Result<()> {
args.format.or(metadata.format),
args.save_image_args.target_app_partition,
flash_settings,
args.save_image_args.min_chip_rev,
)?;

save_elf_as_image(
Expand Down
2 changes: 2 additions & 0 deletions espflash/src/bin/espflash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ fn flash(args: FlashArgs, config: &Config) -> Result<()> {
args.flash_args.format,
args.flash_args.target_app_partition,
flash_settings,
args.flash_args.min_chip_rev,
)?;

if args.flash_args.erase_parts.is_some() || args.flash_args.erase_data_parts.is_some() {
Expand Down Expand Up @@ -321,6 +322,7 @@ fn save_image(args: SaveImageArgs) -> Result<()> {
args.format,
args.save_image_args.target_app_partition,
flash_settings,
args.save_image_args.min_chip_rev,
)?;

save_elf_as_image(
Expand Down
21 changes: 5 additions & 16 deletions espflash/src/flasher/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use bytemuck::{Pod, Zeroable, __core::time::Duration};
use esp_idf_part::PartitionTable;
use log::{debug, info, warn};
use miette::{IntoDiagnostic, Result};
use serde::{Deserialize, Serialize};
use serialport::UsbPortInfo;
use strum::{Display, EnumIter, EnumVariantNames};

Expand Down Expand Up @@ -913,22 +914,10 @@ impl Flasher {
None
};

let flash_settings = FlashSettings::new(
flash_data.flash_settings.mode,
flash_data.flash_settings.size.or(Some(self.flash_size)),
flash_data.flash_settings.freq,
);

let image = self.chip.into_target().get_flash_image(
&image,
flash_data.bootloader,
flash_data.partition_table,
flash_data.target_app_partition,
flash_data.image_format,
chip_revision,
flash_data.min_chip_rev,
flash_settings,
)?;
let image = self
.chip
.into_target()
.get_flash_image(&image, flash_data, chip_revision)?;

// When the `cli` feature is enabled, display the image size information.
#[cfg(feature = "cli")]
Expand Down
1 change: 1 addition & 0 deletions espflash/src/image_format/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use crate::{
flasher::{FlashFrequency, FlashMode, FlashSize},
targets::Chip,
};

mod direct_boot;
mod esp8266;
mod idf_bootloader;
Expand Down
4 changes: 1 addition & 3 deletions espflash/src/targets/esp32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ impl Target for Esp32 {
image: &'a dyn FirmwareImage<'a>,
flash_data: FlashData,
_chip_revision: Option<(u32, u32)>,
min_rev_full: u16,
flash_settings: FlashSettings,
) -> Result<Box<dyn ImageFormat<'a> + 'a>, Error> {
let image_format = flash_data
.image_format
Expand All @@ -164,7 +162,7 @@ impl Target for Esp32 {
ImageFormatKind::EspBootloader => Ok(Box::new(IdfBootloaderFormat::new(
image,
Chip::Esp32,
min_rev_full,
flash_data.min_chip_rev,
PARAMS,
flash_data.partition_table,
flash_data.partition_table_offset,
Expand Down
4 changes: 1 addition & 3 deletions espflash/src/targets/esp32c2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ impl Target for Esp32c2 {
image: &'a dyn FirmwareImage<'a>,
flash_data: FlashData,
_chip_revision: Option<(u32, u32)>,
flash_settings: FlashSettings,
min_rev_full: u16,
) -> Result<Box<dyn ImageFormat<'a> + 'a>, Error> {
let image_format = flash_data
.image_format
Expand All @@ -98,7 +96,7 @@ impl Target for Esp32c2 {
ImageFormatKind::EspBootloader => Ok(Box::new(IdfBootloaderFormat::new(
image,
Chip::Esp32c2,
min_rev_full,
flash_data.min_chip_rev,
PARAMS,
flash_data.partition_table,
flash_data.partition_table_offset,
Expand Down
4 changes: 1 addition & 3 deletions espflash/src/targets/esp32c3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ impl Target for Esp32c3 {
image: &'a dyn FirmwareImage<'a>,
flash_data: FlashData,
chip_revision: Option<(u32, u32)>,
// flash_settings: FlashSettings,
min_rev_full: u16,
) -> Result<Box<dyn ImageFormat<'a> + 'a>, Error> {
let image_format = flash_data
.image_format
Expand All @@ -85,7 +83,7 @@ impl Target for Esp32c3 {
(ImageFormatKind::EspBootloader, _) => Ok(Box::new(IdfBootloaderFormat::new(
image,
Chip::Esp32c3,
min_rev_full,
flash_data.min_chip_rev,
PARAMS,
flash_data.partition_table,
flash_data.partition_table_offset,
Expand Down
4 changes: 1 addition & 3 deletions espflash/src/targets/esp32c6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ impl Target for Esp32c6 {
image: &'a dyn FirmwareImage<'a>,
flash_data: FlashData,
_chip_revision: Option<(u32, u32)>,
min_rev_full: u16,
flash_settings: FlashSettings,
) -> Result<Box<dyn ImageFormat<'a> + 'a>, Error> {
let image_format = flash_data
.image_format
Expand All @@ -82,7 +80,7 @@ impl Target for Esp32c6 {
ImageFormatKind::EspBootloader => Ok(Box::new(IdfBootloaderFormat::new(
image,
Chip::Esp32c6,
min_rev_full,
flash_data.min_chip_rev,
PARAMS,
flash_data.partition_table,
flash_data.partition_table_offset,
Expand Down
4 changes: 1 addition & 3 deletions espflash/src/targets/esp32h2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ impl Target for Esp32h2 {
image: &'a dyn FirmwareImage<'a>,
flash_data: FlashData,
_chip_revision: Option<(u32, u32)>,
min_rev_full: u16,
flash_settings: FlashSettings,
) -> Result<Box<dyn ImageFormat<'a> + 'a>, Error> {
let image_format = flash_data
.image_format
Expand All @@ -90,7 +88,7 @@ impl Target for Esp32h2 {
ImageFormatKind::EspBootloader => Ok(Box::new(IdfBootloaderFormat::new(
image,
Chip::Esp32h2,
min_rev_full,
flash_data.min_chip_rev,
PARAMS,
flash_data.partition_table,
flash_data.partition_table_offset,
Expand Down
4 changes: 1 addition & 3 deletions espflash/src/targets/esp32s2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ impl Target for Esp32s2 {
image: &'a dyn FirmwareImage<'a>,
flash_data: FlashData,
_chip_revision: Option<(u32, u32)>,
min_rev_full: u16,
flash_settings: FlashSettings,
) -> Result<Box<dyn ImageFormat<'a> + 'a>, Error> {
let image_format = flash_data
.image_format
Expand All @@ -150,7 +148,7 @@ impl Target for Esp32s2 {
ImageFormatKind::EspBootloader => Ok(Box::new(IdfBootloaderFormat::new(
image,
Chip::Esp32s2,
min_rev_full,
flash_data.min_chip_rev,
PARAMS,
flash_data.partition_table,
flash_data.partition_table_offset,
Expand Down
4 changes: 1 addition & 3 deletions espflash/src/targets/esp32s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ impl Target for Esp32s3 {
image: &'a dyn FirmwareImage<'a>,
flash_data: FlashData,
_chip_revision: Option<(u32, u32)>,
min_rev_full: u16,
flash_settings: FlashSettings,
) -> Result<Box<dyn ImageFormat<'a> + 'a>, Error> {
let image_format = flash_data
.image_format
Expand All @@ -104,7 +102,7 @@ impl Target for Esp32s3 {
ImageFormatKind::EspBootloader => Ok(Box::new(IdfBootloaderFormat::new(
image,
Chip::Esp32s3,
min_rev_full,
flash_data.min_chip_rev,
PARAMS,
flash_data.partition_table,
flash_data.partition_table_offset,
Expand Down
2 changes: 0 additions & 2 deletions espflash/src/targets/esp8266.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ impl Target for Esp8266 {
image: &'a dyn FirmwareImage<'a>,
flash_data: FlashData,
_chip_revision: Option<(u32, u32)>,
min_rev_full: u16,
flash_settings: FlashSettings,
) -> Result<Box<dyn ImageFormat<'a> + 'a>, Error> {
let image_format = flash_data
.image_format
Expand Down
2 changes: 0 additions & 2 deletions espflash/src/targets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,6 @@ pub trait Target: ReadEFuse {
image: &'a dyn FirmwareImage<'a>,
flash_data: FlashData,
chip_revision: Option<(u32, u32)>,
min_rev_full: u16,
flash_settings: FlashSettings,
) -> Result<Box<dyn ImageFormat<'a> + 'a>, Error>;

/// What is the MAC address?
Expand Down

0 comments on commit 4ffca64

Please sign in to comment.