def test_x(self): ramrgn = RamRegion(name='core0 ram', start=0x1fffa000, length=0x18000) assert ramrgn.contains_range(0x1fffc9f8, end=0x1fffc9fc) assert ramrgn.intersects_range(0x1fffc9f8, end=0x1fffc9fc) dualMap = MemoryMap( FlashRegion(name='flash', start=0, length=0x80000, blocksize=0x800, is_boot_memory=True), RomRegion(name='core1 imem alias', start=0x1d200000, length=0x40000), ramrgn, RomRegion(name='core1 imem', start=0x2d200000, length=0x40000), RamRegion(name='core1 dmem', start=0x2d300000, length=0x8000), RamRegion(name='usb ram', start=0x40100000, length=0x800)) rgns = dualMap.get_intersecting_regions(0x1fffc9f8, end=0x1fffc9fc) assert len(rgns) > 0
def test_default_name(self): rgn = RamRegion(start=0x1000, end=0x1fff) assert rgn.name == 'ram' rgn = RomRegion(start=0x1000, end=0x1fff) assert rgn.name == 'rom' rgn = FlashRegion(start=0x1000, end=0x1fff, blocksize=256) assert rgn.name == 'flash' rgn = DeviceRegion(start=0x1000, end=0x1fff) assert rgn.name == 'device'
def rom(): return RomRegion(start=0x1c000000, length=16 * 1024, name='rom')
def test_multiple_unnamed_regions(self): map = MemoryMap(RomRegion(0x01000000, length=0x8000), RamRegion(0x20000000, length=0x8000)) assert len(map) == 2
def test_name_uniquing(self, memmap): memmap.add_region(RomRegion(0x01000000, length=0x8000, name="rom")) assert memmap.get_first_matching_region( name="rom_1").start == 0x01000000