Skip to content

Commit

Permalink
flash: Return flash capacity per-chosen device
Browse files Browse the repository at this point in the history
Previous value was hardcoded to return nrf52840's flash size.
Fixes #246.
  • Loading branch information
plaes committed Apr 30, 2024
1 parent a6c5b15 commit 969d887
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion nrf-softdevice/src/flash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,18 @@ impl ReadNorFlash for Flash {
}

fn capacity(&self) -> usize {
256 * 4096
#[cfg(any(feature = "nrf52805", feature = "nrf52810", feature = "nrf52811",))]
return 48 * 4096; // 192KB

#[cfg(feature = "nrf52820")]
return 64 * 4096; // 256KB

// TODO: nrf52832 has also "lite" edition (QFAB) with 256KB/32KB of flash/RAM
#[cfg(any(feature = "nrf52832", feature = "nrf52833",))]
return 128 * 4096; // 512KB

#[cfg(feature = "nrf52840")]
return 256 * 4096; // 1024KB
}
}

Expand Down

0 comments on commit 969d887

Please sign in to comment.