Align with removal of MemoryRegionKind::Otp

This commit is contained in:
Rasmus Melchior Jacobsen 2023-03-25 13:02:42 +01:00
parent a8567f0617
commit c848bd9c9c

View File

@ -109,9 +109,9 @@ fn main() {
let flash_memory_regions = METADATA
.memory
.iter()
.filter(|x| x.kind == MemoryRegionKind::Flash || x.kind == MemoryRegionKind::Otp);
.filter(|x| x.kind == MemoryRegionKind::Flash && x.settings.is_some());
for region in flash_memory_regions.clone() {
let region_name = format_ident!("{}", region.name);
let region_name = format_ident!("{}", region.name.replace("_", ""));
let base = region.address as usize;
let size = region.size as usize;
let settings = region.settings.as_ref().unwrap();
@ -136,8 +136,9 @@ fn main() {
let (fields, inits): (Vec<TokenStream>, Vec<TokenStream>) = flash_memory_regions
.map(|f| {
let field_name = format_ident!("{}", f.name.to_lowercase());
let field_type = format_ident!("{}", f.name);
let trimmed_name = f.name.replace("_", "");
let field_name = format_ident!("{}", trimmed_name.to_lowercase());
let field_type = format_ident!("{}", trimmed_name);
let field = quote! {
pub #field_name: #field_type
};
@ -629,10 +630,10 @@ fn main() {
for m in METADATA
.memory
.iter()
.filter(|m| m.kind == MemoryRegionKind::Flash || m.kind == MemoryRegionKind::Otp)
.filter(|m| m.kind == MemoryRegionKind::Flash && m.settings.is_some())
{
let mut row = Vec::new();
row.push(m.name.to_string());
row.push(m.name.replace("_", ""));
flash_regions_table.push(row);
}