Example #1
0
    def test_block_sector_size(self):
        rgn = FlashRegion(start=0x1000, end=0x1fff, blocksize=256)
        assert rgn.blocksize == 256
        assert rgn.sector_size == 256

        rgn = FlashRegion(start=0x1000, end=0x1fff, sector_size=256)
        assert rgn.blocksize == 256
        assert rgn.sector_size == 256
Example #2
0
 def test_custom_flash_attrs(self):
     flash = FlashRegion(start=0x01000000,
                         length=4 * 1024,
                         blocksize=0x800,
                         name='myflash',
                         is_boot_memory=False,
                         page_size=256,
                         phrase_size=4,
                         erase_all_weight=1.2,
                         erase_sector_weight=0.1,
                         program_page_weight=0.25)
     assert flash.type == MemoryType.FLASH
     assert flash.start == 0x01000000
     assert flash.end == 0x01000fff
     assert flash.length == 0x1000
     assert flash.blocksize == 0x800
     assert flash.page_size == 256
     assert flash.phrase_size == 4
     assert flash.erase_all_weight == 1.2
     assert flash.erase_sector_weight == 0.1
     assert flash.program_page_weight == 0.25
     assert flash.name == 'myflash'
     assert flash.is_flash
     assert not flash.is_ram
     assert not flash.is_rom
     assert not flash.is_boot_memory
     assert flash.is_cacheable
     assert flash.is_powered_on_boot
     assert flash.is_readable
     assert not flash.is_writable
     assert flash.is_executable
Example #3
0
def flash_with_flm():
    return FlashRegion(start=0,
                       length=1 * 1024,
                       blocksize=0x100,
                       name='flash',
                       is_boot_memory=True,
                       flm=FLM_PATH)
Example #4
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'
Example #5
0
 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
Example #6
0
def flash():
    return FlashRegion(start=0,
                       length=1 * 1024,
                       blocksize=0x100,
                       name='flash',
                       is_boot_memory=True)