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 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 ram_alias(): return RamRegion(start=0x30000400, length=1 * 1024, name='ram2_alias', alias='ram2', is_cacheable=False)
def ram2(): return RamRegion(start=0x20000400, length=1 * 1024, name='ram2', is_cacheable=False)
def ram1(): return RamRegion(start=0x20000000, length=1 * 1024, name='ram')
def test_eq(self, flash, ram1): assert flash != ram1 a = RamRegion(name='a', start=0x1000, length=0x2000) b = RamRegion(name='a', start=0x1000, length=0x2000) assert a == b
def ram1(): return RamRegion(start=0x20000000, length=1 * 1024, name='ram', is_default=False)
def test_multiple_unnamed_regions(self): map = MemoryMap(RomRegion(0x01000000, length=0x8000), RamRegion(0x20000000, length=0x8000)) assert len(map) == 2