Skip to content

Commit e0745f7

Browse files
committed
Merge flashing back into serialport
1 parent 652c2af commit e0745f7

File tree

5 files changed

+11
-16
lines changed

5 files changed

+11
-16
lines changed

.github/workflows/ci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ jobs:
8888
target: ${{ matrix.platform.target }}
8989

9090
- run: cargo check -p espflash --lib --no-default-features
91-
- run: cargo check -p espflash --lib --no-default-features --features flashing
9291
- run: cargo check -p espflash --lib --no-default-features --features serialport
9392

9493
msrv:

CHANGELOG.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111
- Add `--list-all-ports` connection argument to avoid serial port filtering (#590)
1212
- Allow config file to live in parent folder (#595)
13-
- Add `flashing` feature that enables stubs and commands without the serialport feature (#599)
1413

1514
### Fixed
1615
- Change the `hard_reset` sequence to fix Windows issues (#594)
@@ -19,7 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1918
- Non-linux-musl: Only list the available USB Ports by default (#590)
2019
- `FlashData::new` now returns `crate::Error` (#591)
2120
- Moved `reset_after_flash` method to `reset` module (#594)
22-
- Moved `parse_partition_table, DeviceInfo, FlashSettings, FlashData, FlashDataBuilder, FlashFrequency, FlashMode, FlashSize and SpiAttachParams` to `flash_data` (#599)
21+
- Moved `parse_partition_table, DeviceInfo, FlashSettings, FlashData, FlashDataBuilder, FlashFrequency, FlashMode, FlashSize, SpiSetParams and SpiAttachParams` to `flash_data` (#599)
2322
- Moved `ProgressCallbacks` to `progress` (#599)
2423

2524
### Removed

espflash/Cargo.toml

+1-4
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,4 @@ cli = [
8484
]
8585

8686
# enables connecting to a device via serial port
87-
serialport = ["flashing", "dep:serialport", "dep:slip-codec", "dep:regex"]
88-
89-
# enables flash stubs and stub commands
90-
flashing = ["dep:toml"]
87+
serialport = ["flashing", "dep:serialport", "dep:slip-codec", "dep:regex", "dep:toml"]

espflash/src/error.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use thiserror::Error;
1010

1111
#[cfg(feature = "cli")]
1212
use crate::cli::monitor::parser::esp_defmt::DefmtError;
13-
#[cfg(feature = "flashing")]
13+
#[cfg(feature = "serialport")]
1414
use crate::command::CommandType;
1515
use crate::flash_data::{FlashFrequency, FlashSize};
1616
use crate::targets::Chip;
@@ -276,9 +276,9 @@ pub enum ConnectionError {
276276
#[diagnostic(code(espflash::read_missmatch))]
277277
ReadMissmatch(u32, u32),
278278

279+
#[cfg(feature = "serialport")]
279280
#[error("Timeout while running {0}command")]
280281
#[diagnostic(code(espflash::timeout))]
281-
#[cfg(feature = "flashing")]
282282
Timeout(TimedOutCommand),
283283

284284
#[cfg(feature = "serialport")]
@@ -326,12 +326,12 @@ impl From<SlipError> for ConnectionError {
326326

327327
/// An executed command which has timed out
328328
#[derive(Clone, Debug, Default)]
329-
#[cfg(feature = "flashing")]
329+
#[cfg(feature = "serialport")]
330330
pub struct TimedOutCommand {
331331
command: Option<CommandType>,
332332
}
333333

334-
#[cfg(feature = "flashing")]
334+
#[cfg(feature = "serialport")]
335335
impl Display for TimedOutCommand {
336336
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
337337
match &self.command {
@@ -341,7 +341,7 @@ impl Display for TimedOutCommand {
341341
}
342342
}
343343

344-
#[cfg(feature = "flashing")]
344+
#[cfg(feature = "serialport")]
345345
impl From<CommandType> for TimedOutCommand {
346346
fn from(ct: CommandType) -> Self {
347347
TimedOutCommand { command: Some(ct) }
@@ -488,15 +488,15 @@ impl From<&'static str> for ElfError {
488488
}
489489
}
490490

491-
#[cfg(feature = "flashing")]
491+
#[cfg(feature = "serialport")]
492492
pub(crate) trait ResultExt {
493493
/// Mark an error as having occurred during the flashing stage
494494
fn flashing(self) -> Self;
495495
/// Mark the command from which this error originates
496496
fn for_command(self, command: CommandType) -> Self;
497497
}
498498

499-
#[cfg(feature = "flashing")]
499+
#[cfg(feature = "serialport")]
500500
impl<T> ResultExt for Result<T, Error> {
501501
fn flashing(self) -> Self {
502502
match self {

espflash/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@
3131
#[cfg(feature = "cli")]
3232
#[cfg_attr(docsrs, doc(cfg(feature = "cli")))]
3333
pub mod cli;
34-
#[cfg(feature = "flashing")]
34+
#[cfg(feature = "serialport")]
3535
pub mod command;
3636
#[cfg(feature = "serialport")]
3737
#[cfg_attr(docsrs, doc(cfg(feature = "serialport")))]
3838
pub mod connection;
3939
pub mod elf;
4040
pub mod error;
4141
pub mod flash_data;
42-
#[cfg(feature = "flashing")]
42+
#[cfg(feature = "serialport")]
4343
pub mod flasher;
4444
pub mod image_format;
4545
pub mod progress;

0 commit comments

Comments
 (0)