Make the default flashing frequency target specific (#389)

* feat:  Add flash_freq to Esp32Params

* feat:  Add flash_freq for all targets

* feat:  Use the params flash_freq if no freq argment was used

* test: 🧪 Fix tests

* feat: ️ Update default freq
This commit is contained in:
Sergio Gasquez Arcos
2023-04-18 14:20:52 +02:00
committed by GitHub
parent f098b0eca9
commit 327f8d40e4
9 changed files with 12 additions and 1 deletions

View File

@@ -61,7 +61,7 @@ impl<'a> IdfBootloaderFormat<'a> {
header.write_flash_config(
flash_size.unwrap_or_default(),
flash_freq.unwrap_or_default(),
flash_freq.unwrap_or(params.flash_freq),
chip,
)?;
@@ -303,6 +303,7 @@ pub mod tests {
0x1_0000,
0x3f_0000,
0,
FlashFrequency::_40Mhz,
include_bytes!("../../resources/bootloaders/esp32-bootloader.bin"),
);

View File

@@ -23,6 +23,7 @@ const PARAMS: Esp32Params = Esp32Params::new(
0x1_0000,
0x3f_0000,
0,
FlashFrequency::_40Mhz,
include_bytes!("../../resources/bootloaders/esp32-bootloader.bin"),
);

View File

@@ -26,6 +26,7 @@ const PARAMS: Esp32Params = Esp32Params::new(
0x1_0000,
0x1f_0000,
12,
FlashFrequency::_30Mhz,
include_bytes!("../../resources/bootloaders/esp32c2-bootloader.bin"),
);

View File

@@ -26,6 +26,7 @@ const PARAMS: Esp32Params = Esp32Params::new(
0x1_0000,
0x3f_0000,
5,
FlashFrequency::_40Mhz,
include_bytes!("../../resources/bootloaders/esp32c3-bootloader.bin"),
);

View File

@@ -23,6 +23,7 @@ const PARAMS: Esp32Params = Esp32Params::new(
0x1_0000,
0x3f_0000,
13,
FlashFrequency::_40Mhz,
include_bytes!("../../resources/bootloaders/esp32c6-bootloader.bin"),
);

View File

@@ -24,6 +24,7 @@ const PARAMS: Esp32Params = Esp32Params::new(
0x1_0000,
0x3f_0000,
16,
FlashFrequency::_24Mhz,
include_bytes!("../../resources/bootloaders/esp32h2-bootloader.bin"),
);

View File

@@ -25,6 +25,7 @@ const PARAMS: Esp32Params = Esp32Params::new(
0x1_0000,
0x10_0000,
2,
FlashFrequency::_40Mhz,
include_bytes!("../../resources/bootloaders/esp32s2-bootloader.bin"),
);

View File

@@ -23,6 +23,7 @@ const PARAMS: Esp32Params = Esp32Params::new(
0x1_0000,
0x10_0000,
9,
FlashFrequency::_40Mhz,
include_bytes!("../../resources/bootloaders/esp32s3-bootloader.bin"),
);

View File

@@ -133,6 +133,7 @@ pub struct Esp32Params {
pub app_addr: u32,
pub app_size: u32,
pub chip_id: u16,
pub flash_freq: FlashFrequency,
pub default_bootloader: &'static [u8],
}
@@ -142,6 +143,7 @@ impl Esp32Params {
app_addr: u32,
app_size: u32,
chip_id: u16,
flash_freq: FlashFrequency,
bootloader: &'static [u8],
) -> Self {
Self {
@@ -154,6 +156,7 @@ impl Esp32Params {
app_addr,
app_size,
chip_id,
flash_freq,
default_bootloader: bootloader,
}
}