diff --git a/sim/src/main.rs b/sim/src/main.rs index 5ec39120..8b08a81f 100644 --- a/sim/src/main.rs +++ b/sim/src/main.rs @@ -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);