Skip to content

Commit

Permalink
Remove unused segments_with_load_addresses function
Browse files Browse the repository at this point in the history
  • Loading branch information
jessebraham committed Feb 28, 2025
1 parent 8172a19 commit f59239b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed

- Removed the `libudev` feature (#742)
- The `FirmwareImage` trait no longer includes the `segments_with_load_addresses` function (#796)

## [3.3.0] - 2025-01-13

Expand Down
22 changes: 0 additions & 22 deletions espflash/src/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use std::{
};

use xmas_elf::{
program::Type,
sections::{SectionData, ShType},
ElfFile,
};
Expand All @@ -24,9 +23,6 @@ pub trait FirmwareImage<'a> {
/// Firmware image segments
fn segments(&'a self) -> Box<dyn Iterator<Item = Segment<'a>> + 'a>;

/// Firmware image segments, with their associated load addresses
fn segments_with_load_addresses(&'a self) -> Box<dyn Iterator<Item = Segment<'a>> + 'a>;

/// Firmware image ROM segments
fn rom_segments(&'a self, chip: Chip) -> Box<dyn Iterator<Item = Segment<'a>> + 'a> {
Box::new(
Expand Down Expand Up @@ -68,24 +64,6 @@ impl<'a> FirmwareImage<'a> for ElfFile<'a> {
}),
)
}

fn segments_with_load_addresses(&'a self) -> Box<dyn Iterator<Item = Segment<'a>> + 'a> {
Box::new(
self.program_iter()
.filter(|header| {
header.file_size() > 0
&& header.get_type() == Ok(Type::Load)
&& header.offset() > 0
})
.flat_map(move |header| {
let addr = header.physical_addr() as u32;
let from = header.offset() as usize;
let to = header.offset() as usize + header.file_size() as usize;
let data = &self.input[from..to];
Some(Segment::new(addr, data))
}),
)
}
}

/// A segment of code from the source ELF
Expand Down

0 comments on commit f59239b

Please sign in to comment.