Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add const FLASH_ERASE_VALUE #533

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions stm32-metapac-gen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@ impl Gen {
writeln!(&mut extra, "pub const FLASH_BASE: usize = {};", first_flash.address).unwrap();
writeln!(&mut extra, "pub const FLASH_SIZE: usize = {};", total_flash_size).unwrap();

let erase_values: HashSet<_> = flash_regions
.iter()
.map(|r| r.settings.as_ref().unwrap().erase_value)
.collect();
assert_eq!(1, erase_values.len());
writeln!(
&mut extra,
"pub const FLASH_ERASE_VALUE: u8 = {};",
erase_values.iter().next().unwrap()
)
.unwrap();

let write_sizes: HashSet<_> = flash_regions
.iter()
.map(|r| r.settings.as_ref().unwrap().write_size)
Expand Down