mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-09-30 05:40:55 +00:00
Merge pull request #4125 from diondokter/configurable-bank-support
STM32: Configurable bank support
This commit is contained in:
commit
966914f465
8
.github/ci/test.sh
vendored
8
.github/ci/test.sh
vendored
@ -29,8 +29,10 @@ cargo test --manifest-path ./embassy-nrf/Cargo.toml --no-default-features --feat
|
||||
cargo test --manifest-path ./embassy-rp/Cargo.toml --no-default-features --features time-driver,rp2040,_test
|
||||
cargo test --manifest-path ./embassy-rp/Cargo.toml --no-default-features --features time-driver,rp235xa,_test
|
||||
|
||||
cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features stm32f429vg,exti,time-driver-any,exti
|
||||
cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features stm32f732ze,exti,time-driver-any,exti
|
||||
cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features stm32f769ni,exti,time-driver-any,exti
|
||||
cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features stm32f429vg,time-driver-any,exti,single-bank
|
||||
cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features stm32f429vg,time-driver-any,exti,dual-bank
|
||||
cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features stm32f732ze,time-driver-any,exti
|
||||
cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features stm32f769ni,time-driver-any,exti,single-bank
|
||||
cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features stm32f769ni,time-driver-any,exti,dual-bank
|
||||
|
||||
cargo test --manifest-path ./embassy-net-adin1110/Cargo.toml
|
||||
|
25
ci.sh
25
ci.sh
@ -88,16 +88,17 @@ cargo batch \
|
||||
--- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv8m.main-none-eabihf --features time-driver,defmt,rp235xa \
|
||||
--- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv8m.main-none-eabihf --features time-driver,log,rp235xa \
|
||||
--- build --release --manifest-path embassy-rp/Cargo.toml --target thumbv8m.main-none-eabihf --features time-driver,rp235xa,binary-info \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,defmt,exti,time-driver-any,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,defmt,time-driver-any,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,defmt,exti,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,defmt,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,defmt,exti,time-driver-any,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,defmt,time-driver-any,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,defmt,exti,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,defmt,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,defmt,exti \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,defmt \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,dual-bank,defmt,exti,time-driver-any,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,dual-bank,defmt,time-driver-any,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,dual-bank,defmt,exti,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,dual-bank,defmt,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,dual-bank,defmt,exti,time-driver-any,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,dual-bank,defmt,time-driver-any,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,dual-bank,defmt,exti,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,dual-bank,defmt,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,dual-bank,defmt,exti \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,dual-bank,defmt \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,single-bank,defmt \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32f038f6,defmt,exti,time-driver-any,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32f030c6,defmt,exti,time-driver-any,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32f058t8,defmt,exti,time-driver-any,time \
|
||||
@ -153,10 +154,10 @@ cargo batch \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f378cc,defmt,exti,time-driver-any,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32g0c1ve,defmt,exti,time-driver-any,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f217zg,defmt,exti,time-driver-any,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,defmt,exti,time-driver-any,low-power,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze,dual-bank,defmt,exti,time-driver-any,low-power,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32wl54jc-cm0p,defmt,exti,time-driver-any,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32wle5jb,defmt,exti,time-driver-any,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32g474pe,defmt,exti,time-driver-any,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32g474pe,dual-bank,defmt,exti,time-driver-any,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f107vc,defmt,exti,time-driver-any,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f103re,defmt,exti,time-driver-any,time \
|
||||
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f100c4,defmt,exti,time-driver-any,time \
|
||||
|
@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## Unreleased
|
||||
- Modify BufferedUart initialization to take pins before interrupts ([#3983](https://github.com/embassy-rs/embassy/pull/3983))
|
||||
- Added a 'single-bank' and a 'dual-bank' feature so chips with configurable flash bank setups are be supported in embassy ([#4125](https://github.com/embassy-rs/embassy/pull/4125))
|
||||
|
||||
## 0.2.0 - 2025-01-10
|
||||
|
||||
|
@ -73,7 +73,7 @@ rand_core = "0.6.3"
|
||||
sdio-host = "0.9.0"
|
||||
critical-section = "1.1"
|
||||
#stm32-metapac = { version = "16" }
|
||||
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-169e38298f9421dddbabc0eb81d0c30fb1eec0a7" }
|
||||
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-7251801e3273011ce28a89e8f2e45eec2e419e26" }
|
||||
|
||||
vcell = "0.1.3"
|
||||
nb = "1.0.0"
|
||||
@ -102,7 +102,7 @@ proc-macro2 = "1.0.36"
|
||||
quote = "1.0.15"
|
||||
|
||||
#stm32-metapac = { version = "16", default-features = false, features = ["metadata"]}
|
||||
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-169e38298f9421dddbabc0eb81d0c30fb1eec0a7", default-features = false, features = ["metadata"] }
|
||||
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-7251801e3273011ce28a89e8f2e45eec2e419e26", default-features = false, features = ["metadata"] }
|
||||
|
||||
[features]
|
||||
default = ["rt"]
|
||||
@ -197,6 +197,9 @@ split-pc2 = ["_split-pins-enabled"]
|
||||
## Split PC3
|
||||
split-pc3 = ["_split-pins-enabled"]
|
||||
|
||||
dual-bank = []
|
||||
single-bank = []
|
||||
|
||||
## internal use only
|
||||
_split-pins-enabled = []
|
||||
|
||||
|
@ -49,6 +49,44 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
// ========
|
||||
// Select the memory variant to use
|
||||
let memory = {
|
||||
let single_bank_selected = env::var("CARGO_FEATURE_SINGLE_BANK").is_ok();
|
||||
let dual_bank_selected = env::var("CARGO_FEATURE_DUAL_BANK").is_ok();
|
||||
|
||||
let single_bank_memory = METADATA.memory.iter().find(|mem| {
|
||||
mem.iter().any(|region| region.name.contains("BANK_1"))
|
||||
&& !mem.iter().any(|region| region.name.contains("BANK_2"))
|
||||
});
|
||||
|
||||
let dual_bank_memory = METADATA.memory.iter().find(|mem| {
|
||||
mem.iter().any(|region| region.name.contains("BANK_1"))
|
||||
&& mem.iter().any(|region| region.name.contains("BANK_2"))
|
||||
});
|
||||
|
||||
cfgs.set(
|
||||
"bank_setup_configurable",
|
||||
single_bank_memory.is_some() && dual_bank_memory.is_some(),
|
||||
);
|
||||
|
||||
match (single_bank_selected, dual_bank_selected) {
|
||||
(true, true) => panic!("Both 'single-bank' and 'dual-bank' features enabled"),
|
||||
(true, false) => {
|
||||
single_bank_memory.expect("The 'single-bank' feature is not supported on this dual bank chip")
|
||||
}
|
||||
(false, true) => {
|
||||
dual_bank_memory.expect("The 'dual-bank' feature is not supported on this single bank chip")
|
||||
}
|
||||
(false, false) => {
|
||||
if METADATA.memory.len() != 1 {
|
||||
panic!("Chip supports single and dual bank configuration. No Cargo feature to select one is enabled. Use the 'single-bank' or 'dual-bank' feature to make your selection")
|
||||
}
|
||||
METADATA.memory[0]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ========
|
||||
// Generate singletons
|
||||
|
||||
@ -290,8 +328,7 @@ fn main() {
|
||||
// ========
|
||||
// Generate FLASH regions
|
||||
let mut flash_regions = TokenStream::new();
|
||||
let flash_memory_regions: Vec<_> = METADATA
|
||||
.memory
|
||||
let flash_memory_regions: Vec<_> = memory
|
||||
.iter()
|
||||
.filter(|x| x.kind == MemoryRegionKind::Flash && x.settings.is_some())
|
||||
.collect();
|
||||
@ -1621,8 +1658,7 @@ fn main() {
|
||||
let mut pins_table: Vec<Vec<String>> = Vec::new();
|
||||
let mut adc_table: Vec<Vec<String>> = Vec::new();
|
||||
|
||||
for m in METADATA
|
||||
.memory
|
||||
for m in memory
|
||||
.iter()
|
||||
.filter(|m| m.kind == MemoryRegionKind::Flash && m.settings.is_some())
|
||||
{
|
||||
@ -1860,8 +1896,7 @@ fn main() {
|
||||
// ========
|
||||
// Generate flash constants
|
||||
|
||||
let flash_regions: Vec<&MemoryRegion> = METADATA
|
||||
.memory
|
||||
let flash_regions: Vec<&MemoryRegion> = memory
|
||||
.iter()
|
||||
.filter(|x| x.kind == MemoryRegionKind::Flash && x.name.starts_with("BANK_"))
|
||||
.collect();
|
||||
@ -1986,7 +2021,7 @@ fn main() {
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
|
||||
if cfg!(feature = "memory-x") {
|
||||
gen_memory_x(out_dir);
|
||||
gen_memory_x(memory, out_dir);
|
||||
println!("cargo:rustc-link-search={}", out_dir.display());
|
||||
}
|
||||
}
|
||||
@ -2075,11 +2110,11 @@ fn rustfmt(path: impl AsRef<Path>) {
|
||||
}
|
||||
}
|
||||
|
||||
fn gen_memory_x(out_dir: &Path) {
|
||||
fn gen_memory_x(memory: &[MemoryRegion], out_dir: &Path) {
|
||||
let mut memory_x = String::new();
|
||||
|
||||
let flash = get_memory_range(MemoryRegionKind::Flash);
|
||||
let ram = get_memory_range(MemoryRegionKind::Ram);
|
||||
let flash = get_memory_range(memory, MemoryRegionKind::Flash);
|
||||
let ram = get_memory_range(memory, MemoryRegionKind::Ram);
|
||||
|
||||
write!(memory_x, "MEMORY\n{{\n").unwrap();
|
||||
writeln!(
|
||||
@ -2103,12 +2138,8 @@ fn gen_memory_x(out_dir: &Path) {
|
||||
std::fs::write(out_dir.join("memory.x"), memory_x.as_bytes()).unwrap();
|
||||
}
|
||||
|
||||
fn get_memory_range(kind: MemoryRegionKind) -> (u32, u32, String) {
|
||||
let mut mems: Vec<_> = METADATA
|
||||
.memory
|
||||
.iter()
|
||||
.filter(|m| m.kind == kind && m.size != 0)
|
||||
.collect();
|
||||
fn get_memory_range(memory: &[MemoryRegion], kind: MemoryRegionKind) -> (u32, u32, String) {
|
||||
let mut mems: Vec<_> = memory.iter().filter(|m| m.kind == kind && m.size != 0).collect();
|
||||
mems.sort_by_key(|m| m.address);
|
||||
|
||||
let mut start = u32::MAX;
|
||||
|
@ -6,8 +6,8 @@ use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
|
||||
use embassy_sync::mutex::Mutex;
|
||||
|
||||
use super::{
|
||||
blocking_read, ensure_sector_aligned, family, get_sector, Async, Error, Flash, FlashLayout, FLASH_BASE, FLASH_SIZE,
|
||||
WRITE_SIZE,
|
||||
blocking_read, ensure_sector_aligned, family, get_flash_regions, get_sector, Async, Error, Flash, FlashLayout,
|
||||
FLASH_BASE, FLASH_SIZE, WRITE_SIZE,
|
||||
};
|
||||
use crate::interrupt::InterruptExt;
|
||||
use crate::peripherals::FLASH;
|
||||
@ -34,7 +34,6 @@ impl<'d> Flash<'d, Async> {
|
||||
///
|
||||
/// See module-level documentation for details on how memory regions work.
|
||||
pub fn into_regions(self) -> FlashLayout<'d, Async> {
|
||||
assert!(family::is_default_layout());
|
||||
FlashLayout::new(self.inner)
|
||||
}
|
||||
|
||||
@ -123,7 +122,7 @@ pub(super) async unsafe fn write_chunked(base: u32, size: u32, offset: u32, byte
|
||||
pub(super) async unsafe fn erase_sectored(base: u32, from: u32, to: u32) -> Result<(), Error> {
|
||||
let start_address = base + from;
|
||||
let end_address = base + to;
|
||||
let regions = family::get_flash_regions();
|
||||
let regions = get_flash_regions();
|
||||
|
||||
ensure_sector_aligned(start_address, end_address, regions)?;
|
||||
|
||||
|
@ -4,8 +4,8 @@ use core::sync::atomic::{fence, Ordering};
|
||||
use embassy_hal_internal::drop::OnDrop;
|
||||
|
||||
use super::{
|
||||
family, Async, Blocking, Error, FlashBank, FlashLayout, FlashRegion, FlashSector, FLASH_SIZE, MAX_ERASE_SIZE,
|
||||
READ_SIZE, WRITE_SIZE,
|
||||
family, get_flash_regions, Async, Blocking, Error, FlashBank, FlashLayout, FlashRegion, FlashSector, FLASH_SIZE,
|
||||
MAX_ERASE_SIZE, READ_SIZE, WRITE_SIZE,
|
||||
};
|
||||
use crate::Peri;
|
||||
use crate::_generated::FLASH_BASE;
|
||||
@ -20,6 +20,10 @@ pub struct Flash<'d, MODE = Async> {
|
||||
impl<'d> Flash<'d, Blocking> {
|
||||
/// Create a new flash driver, usable in blocking mode.
|
||||
pub fn new_blocking(p: Peri<'d, FLASH>) -> Self {
|
||||
#[cfg(bank_setup_configurable)]
|
||||
// Check if the configuration matches the embassy setup
|
||||
super::check_bank_setup();
|
||||
|
||||
Self {
|
||||
inner: p,
|
||||
_mode: PhantomData,
|
||||
@ -32,7 +36,6 @@ impl<'d, MODE> Flash<'d, MODE> {
|
||||
///
|
||||
/// See module-level documentation for details on how memory regions work.
|
||||
pub fn into_blocking_regions(self) -> FlashLayout<'d, Blocking> {
|
||||
assert!(family::is_default_layout());
|
||||
FlashLayout::new(self.inner)
|
||||
}
|
||||
|
||||
@ -137,7 +140,7 @@ pub(super) unsafe fn blocking_erase(
|
||||
) -> Result<(), Error> {
|
||||
let start_address = base + from;
|
||||
let end_address = base + to;
|
||||
let regions = family::get_flash_regions();
|
||||
let regions = get_flash_regions();
|
||||
|
||||
ensure_sector_aligned(start_address, end_address, regions)?;
|
||||
|
||||
|
@ -1,18 +1,10 @@
|
||||
use core::ptr::write_volatile;
|
||||
use core::sync::atomic::{fence, Ordering};
|
||||
|
||||
use super::{FlashRegion, FlashSector, FLASH_REGIONS, WRITE_SIZE};
|
||||
use super::{FlashSector, WRITE_SIZE};
|
||||
use crate::flash::Error;
|
||||
use crate::pac;
|
||||
|
||||
pub(crate) const fn is_default_layout() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
pub(crate) const fn get_flash_regions() -> &'static [&'static FlashRegion] {
|
||||
&FLASH_REGIONS
|
||||
}
|
||||
|
||||
pub(crate) unsafe fn lock() {
|
||||
pac::FLASH.cr().modify(|w| w.set_lock(true));
|
||||
}
|
||||
|
@ -1,18 +1,10 @@
|
||||
use core::ptr::write_volatile;
|
||||
use core::sync::atomic::{fence, Ordering};
|
||||
|
||||
use super::{FlashRegion, FlashSector, FLASH_REGIONS, WRITE_SIZE};
|
||||
use super::{FlashSector, WRITE_SIZE};
|
||||
use crate::flash::Error;
|
||||
use crate::pac;
|
||||
|
||||
pub(crate) const fn is_default_layout() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
pub(crate) const fn get_flash_regions() -> &'static [&'static FlashRegion] {
|
||||
&FLASH_REGIONS
|
||||
}
|
||||
|
||||
pub(crate) unsafe fn lock() {
|
||||
pac::FLASH.cr().modify(|w| w.set_lock(true));
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ use core::sync::atomic::{fence, AtomicBool, Ordering};
|
||||
|
||||
use pac::flash::regs::Sr;
|
||||
|
||||
use super::{FlashBank, FlashRegion, FlashSector, FLASH_REGIONS, WRITE_SIZE};
|
||||
use super::{get_flash_regions, FlashBank, FlashSector, WRITE_SIZE};
|
||||
use crate::flash::Error;
|
||||
use crate::pac;
|
||||
|
||||
@ -15,14 +15,6 @@ impl FlashSector {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) const fn is_default_layout() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
pub(crate) const fn get_flash_regions() -> &'static [&'static FlashRegion] {
|
||||
&FLASH_REGIONS
|
||||
}
|
||||
|
||||
pub(crate) unsafe fn lock() {
|
||||
pac::FLASH.cr().modify(|w| w.set_lock(true));
|
||||
}
|
||||
|
@ -4,177 +4,10 @@ use core::sync::atomic::{fence, AtomicBool, Ordering};
|
||||
use embassy_sync::waitqueue::AtomicWaker;
|
||||
use pac::flash::regs::Sr;
|
||||
|
||||
use super::{FlashBank, FlashRegion, FlashSector, FLASH_REGIONS, WRITE_SIZE};
|
||||
use super::{get_flash_regions, FlashBank, FlashSector, WRITE_SIZE};
|
||||
use crate::_generated::FLASH_SIZE;
|
||||
use crate::flash::Error;
|
||||
use crate::pac;
|
||||
#[allow(missing_docs)] // TODO
|
||||
#[cfg(any(stm32f427, stm32f429, stm32f437, stm32f439, stm32f469, stm32f479))]
|
||||
mod alt_regions {
|
||||
use core::marker::PhantomData;
|
||||
|
||||
use crate::Peri;
|
||||
use crate::_generated::flash_regions::{OTPRegion, BANK1_REGION1, BANK1_REGION2, BANK1_REGION3, OTP_REGION};
|
||||
use crate::_generated::FLASH_SIZE;
|
||||
use crate::flash::{asynch, Async, Bank1Region1, Bank1Region2, Blocking, Error, Flash, FlashBank, FlashRegion};
|
||||
use crate::peripherals::FLASH;
|
||||
|
||||
pub const ALT_BANK1_REGION3: FlashRegion = FlashRegion {
|
||||
size: 3 * BANK1_REGION3.erase_size,
|
||||
..BANK1_REGION3
|
||||
};
|
||||
pub const ALT_BANK2_REGION1: FlashRegion = FlashRegion {
|
||||
bank: FlashBank::Bank2,
|
||||
base: BANK1_REGION1.base + FLASH_SIZE as u32 / 2,
|
||||
..BANK1_REGION1
|
||||
};
|
||||
pub const ALT_BANK2_REGION2: FlashRegion = FlashRegion {
|
||||
bank: FlashBank::Bank2,
|
||||
base: BANK1_REGION2.base + FLASH_SIZE as u32 / 2,
|
||||
..BANK1_REGION2
|
||||
};
|
||||
pub const ALT_BANK2_REGION3: FlashRegion = FlashRegion {
|
||||
bank: FlashBank::Bank2,
|
||||
base: BANK1_REGION3.base + FLASH_SIZE as u32 / 2,
|
||||
size: 3 * BANK1_REGION3.erase_size,
|
||||
..BANK1_REGION3
|
||||
};
|
||||
|
||||
pub const ALT_FLASH_REGIONS: [&FlashRegion; 6] = [
|
||||
&BANK1_REGION1,
|
||||
&BANK1_REGION2,
|
||||
&ALT_BANK1_REGION3,
|
||||
&ALT_BANK2_REGION1,
|
||||
&ALT_BANK2_REGION2,
|
||||
&ALT_BANK2_REGION3,
|
||||
];
|
||||
|
||||
pub struct AltBank1Region3<'d, MODE = Async>(pub &'static FlashRegion, Peri<'d, FLASH>, PhantomData<MODE>);
|
||||
pub struct AltBank2Region1<'d, MODE = Async>(pub &'static FlashRegion, Peri<'d, FLASH>, PhantomData<MODE>);
|
||||
pub struct AltBank2Region2<'d, MODE = Async>(pub &'static FlashRegion, Peri<'d, FLASH>, PhantomData<MODE>);
|
||||
pub struct AltBank2Region3<'d, MODE = Async>(pub &'static FlashRegion, Peri<'d, FLASH>, PhantomData<MODE>);
|
||||
|
||||
pub struct AltFlashLayout<'d, MODE = Async> {
|
||||
pub bank1_region1: Bank1Region1<'d, MODE>,
|
||||
pub bank1_region2: Bank1Region2<'d, MODE>,
|
||||
pub bank1_region3: AltBank1Region3<'d, MODE>,
|
||||
pub bank2_region1: AltBank2Region1<'d, MODE>,
|
||||
pub bank2_region2: AltBank2Region2<'d, MODE>,
|
||||
pub bank2_region3: AltBank2Region3<'d, MODE>,
|
||||
pub otp_region: OTPRegion<'d, MODE>,
|
||||
}
|
||||
|
||||
impl<'d> Flash<'d> {
|
||||
pub fn into_alt_regions(self) -> AltFlashLayout<'d, Async> {
|
||||
assert!(!super::is_default_layout());
|
||||
|
||||
// SAFETY: We never expose the cloned peripheral references, and their instance is not public.
|
||||
// Also, all async flash region operations are protected with a mutex.
|
||||
let p = self.inner;
|
||||
AltFlashLayout {
|
||||
bank1_region1: Bank1Region1(&BANK1_REGION1, unsafe { p.clone_unchecked() }, PhantomData),
|
||||
bank1_region2: Bank1Region2(&BANK1_REGION2, unsafe { p.clone_unchecked() }, PhantomData),
|
||||
bank1_region3: AltBank1Region3(&ALT_BANK1_REGION3, unsafe { p.clone_unchecked() }, PhantomData),
|
||||
bank2_region1: AltBank2Region1(&ALT_BANK2_REGION1, unsafe { p.clone_unchecked() }, PhantomData),
|
||||
bank2_region2: AltBank2Region2(&ALT_BANK2_REGION2, unsafe { p.clone_unchecked() }, PhantomData),
|
||||
bank2_region3: AltBank2Region3(&ALT_BANK2_REGION3, unsafe { p.clone_unchecked() }, PhantomData),
|
||||
otp_region: OTPRegion(&OTP_REGION, unsafe { p.clone_unchecked() }, PhantomData),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn into_alt_blocking_regions(self) -> AltFlashLayout<'d, Blocking> {
|
||||
assert!(!super::is_default_layout());
|
||||
|
||||
// SAFETY: We never expose the cloned peripheral references, and their instance is not public.
|
||||
// Also, all blocking flash region operations are protected with a cs.
|
||||
let p = self.inner;
|
||||
AltFlashLayout {
|
||||
bank1_region1: Bank1Region1(&BANK1_REGION1, unsafe { p.clone_unchecked() }, PhantomData),
|
||||
bank1_region2: Bank1Region2(&BANK1_REGION2, unsafe { p.clone_unchecked() }, PhantomData),
|
||||
bank1_region3: AltBank1Region3(&ALT_BANK1_REGION3, unsafe { p.clone_unchecked() }, PhantomData),
|
||||
bank2_region1: AltBank2Region1(&ALT_BANK2_REGION1, unsafe { p.clone_unchecked() }, PhantomData),
|
||||
bank2_region2: AltBank2Region2(&ALT_BANK2_REGION2, unsafe { p.clone_unchecked() }, PhantomData),
|
||||
bank2_region3: AltBank2Region3(&ALT_BANK2_REGION3, unsafe { p.clone_unchecked() }, PhantomData),
|
||||
otp_region: OTPRegion(&OTP_REGION, unsafe { p.clone_unchecked() }, PhantomData),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! foreach_altflash_region {
|
||||
($type_name:ident, $region:ident) => {
|
||||
impl<MODE> $type_name<'_, MODE> {
|
||||
pub fn blocking_read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Error> {
|
||||
crate::flash::common::blocking_read(self.0.base, self.0.size, offset, bytes)
|
||||
}
|
||||
}
|
||||
|
||||
impl $type_name<'_, Async> {
|
||||
pub async fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Error> {
|
||||
self.blocking_read(offset, bytes)
|
||||
}
|
||||
|
||||
pub async fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Error> {
|
||||
let _guard = asynch::REGION_ACCESS.lock().await;
|
||||
unsafe { asynch::write_chunked(self.0.base, self.0.size, offset, bytes).await }
|
||||
}
|
||||
|
||||
pub async fn erase(&mut self, from: u32, to: u32) -> Result<(), Error> {
|
||||
let _guard = asynch::REGION_ACCESS.lock().await;
|
||||
unsafe { asynch::erase_sectored(self.0.base, from, to).await }
|
||||
}
|
||||
}
|
||||
|
||||
impl<MODE> embedded_storage::nor_flash::ErrorType for $type_name<'_, MODE> {
|
||||
type Error = Error;
|
||||
}
|
||||
|
||||
impl<MODE> embedded_storage::nor_flash::ReadNorFlash for $type_name<'_, MODE> {
|
||||
const READ_SIZE: usize = crate::flash::READ_SIZE;
|
||||
|
||||
fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error> {
|
||||
self.blocking_read(offset, bytes)
|
||||
}
|
||||
|
||||
fn capacity(&self) -> usize {
|
||||
self.0.size as usize
|
||||
}
|
||||
}
|
||||
|
||||
impl embedded_storage_async::nor_flash::ReadNorFlash for $type_name<'_, Async> {
|
||||
const READ_SIZE: usize = crate::flash::READ_SIZE;
|
||||
|
||||
async fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error> {
|
||||
self.read(offset, bytes).await
|
||||
}
|
||||
|
||||
fn capacity(&self) -> usize {
|
||||
self.0.size as usize
|
||||
}
|
||||
}
|
||||
|
||||
impl embedded_storage_async::nor_flash::NorFlash for $type_name<'_, Async> {
|
||||
const WRITE_SIZE: usize = $region.write_size as usize;
|
||||
const ERASE_SIZE: usize = $region.erase_size as usize;
|
||||
|
||||
async fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Self::Error> {
|
||||
self.write(offset, bytes).await
|
||||
}
|
||||
|
||||
async fn erase(&mut self, from: u32, to: u32) -> Result<(), Self::Error> {
|
||||
self.erase(from, to).await
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
foreach_altflash_region!(AltBank1Region3, ALT_BANK1_REGION3);
|
||||
foreach_altflash_region!(AltBank2Region1, ALT_BANK2_REGION1);
|
||||
foreach_altflash_region!(AltBank2Region2, ALT_BANK2_REGION2);
|
||||
foreach_altflash_region!(AltBank2Region3, ALT_BANK2_REGION3);
|
||||
}
|
||||
|
||||
#[cfg(any(stm32f427, stm32f429, stm32f437, stm32f439, stm32f469, stm32f479))]
|
||||
pub use alt_regions::*;
|
||||
|
||||
static WAKER: AtomicWaker = AtomicWaker::new();
|
||||
static DATA_CACHE_WAS_ENABLED: AtomicBool = AtomicBool::new(false);
|
||||
@ -185,30 +18,6 @@ impl FlashSector {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(stm32f427, stm32f429, stm32f437, stm32f439, stm32f469, stm32f479))]
|
||||
pub(crate) fn is_default_layout() -> bool {
|
||||
!pac::FLASH.optcr().read().db1m()
|
||||
}
|
||||
|
||||
#[cfg(not(any(stm32f427, stm32f429, stm32f437, stm32f439, stm32f469, stm32f479)))]
|
||||
pub(crate) const fn is_default_layout() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
#[cfg(any(stm32f427, stm32f429, stm32f437, stm32f439, stm32f469, stm32f479))]
|
||||
pub fn get_flash_regions() -> &'static [&'static FlashRegion] {
|
||||
if is_default_layout() {
|
||||
&FLASH_REGIONS
|
||||
} else {
|
||||
&ALT_FLASH_REGIONS
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(any(stm32f427, stm32f429, stm32f437, stm32f439, stm32f469, stm32f479)))]
|
||||
pub const fn get_flash_regions() -> &'static [&'static FlashRegion] {
|
||||
&FLASH_REGIONS
|
||||
}
|
||||
|
||||
pub(crate) unsafe fn on_interrupt() {
|
||||
// Clear IRQ flags
|
||||
pac::FLASH.sr().write(|w| {
|
||||
@ -487,71 +296,83 @@ mod tests {
|
||||
const MEDIUM_SECTOR_SIZE: u32 = 64 * 1024;
|
||||
const LARGE_SECTOR_SIZE: u32 = 128 * 1024;
|
||||
|
||||
let assert_sector = |snb: u8, index_in_bank: u8, start: u32, size: u32, address: u32| {
|
||||
let sector = get_sector(address, &FLASH_REGIONS);
|
||||
assert_eq!(snb, sector.snb());
|
||||
assert_eq!(
|
||||
FlashSector {
|
||||
bank: FlashBank::Bank1,
|
||||
index_in_bank,
|
||||
start,
|
||||
size
|
||||
},
|
||||
sector
|
||||
);
|
||||
};
|
||||
if !cfg!(feature = "dual-bank") {
|
||||
let assert_sector = |snb: u8, index_in_bank: u8, start: u32, size: u32, address: u32| {
|
||||
let sector = get_sector(address, crate::flash::get_flash_regions());
|
||||
assert_eq!(snb, sector.snb());
|
||||
assert_eq!(
|
||||
FlashSector {
|
||||
bank: sector.bank,
|
||||
index_in_bank,
|
||||
start,
|
||||
size
|
||||
},
|
||||
sector
|
||||
);
|
||||
};
|
||||
|
||||
assert_sector(0x00, 0, 0x0800_0000, SMALL_SECTOR_SIZE, 0x0800_0000);
|
||||
assert_sector(0x00, 0, 0x0800_0000, SMALL_SECTOR_SIZE, 0x0800_3FFF);
|
||||
assert_sector(0x03, 3, 0x0800_C000, SMALL_SECTOR_SIZE, 0x0800_C000);
|
||||
assert_sector(0x03, 3, 0x0800_C000, SMALL_SECTOR_SIZE, 0x0800_FFFF);
|
||||
assert_sector(0x00, 0, 0x0800_0000, SMALL_SECTOR_SIZE, 0x0800_0000);
|
||||
assert_sector(0x00, 0, 0x0800_0000, SMALL_SECTOR_SIZE, 0x0800_3FFF);
|
||||
assert_sector(0x03, 3, 0x0800_C000, SMALL_SECTOR_SIZE, 0x0800_C000);
|
||||
assert_sector(0x03, 3, 0x0800_C000, SMALL_SECTOR_SIZE, 0x0800_FFFF);
|
||||
|
||||
assert_sector(0x04, 4, 0x0801_0000, MEDIUM_SECTOR_SIZE, 0x0801_0000);
|
||||
assert_sector(0x04, 4, 0x0801_0000, MEDIUM_SECTOR_SIZE, 0x0801_FFFF);
|
||||
assert_sector(0x04, 4, 0x0801_0000, MEDIUM_SECTOR_SIZE, 0x0801_0000);
|
||||
assert_sector(0x04, 4, 0x0801_0000, MEDIUM_SECTOR_SIZE, 0x0801_FFFF);
|
||||
|
||||
assert_sector(0x05, 5, 0x0802_0000, LARGE_SECTOR_SIZE, 0x0802_0000);
|
||||
assert_sector(0x05, 5, 0x0802_0000, LARGE_SECTOR_SIZE, 0x0803_FFFF);
|
||||
assert_sector(0x0B, 11, 0x080E_0000, LARGE_SECTOR_SIZE, 0x080E_0000);
|
||||
assert_sector(0x0B, 11, 0x080E_0000, LARGE_SECTOR_SIZE, 0x080F_FFFF);
|
||||
assert_sector(0x05, 5, 0x0802_0000, LARGE_SECTOR_SIZE, 0x0802_0000);
|
||||
assert_sector(0x05, 5, 0x0802_0000, LARGE_SECTOR_SIZE, 0x0803_FFFF);
|
||||
assert_sector(0x0B, 11, 0x080E_0000, LARGE_SECTOR_SIZE, 0x080E_0000);
|
||||
assert_sector(0x0B, 11, 0x080E_0000, LARGE_SECTOR_SIZE, 0x080F_FFFF);
|
||||
} else {
|
||||
let assert_sector = |snb: u8, bank: FlashBank, index_in_bank: u8, start: u32, size: u32, address: u32| {
|
||||
let sector = get_sector(address, crate::flash::get_flash_regions());
|
||||
assert_eq!(snb, sector.snb());
|
||||
assert_eq!(
|
||||
FlashSector {
|
||||
bank,
|
||||
index_in_bank,
|
||||
start,
|
||||
size
|
||||
},
|
||||
sector
|
||||
)
|
||||
};
|
||||
|
||||
let assert_sector = |snb: u8, bank: FlashBank, index_in_bank: u8, start: u32, size: u32, address: u32| {
|
||||
let sector = get_sector(address, &ALT_FLASH_REGIONS);
|
||||
assert_eq!(snb, sector.snb());
|
||||
assert_eq!(
|
||||
FlashSector {
|
||||
bank,
|
||||
index_in_bank,
|
||||
start,
|
||||
size
|
||||
},
|
||||
sector
|
||||
)
|
||||
};
|
||||
assert_sector(0x00, FlashBank::Bank1, 0, 0x0800_0000, SMALL_SECTOR_SIZE, 0x0800_0000);
|
||||
assert_sector(0x00, FlashBank::Bank1, 0, 0x0800_0000, SMALL_SECTOR_SIZE, 0x0800_3FFF);
|
||||
assert_sector(0x03, FlashBank::Bank1, 3, 0x0800_C000, SMALL_SECTOR_SIZE, 0x0800_C000);
|
||||
assert_sector(0x03, FlashBank::Bank1, 3, 0x0800_C000, SMALL_SECTOR_SIZE, 0x0800_FFFF);
|
||||
|
||||
assert_sector(0x00, FlashBank::Bank1, 0, 0x0800_0000, SMALL_SECTOR_SIZE, 0x0800_0000);
|
||||
assert_sector(0x00, FlashBank::Bank1, 0, 0x0800_0000, SMALL_SECTOR_SIZE, 0x0800_3FFF);
|
||||
assert_sector(0x03, FlashBank::Bank1, 3, 0x0800_C000, SMALL_SECTOR_SIZE, 0x0800_C000);
|
||||
assert_sector(0x03, FlashBank::Bank1, 3, 0x0800_C000, SMALL_SECTOR_SIZE, 0x0800_FFFF);
|
||||
assert_sector(0x04, FlashBank::Bank1, 4, 0x0801_0000, MEDIUM_SECTOR_SIZE, 0x0801_0000);
|
||||
assert_sector(0x04, FlashBank::Bank1, 4, 0x0801_0000, MEDIUM_SECTOR_SIZE, 0x0801_FFFF);
|
||||
|
||||
assert_sector(0x04, FlashBank::Bank1, 4, 0x0801_0000, MEDIUM_SECTOR_SIZE, 0x0801_0000);
|
||||
assert_sector(0x04, FlashBank::Bank1, 4, 0x0801_0000, MEDIUM_SECTOR_SIZE, 0x0801_FFFF);
|
||||
assert_sector(0x05, FlashBank::Bank1, 5, 0x0802_0000, LARGE_SECTOR_SIZE, 0x0802_0000);
|
||||
assert_sector(0x05, FlashBank::Bank1, 5, 0x0802_0000, LARGE_SECTOR_SIZE, 0x0803_FFFF);
|
||||
assert_sector(0x07, FlashBank::Bank1, 7, 0x0806_0000, LARGE_SECTOR_SIZE, 0x0806_0000);
|
||||
assert_sector(0x07, FlashBank::Bank1, 7, 0x0806_0000, LARGE_SECTOR_SIZE, 0x0807_FFFF);
|
||||
|
||||
assert_sector(0x05, FlashBank::Bank1, 5, 0x0802_0000, LARGE_SECTOR_SIZE, 0x0802_0000);
|
||||
assert_sector(0x05, FlashBank::Bank1, 5, 0x0802_0000, LARGE_SECTOR_SIZE, 0x0803_FFFF);
|
||||
assert_sector(0x07, FlashBank::Bank1, 7, 0x0806_0000, LARGE_SECTOR_SIZE, 0x0806_0000);
|
||||
assert_sector(0x07, FlashBank::Bank1, 7, 0x0806_0000, LARGE_SECTOR_SIZE, 0x0807_FFFF);
|
||||
assert_sector(0x10, FlashBank::Bank2, 0, 0x0808_0000, SMALL_SECTOR_SIZE, 0x0808_0000);
|
||||
assert_sector(0x10, FlashBank::Bank2, 0, 0x0808_0000, SMALL_SECTOR_SIZE, 0x0808_3FFF);
|
||||
assert_sector(0x13, FlashBank::Bank2, 3, 0x0808_C000, SMALL_SECTOR_SIZE, 0x0808_C000);
|
||||
assert_sector(0x13, FlashBank::Bank2, 3, 0x0808_C000, SMALL_SECTOR_SIZE, 0x0808_FFFF);
|
||||
|
||||
assert_sector(0x10, FlashBank::Bank2, 0, 0x0808_0000, SMALL_SECTOR_SIZE, 0x0808_0000);
|
||||
assert_sector(0x10, FlashBank::Bank2, 0, 0x0808_0000, SMALL_SECTOR_SIZE, 0x0808_3FFF);
|
||||
assert_sector(0x13, FlashBank::Bank2, 3, 0x0808_C000, SMALL_SECTOR_SIZE, 0x0808_C000);
|
||||
assert_sector(0x13, FlashBank::Bank2, 3, 0x0808_C000, SMALL_SECTOR_SIZE, 0x0808_FFFF);
|
||||
assert_sector(0x14, FlashBank::Bank2, 4, 0x0809_0000, MEDIUM_SECTOR_SIZE, 0x0809_0000);
|
||||
assert_sector(0x14, FlashBank::Bank2, 4, 0x0809_0000, MEDIUM_SECTOR_SIZE, 0x0809_FFFF);
|
||||
|
||||
assert_sector(0x14, FlashBank::Bank2, 4, 0x0809_0000, MEDIUM_SECTOR_SIZE, 0x0809_0000);
|
||||
assert_sector(0x14, FlashBank::Bank2, 4, 0x0809_0000, MEDIUM_SECTOR_SIZE, 0x0809_FFFF);
|
||||
|
||||
assert_sector(0x15, FlashBank::Bank2, 5, 0x080A_0000, LARGE_SECTOR_SIZE, 0x080A_0000);
|
||||
assert_sector(0x15, FlashBank::Bank2, 5, 0x080A_0000, LARGE_SECTOR_SIZE, 0x080B_FFFF);
|
||||
assert_sector(0x17, FlashBank::Bank2, 7, 0x080E_0000, LARGE_SECTOR_SIZE, 0x080E_0000);
|
||||
assert_sector(0x17, FlashBank::Bank2, 7, 0x080E_0000, LARGE_SECTOR_SIZE, 0x080F_FFFF);
|
||||
assert_sector(0x15, FlashBank::Bank2, 5, 0x080A_0000, LARGE_SECTOR_SIZE, 0x080A_0000);
|
||||
assert_sector(0x15, FlashBank::Bank2, 5, 0x080A_0000, LARGE_SECTOR_SIZE, 0x080B_FFFF);
|
||||
assert_sector(0x17, FlashBank::Bank2, 7, 0x080E_0000, LARGE_SECTOR_SIZE, 0x080E_0000);
|
||||
assert_sector(0x17, FlashBank::Bank2, 7, 0x080E_0000, LARGE_SECTOR_SIZE, 0x080F_FFFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(bank_setup_configurable))]
|
||||
pub(crate) fn check_bank_setup() {
|
||||
if cfg!(feature = "single-bank") && pac::FLASH.optcr().read().db1m() {
|
||||
panic!("Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the db1m value in the user option bytes or configure embassy to use dual-bank config");
|
||||
}
|
||||
if cfg!(feature = "dual-bank") && !pac::FLASH.optcr().read().db1m() {
|
||||
panic!("Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the db1m value in the user option bytes or configure embassy to use single-bank config");
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,14 @@
|
||||
use core::ptr::write_volatile;
|
||||
use core::sync::atomic::{fence, Ordering};
|
||||
|
||||
use super::{FlashRegion, FlashSector, FLASH_REGIONS, WRITE_SIZE};
|
||||
use super::{FlashSector, WRITE_SIZE};
|
||||
use crate::flash::Error;
|
||||
use crate::pac;
|
||||
|
||||
pub(crate) const fn is_default_layout() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
pub(crate) const fn get_flash_regions() -> &'static [&'static FlashRegion] {
|
||||
&FLASH_REGIONS
|
||||
impl FlashSector {
|
||||
const fn snb(&self) -> u8 {
|
||||
((self.bank as u8) << 4) + self.index_in_bank
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) unsafe fn lock() {
|
||||
@ -53,7 +51,7 @@ pub(crate) unsafe fn blocking_write(start_address: u32, buf: &[u8; WRITE_SIZE])
|
||||
pub(crate) unsafe fn blocking_erase_sector(sector: &FlashSector) -> Result<(), Error> {
|
||||
pac::FLASH.cr().modify(|w| {
|
||||
w.set_ser(true);
|
||||
w.set_snb(sector.index_in_bank)
|
||||
w.set_snb(sector.snb())
|
||||
});
|
||||
|
||||
pac::FLASH.cr().modify(|w| {
|
||||
@ -118,7 +116,7 @@ mod tests {
|
||||
start,
|
||||
size
|
||||
},
|
||||
get_sector(address, &FLASH_REGIONS)
|
||||
get_sector(address, crate::flash::get_flash_regions())
|
||||
)
|
||||
};
|
||||
|
||||
@ -137,7 +135,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(stm32f769)]
|
||||
#[cfg(all(stm32f769, feature = "single-bank"))]
|
||||
fn can_get_sector() {
|
||||
const SMALL_SECTOR_SIZE: u32 = 32 * 1024;
|
||||
const MEDIUM_SECTOR_SIZE: u32 = 128 * 1024;
|
||||
@ -151,7 +149,7 @@ mod tests {
|
||||
start,
|
||||
size
|
||||
},
|
||||
get_sector(address, &FLASH_REGIONS)
|
||||
get_sector(address, crate::flash::get_flash_regions())
|
||||
)
|
||||
};
|
||||
|
||||
@ -168,4 +166,61 @@ mod tests {
|
||||
assert_sector(7, 0x080C_0000, LARGE_SECTOR_SIZE, 0x080C_0000);
|
||||
assert_sector(7, 0x080C_0000, LARGE_SECTOR_SIZE, 0x080F_FFFF);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(all(stm32f769, feature = "dual-bank"))]
|
||||
fn can_get_sector() {
|
||||
const SMALL_SECTOR_SIZE: u32 = 16 * 1024;
|
||||
const MEDIUM_SECTOR_SIZE: u32 = 64 * 1024;
|
||||
const LARGE_SECTOR_SIZE: u32 = 128 * 1024;
|
||||
|
||||
let assert_sector = |index_in_bank: u8, start: u32, size: u32, address: u32, snb: u8, bank: FlashBank| {
|
||||
assert_eq!(
|
||||
FlashSector {
|
||||
bank: bank,
|
||||
index_in_bank,
|
||||
start,
|
||||
size
|
||||
},
|
||||
get_sector(address, crate::flash::get_flash_regions())
|
||||
);
|
||||
assert_eq!(get_sector(address, crate::flash::get_flash_regions()).snb(), snb);
|
||||
};
|
||||
|
||||
assert_sector(0, 0x0800_0000, SMALL_SECTOR_SIZE, 0x0800_0000, 0x00, FlashBank::Bank1);
|
||||
assert_sector(0, 0x0800_0000, SMALL_SECTOR_SIZE, 0x0800_3FFF, 0x00, FlashBank::Bank1);
|
||||
assert_sector(3, 0x0800_C000, SMALL_SECTOR_SIZE, 0x0800_C000, 0x03, FlashBank::Bank1);
|
||||
assert_sector(3, 0x0800_C000, SMALL_SECTOR_SIZE, 0x0800_FFFF, 0x03, FlashBank::Bank1);
|
||||
|
||||
assert_sector(4, 0x0801_0000, MEDIUM_SECTOR_SIZE, 0x0801_0000, 0x04, FlashBank::Bank1);
|
||||
assert_sector(4, 0x0801_0000, MEDIUM_SECTOR_SIZE, 0x0801_FFFF, 0x04, FlashBank::Bank1);
|
||||
|
||||
assert_sector(5, 0x0802_0000, LARGE_SECTOR_SIZE, 0x0802_0000, 0x05, FlashBank::Bank1);
|
||||
assert_sector(5, 0x0802_0000, LARGE_SECTOR_SIZE, 0x0803_FFFF, 0x05, FlashBank::Bank1);
|
||||
assert_sector(10, 0x080C_0000, LARGE_SECTOR_SIZE, 0x080C_0000, 0x0A, FlashBank::Bank1);
|
||||
assert_sector(10, 0x080C_0000, LARGE_SECTOR_SIZE, 0x080D_FFFF, 0x0A, FlashBank::Bank1);
|
||||
|
||||
assert_sector(0, 0x0810_0000, SMALL_SECTOR_SIZE, 0x0810_0000, 0x10, FlashBank::Bank2);
|
||||
assert_sector(0, 0x0810_0000, SMALL_SECTOR_SIZE, 0x0810_3FFF, 0x10, FlashBank::Bank2);
|
||||
assert_sector(3, 0x0810_C000, SMALL_SECTOR_SIZE, 0x0810_C000, 0x13, FlashBank::Bank2);
|
||||
assert_sector(3, 0x0810_C000, SMALL_SECTOR_SIZE, 0x0810_FFFF, 0x13, FlashBank::Bank2);
|
||||
|
||||
assert_sector(4, 0x0811_0000, MEDIUM_SECTOR_SIZE, 0x0811_0000, 0x14, FlashBank::Bank2);
|
||||
assert_sector(4, 0x0811_0000, MEDIUM_SECTOR_SIZE, 0x0811_FFFF, 0x14, FlashBank::Bank2);
|
||||
|
||||
assert_sector(5, 0x0812_0000, LARGE_SECTOR_SIZE, 0x0812_0000, 0x15, FlashBank::Bank2);
|
||||
assert_sector(5, 0x0812_0000, LARGE_SECTOR_SIZE, 0x0813_FFFF, 0x15, FlashBank::Bank2);
|
||||
assert_sector(10, 0x081C_0000, LARGE_SECTOR_SIZE, 0x081C_0000, 0x1A, FlashBank::Bank2);
|
||||
assert_sector(10, 0x081C_0000, LARGE_SECTOR_SIZE, 0x081D_FFFF, 0x1A, FlashBank::Bank2);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(bank_setup_configurable))]
|
||||
pub(crate) fn check_bank_setup() {
|
||||
if cfg!(feature = "single-bank") && !pac::FLASH.optcr().read().n_dbank() {
|
||||
panic!("Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the ndbank value in the user option bytes or configure embassy to use dual-bank config");
|
||||
}
|
||||
if cfg!(feature = "dual-bank") && pac::FLASH.optcr().read().n_dbank() {
|
||||
panic!("Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the ndbank value in the user option bytes or configure embassy to use single-bank config");
|
||||
}
|
||||
}
|
||||
|
@ -3,18 +3,10 @@ use core::sync::atomic::{fence, Ordering};
|
||||
|
||||
use cortex_m::interrupt;
|
||||
|
||||
use super::{FlashRegion, FlashSector, FLASH_REGIONS, WRITE_SIZE};
|
||||
use super::{FlashSector, WRITE_SIZE};
|
||||
use crate::flash::Error;
|
||||
use crate::pac;
|
||||
|
||||
pub(crate) const fn is_default_layout() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
pub(crate) const fn get_flash_regions() -> &'static [&'static FlashRegion] {
|
||||
&FLASH_REGIONS
|
||||
}
|
||||
|
||||
pub(crate) unsafe fn lock() {
|
||||
pac::FLASH.cr().modify(|w| w.set_lock(true));
|
||||
}
|
||||
@ -109,3 +101,23 @@ fn wait_busy() {
|
||||
fn wait_busy() {
|
||||
while pac::FLASH.sr().read().bsy() {}
|
||||
}
|
||||
|
||||
#[cfg(all(bank_setup_configurable, any(flash_g4c2, flash_g4c3, flash_g4c4)))]
|
||||
pub(crate) fn check_bank_setup() {
|
||||
if cfg!(feature = "single-bank") && pac::FLASH.optr().read().dbank() {
|
||||
panic!("Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the dbank value in the user option bytes or configure embassy to use dual-bank config");
|
||||
}
|
||||
if cfg!(feature = "dual-bank") && !pac::FLASH.optr().read().dbank() {
|
||||
panic!("Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the dbank value in the user option bytes or configure embassy to use single-bank config");
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(bank_setup_configurable, flash_g0x1))]
|
||||
pub(crate) fn check_bank_setup() {
|
||||
if cfg!(feature = "single-bank") && pac::FLASH.optr().read().dual_bank() {
|
||||
panic!("Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the dual_bank value in the user option bytes or configure embassy to use dual-bank config");
|
||||
}
|
||||
if cfg!(feature = "dual-bank") && !pac::FLASH.optr().read().dual_bank() {
|
||||
panic!("Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the dual_bank value in the user option bytes or configure embassy to use single-bank config");
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,10 @@
|
||||
use core::ptr::write_volatile;
|
||||
use core::sync::atomic::{fence, Ordering};
|
||||
|
||||
use super::{FlashRegion, FlashSector, FLASH_REGIONS, WRITE_SIZE};
|
||||
use super::{FlashSector, WRITE_SIZE};
|
||||
use crate::flash::Error;
|
||||
use crate::pac;
|
||||
|
||||
pub(crate) const fn is_default_layout() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
// const fn is_dual_bank() -> bool {
|
||||
// FLASH_REGIONS.len() >= 2
|
||||
// }
|
||||
|
||||
pub(crate) fn get_flash_regions() -> &'static [&'static FlashRegion] {
|
||||
&FLASH_REGIONS
|
||||
}
|
||||
|
||||
pub(crate) unsafe fn lock() {
|
||||
if !pac::FLASH.nscr().read().lock() {
|
||||
pac::FLASH.nscr().modify(|r| {
|
||||
|
@ -8,17 +8,9 @@ use cortex_m::interrupt;
|
||||
use pac::flash::regs::Nssr;
|
||||
use pac::flash::vals::Bksel;
|
||||
|
||||
use super::{Error, FlashBank, FlashRegion, FlashSector, FLASH_REGIONS, WRITE_SIZE};
|
||||
use super::{Error, FlashBank, FlashSector, WRITE_SIZE};
|
||||
use crate::pac;
|
||||
|
||||
pub(crate) const fn is_default_layout() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
pub(crate) const fn get_flash_regions() -> &'static [&'static FlashRegion] {
|
||||
&FLASH_REGIONS
|
||||
}
|
||||
|
||||
pub(crate) unsafe fn lock() {
|
||||
pac::FLASH.nscr().modify(|w| w.set_lock(true));
|
||||
}
|
||||
|
@ -1,22 +1,14 @@
|
||||
use core::ptr::write_volatile;
|
||||
use core::sync::atomic::{fence, Ordering};
|
||||
|
||||
use super::{FlashRegion, FlashSector, BANK1_REGION, FLASH_REGIONS, WRITE_SIZE};
|
||||
use super::{FlashSector, BANK1_REGION, FLASH_REGIONS, WRITE_SIZE};
|
||||
use crate::flash::Error;
|
||||
use crate::pac;
|
||||
|
||||
pub(crate) const fn is_default_layout() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
const fn is_dual_bank() -> bool {
|
||||
FLASH_REGIONS.len() >= 2
|
||||
}
|
||||
|
||||
pub(crate) fn get_flash_regions() -> &'static [&'static FlashRegion] {
|
||||
&FLASH_REGIONS
|
||||
}
|
||||
|
||||
pub(crate) unsafe fn lock() {
|
||||
pac::FLASH.bank(0).cr().modify(|w| w.set_lock(true));
|
||||
if is_dual_bank() {
|
||||
|
@ -1,18 +1,10 @@
|
||||
use core::ptr::write_volatile;
|
||||
use core::sync::atomic::{fence, Ordering};
|
||||
|
||||
use super::{FlashRegion, FlashSector, FLASH_REGIONS, WRITE_SIZE};
|
||||
use super::{FlashSector, WRITE_SIZE};
|
||||
use crate::flash::Error;
|
||||
use crate::pac;
|
||||
|
||||
pub(crate) const fn is_default_layout() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
pub(crate) const fn get_flash_regions() -> &'static [&'static FlashRegion] {
|
||||
&FLASH_REGIONS
|
||||
}
|
||||
|
||||
pub(crate) unsafe fn lock() {
|
||||
#[cfg(any(flash_wl, flash_wb, flash_l4))]
|
||||
pac::FLASH.cr().modify(|w| w.set_lock(true));
|
||||
@ -238,3 +230,23 @@ unsafe fn wait_ready_blocking() -> Result<(), Error> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(bank_setup_configurable, flash_l5))]
|
||||
pub(crate) fn check_bank_setup() {
|
||||
if cfg!(feature = "single-bank") && pac::FLASH.optr().read().dbank() {
|
||||
panic!("Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the dbank value in the user option bytes or configure embassy to use dual-bank config");
|
||||
}
|
||||
if cfg!(feature = "dual-bank") && !pac::FLASH.optr().read().dbank() {
|
||||
panic!("Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the dbank value in the user option bytes or configure embassy to use single-bank config");
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(bank_setup_configurable, flash_l4))]
|
||||
pub(crate) fn check_bank_setup() {
|
||||
if cfg!(feature = "single-bank") && pac::FLASH.optr().read().dualbank() {
|
||||
panic!("Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the dualbank value in the user option bytes or configure embassy to use dual-bank config");
|
||||
}
|
||||
if cfg!(feature = "dual-bank") && !pac::FLASH.optr().read().dualbank() {
|
||||
panic!("Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the dualbank value in the user option bytes or configure embassy to use single-bank config");
|
||||
}
|
||||
}
|
||||
|
@ -14,17 +14,9 @@ pub use common::*;
|
||||
pub use crate::_generated::flash_regions::*;
|
||||
pub use crate::_generated::{FLASH_BASE, FLASH_SIZE, MAX_ERASE_SIZE, WRITE_SIZE};
|
||||
|
||||
/// Get whether the default flash layout is being used.
|
||||
///
|
||||
/// In some chips, dual-bank is not default. This will then return `false`
|
||||
/// when dual-bank is enabled.
|
||||
pub fn is_default_layout() -> bool {
|
||||
family::is_default_layout()
|
||||
}
|
||||
|
||||
/// Get all flash regions.
|
||||
pub fn get_flash_regions() -> &'static [&'static FlashRegion] {
|
||||
family::get_flash_regions()
|
||||
&FLASH_REGIONS
|
||||
}
|
||||
|
||||
/// Read size (always 1)
|
||||
|
@ -1,14 +1,6 @@
|
||||
#![allow(unused)]
|
||||
|
||||
use super::{Error, FlashRegion, FlashSector, FLASH_REGIONS, WRITE_SIZE};
|
||||
|
||||
pub(crate) const fn is_default_layout() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
pub(crate) const fn get_flash_regions() -> &'static [&'static FlashRegion] {
|
||||
&FLASH_REGIONS
|
||||
}
|
||||
use super::{Error, FlashSector, WRITE_SIZE};
|
||||
|
||||
pub(crate) unsafe fn lock() {
|
||||
unimplemented!();
|
||||
|
@ -3,18 +3,10 @@ use core::sync::atomic::{fence, Ordering};
|
||||
|
||||
use cortex_m::interrupt;
|
||||
|
||||
use super::{FlashRegion, FlashSector, FLASH_REGIONS, WRITE_SIZE};
|
||||
use super::{FlashSector, WRITE_SIZE};
|
||||
use crate::flash::Error;
|
||||
use crate::pac;
|
||||
|
||||
pub(crate) const fn is_default_layout() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
pub(crate) const fn get_flash_regions() -> &'static [&'static FlashRegion] {
|
||||
&FLASH_REGIONS
|
||||
}
|
||||
|
||||
pub(crate) unsafe fn lock() {
|
||||
pac::FLASH.cr().modify(|w| w.set_lock(true));
|
||||
}
|
||||
|
@ -1,18 +1,10 @@
|
||||
use core::ptr::write_volatile;
|
||||
use core::sync::atomic::{fence, Ordering};
|
||||
|
||||
use super::{FlashBank, FlashRegion, FlashSector, FLASH_REGIONS, WRITE_SIZE};
|
||||
use super::{FlashBank, FlashSector, WRITE_SIZE};
|
||||
use crate::flash::Error;
|
||||
use crate::pac;
|
||||
|
||||
pub(crate) const fn is_default_layout() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
pub(crate) const fn get_flash_regions() -> &'static [&'static FlashRegion] {
|
||||
&FLASH_REGIONS
|
||||
}
|
||||
|
||||
pub(crate) unsafe fn lock() {
|
||||
#[cfg(feature = "trustzone-secure")]
|
||||
pac::FLASH.seccr().modify(|w| w.set_lock(true));
|
||||
|
@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
|
||||
embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" }
|
||||
embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["arch-cortex-m", "executor-thread"] }
|
||||
embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] }
|
||||
embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32f767zi", "time-driver-any", "exti"] }
|
||||
embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32f767zi", "time-driver-any", "exti", "single-bank"] }
|
||||
embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] }
|
||||
embassy-embedded-hal = { version = "0.3.0", path = "../../../../embassy-embedded-hal" }
|
||||
|
||||
|
@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0"
|
||||
|
||||
[dependencies]
|
||||
# Change stm32f777zi to your chip name, if necessary.
|
||||
embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32f777zi", "memory-x", "unstable-pac", "time-driver-any", "exti"] }
|
||||
embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32f777zi", "memory-x", "unstable-pac", "time-driver-any", "exti", "single-bank"] }
|
||||
embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] }
|
||||
embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] }
|
||||
embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
|
||||
|
@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0"
|
||||
|
||||
[dependencies]
|
||||
# Change stm32l4s5vi to your chip name, if necessary.
|
||||
embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "stm32l4r5zi", "memory-x", "time-driver-any", "exti", "chrono"] }
|
||||
embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "stm32l4r5zi", "memory-x", "time-driver-any", "exti", "chrono", "dual-bank"] }
|
||||
embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] }
|
||||
embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] }
|
||||
embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768", ] }
|
||||
|
@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0"
|
||||
|
||||
[dependencies]
|
||||
# Change stm32l552ze to your chip name, if necessary.
|
||||
embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "stm32l552ze", "time-driver-any", "exti", "memory-x", "low-power"] }
|
||||
embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "stm32l552ze", "time-driver-any", "exti", "memory-x", "low-power", "dual-bank"] }
|
||||
embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] }
|
||||
embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] }
|
||||
embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
|
||||
|
@ -12,7 +12,7 @@ stm32f207zg = ["embassy-stm32/stm32f207zg", "spi-v1", "chrono", "not-gpdma", "et
|
||||
stm32f303ze = ["embassy-stm32/stm32f303ze", "chrono", "not-gpdma"]
|
||||
stm32f429zi = ["embassy-stm32/stm32f429zi", "spi-v1", "chrono", "eth", "stop", "can", "not-gpdma", "dac", "rng"]
|
||||
stm32f446re = ["embassy-stm32/stm32f446re", "spi-v1", "chrono", "stop", "can", "not-gpdma", "dac", "sdmmc"]
|
||||
stm32f767zi = ["embassy-stm32/stm32f767zi", "chrono", "not-gpdma", "eth", "rng"]
|
||||
stm32f767zi = ["embassy-stm32/stm32f767zi", "chrono", "not-gpdma", "eth", "rng", "single-bank"]
|
||||
stm32g071rb = ["embassy-stm32/stm32g071rb", "cm0", "not-gpdma", "dac", "ucpd"]
|
||||
stm32g491re = ["embassy-stm32/stm32g491re", "chrono", "stop", "not-gpdma", "rng", "fdcan", "cordic"]
|
||||
stm32h563zi = ["embassy-stm32/stm32h563zi", "spi-v345", "chrono", "eth", "rng", "fdcan", "hash", "cordic", "stop"]
|
||||
@ -23,8 +23,8 @@ stm32l073rz = ["embassy-stm32/stm32l073rz", "cm0", "not-gpdma", "rng"]
|
||||
stm32l152re = ["embassy-stm32/stm32l152re", "spi-v1", "chrono", "not-gpdma"]
|
||||
stm32l496zg = ["embassy-stm32/stm32l496zg", "not-gpdma", "rng"]
|
||||
stm32l4a6zg = ["embassy-stm32/stm32l4a6zg", "chrono", "not-gpdma", "rng", "hash"]
|
||||
stm32l4r5zi = ["embassy-stm32/stm32l4r5zi", "chrono", "not-gpdma", "rng"]
|
||||
stm32l552ze = ["embassy-stm32/stm32l552ze", "not-gpdma", "rng", "hash"]
|
||||
stm32l4r5zi = ["embassy-stm32/stm32l4r5zi", "chrono", "not-gpdma", "rng", "dual-bank"]
|
||||
stm32l552ze = ["embassy-stm32/stm32l552ze", "not-gpdma", "rng", "hash", "dual-bank"]
|
||||
stm32u585ai = ["embassy-stm32/stm32u585ai", "spi-v345", "chrono", "rng", "hash", "cordic"]
|
||||
stm32u5a5zj = ["embassy-stm32/stm32u5a5zj", "spi-v345", "chrono", "rng", "hash"] # FIXME: cordic test cause it crash
|
||||
stm32wb55rg = ["embassy-stm32/stm32wb55rg", "chrono", "not-gpdma", "ble", "mac" , "rng"]
|
||||
@ -53,6 +53,8 @@ not-gpdma = []
|
||||
dac = []
|
||||
ucpd = []
|
||||
cordic = ["dep:num-traits"]
|
||||
dual-bank = ["embassy-stm32/dual-bank"]
|
||||
single-bank = ["embassy-stm32/single-bank"]
|
||||
|
||||
cm0 = ["portable-atomic/unsafe-assume-single-core"]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user