Commit 2bff647d authored by David Brown's avatar David Brown Committed by David Brown
Browse files

sim: Add a K64fMulti flash device

This device is similar to the K64f device, but it is twice as large, and
has the extra partitions needed to test multi-image.

Signed-off-by: default avatarDavid Brown <david.brown@linaro.org>
parent 06ef06e6
Loading
Loading
Loading
Loading
+17
Changes for sim/src/image.rs: 17 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -279,6 +279,23 @@ impl ImagesBuilder {
                flash.insert(1, dev1);
                (flash, areadesc)
            }
            DeviceName::K64fMulti => {
                // NXP style flash, but larger, to support multiple images.
                let dev = SimFlash::new(vec![4096; 256], align as usize, erased_val);

                let dev_id = 0;
                let mut areadesc = AreaDesc::new();
                areadesc.add_flash_sectors(dev_id, &dev);
                areadesc.add_image(0x020000, 0x020000, FlashId::Image0, dev_id);
                areadesc.add_image(0x040000, 0x020000, FlashId::Image1, dev_id);
                areadesc.add_image(0x060000, 0x001000, FlashId::ImageScratch, dev_id);
                areadesc.add_image(0x080000, 0x020000, FlashId::Image2, dev_id);
                areadesc.add_image(0x0a0000, 0x020000, FlashId::Image3, dev_id);

                let mut flash = SimMultiFlash::new();
                flash.insert(dev_id, dev);
                (flash, areadesc)
            }
        }
    }
}
+3 −1
Changes for sim/src/lib.rs: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -45,12 +45,13 @@ struct Args {
}

#[derive(Copy, Clone, Debug, Deserialize)]
pub enum DeviceName { Stm32f4, K64f, K64fBig, Nrf52840, Nrf52840SpiFlash, }
pub enum DeviceName { Stm32f4, K64f, K64fBig, K64fMulti, Nrf52840, Nrf52840SpiFlash, }

pub static ALL_DEVICES: &'static [DeviceName] = &[
    DeviceName::Stm32f4,
    DeviceName::K64f,
    DeviceName::K64fBig,
    DeviceName::K64fMulti,
    DeviceName::Nrf52840,
    DeviceName::Nrf52840SpiFlash,
];
@@ -61,6 +62,7 @@ impl fmt::Display for DeviceName {
            DeviceName::Stm32f4 => "stm32f4",
            DeviceName::K64f => "k64f",
            DeviceName::K64fBig => "k64fbig",
            DeviceName::K64fMulti => "k64fmulti",
            DeviceName::Nrf52840 => "nrf52840",
            DeviceName::Nrf52840SpiFlash => "Nrf52840SpiFlash",
        };