sim: Add NRF52840 device

Add the flash device from the NRF52840 SoC.
This commit is contained in:
David Brown 2017-03-20 12:40:57 -06:00
parent 5c6b6798d0
commit 07fb8fa0c8
1 changed files with 12 additions and 1 deletions

View File

@ -50,7 +50,7 @@ struct Args {
}
#[derive(Debug, RustcDecodable)]
enum DeviceName { Stm32f4, K64f, K64fBig }
enum DeviceName { Stm32f4, K64f, K64fBig, Nrf52840 }
#[derive(Debug)]
struct AlignArg(u8);
@ -116,6 +116,17 @@ fn main() {
areadesc.add_simple_image(0x060000, 0x020000, FlashId::ImageScratch);
(flash, areadesc)
}
Some(DeviceName::Nrf52840) => {
// Simulating the flash on the nrf52840 with partitions set up so that the scratch size
// does not divide into the image size.
let flash = Flash::new(vec![4096; 128], align as usize);
let mut areadesc = AreaDesc::new(&flash);
areadesc.add_image(0x008000, 0x034000, FlashId::Image0);
areadesc.add_image(0x03c000, 0x034000, FlashId::Image1);
areadesc.add_image(0x070000, 0x00d000, FlashId::ImageScratch);
(flash, areadesc)
}
};
let (slot0_base, slot0_len) = areadesc.find(FlashId::Image0);