sim: Add the K64fBig target
This target simulates running with pretend large sectors on a device that really has small sectors.
This commit is contained in:
parent
79fdfe5dfc
commit
90c1913c13
|
@ -79,6 +79,29 @@ impl AreaDesc {
|
|||
});
|
||||
}
|
||||
|
||||
// Add a simple slot to the image. This ignores the device layout, and just adds the area as a
|
||||
// single unit. It assumes that the image lines up with image boundaries. This tests
|
||||
// configurations where the partition table uses larger sectors than the underlying flash
|
||||
// device.
|
||||
pub fn add_simple_image(&mut self, base: usize, len: usize, id: FlashId) {
|
||||
let area = vec![FlashArea {
|
||||
flash_id: id,
|
||||
device_id: 42,
|
||||
pad16: 0,
|
||||
off: base as u32,
|
||||
size: len as u32,
|
||||
}];
|
||||
|
||||
self.areas.push(area);
|
||||
self.whole.push(FlashArea {
|
||||
flash_id: id,
|
||||
device_id: 42,
|
||||
pad16: 0,
|
||||
off: base as u32,
|
||||
size: len as u32,
|
||||
});
|
||||
}
|
||||
|
||||
pub fn get_c(&self) -> CAreaDesc {
|
||||
let mut areas: CAreaDesc = Default::default();
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ struct Args {
|
|||
}
|
||||
|
||||
#[derive(Debug, RustcDecodable)]
|
||||
enum DeviceName { Stm32f4, K64f }
|
||||
enum DeviceName { Stm32f4, K64f, K64fBig }
|
||||
|
||||
#[derive(Debug)]
|
||||
struct AlignArg(u8);
|
||||
|
@ -102,6 +102,17 @@ fn main() {
|
|||
areadesc.add_image(0x060000, 0x001000, FlashId::ImageScratch);
|
||||
(flash, areadesc)
|
||||
}
|
||||
Some(DeviceName::K64fBig) => {
|
||||
// Simulating an STM style flash on top of an NXP style flash. Underlying flash device
|
||||
// uses small sectors, but we tell the bootloader they are large.
|
||||
let flash = Flash::new(vec![4096; 128]);
|
||||
|
||||
let mut areadesc = AreaDesc::new(&flash);
|
||||
areadesc.add_simple_image(0x020000, 0x020000, FlashId::Image0);
|
||||
areadesc.add_simple_image(0x040000, 0x020000, FlashId::Image1);
|
||||
areadesc.add_simple_image(0x060000, 0x020000, FlashId::ImageScratch);
|
||||
(flash, areadesc)
|
||||
}
|
||||
};
|
||||
|
||||
// println!("Areas: {:#?}", areadesc.get_c());
|
||||
|
|
Loading…
Reference in New Issue