How to use pyocd - 10 common examples

To help you get started, we’ve selected a few pyocd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mbedmicro / pyOCD / test / unit / test_memory_map.py View on Github external
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
github mbedmicro / pyOCD / test / unit / mockcore.py View on Github external
def __init__(self):
        self.run_token = 1
        self.flash_region = memory_map.FlashRegion(start=0, length=1*1024, blocksize=1024, name='flash')
        self.ram_region = memory_map.RamRegion(start=0x20000000, length=1*1024, name='ram')
        self.ram2_region = memory_map.RamRegion(start=0x20000400, length=1*1024, name='ram2', is_cacheable=False)
        self.memory_map = memory_map.MemoryMap(
            self.flash_region,
            self.ram_region,
            self.ram2_region
            )
        self.ram = bytearray(1024)
        self.ram2 = bytearray(1024)
        self.flash = bytearray([0xff]) * 1024
        self.regions = [(self.flash_region, self.flash),
                        (self.ram_region, self.ram),
                        (self.ram2_region, self.ram2)]
        self.has_fpu = True
        self.clear_all_regs()
github mbedmicro / pyOCD / test / unit / test_cmdline.py View on Github external
def test_all_str(self):
        assert convert_vector_catch('all') == Target.VectorCatch.ALL
github mbedmicro / pyOCD / test / unit / test_memory_map.py View on Github external
def memmap2(flash, rom, ram1, ram2, ram_alias):
    return MemoryMap(flash, rom, ram1, ram2, ram_alias)
github mbedmicro / pyOCD / test / unit / test_timeout.py View on Github external
def test_timeout_a(self):
        s = time()
        with Timeout(0.05) as to:
            while to.check():
                sleep(0.01)
        assert to.did_time_out
        assert (time() - s) >= 0.05
github mbedmicro / pyOCD / test / unit / test_sequencer.py View on Github external
def test_nested(self):
        results = []
        cs = CallSequence(
                ('a', lambda : results.append('a ran')),
                ('b', lambda : results.append('b ran')),
                )
        assert cs.count == 2
        cs2 = CallSequence(
                ('c', cs),
                )
        assert cs2.count == 1
        cs2.invoke()
        assert results == ['a ran', 'b ran']
github mbedmicro / pyOCD / test / unit / test_sequencer.py View on Github external
def test_replace(self):
        results = []
        cs = CallSequence(
                ('a', lambda : results.append('a ran')),
                ('b', lambda : results.append('b ran')),
                )
        assert cs.count == 2
        cs.replace_task('b', lambda : results.append('wheee'))
        cs()
        assert results == ['a ran', 'wheee']
github mbedmicro / pyOCD / test / unit / test_sequencer.py View on Github external
def test_insert_after_4(self):
        cs = CallSequence()
        with pytest.raises(KeyError):
            cs.insert_after('z', ('c', lambda : results.append('c ran')))
github mbedmicro / pyOCD / test / unit / test_sequencer.py View on Github external
def test_wrap(self):
        results = []
        def task_b():
            results.append('b ran')
            return "task b result"
        cs = CallSequence(
                ('a', lambda : results.append('a ran')),
                ('b', task_b),
                )
        assert cs.count == 2
        def wrapper(t):
            assert t == "task b result"
            results.append('wrapper ran')
        cs.wrap_task('b', wrapper)
        cs()
        assert results == ['a ran', 'b ran', 'wrapper ran']
github mbedmicro / pyOCD / test / unit / test_sequencer.py View on Github external
def test_insert_before_3(self):
        results = []
        cs = CallSequence(
                ('a', lambda : results.append('a ran')),
                ('b', lambda : results.append('b ran')),
                )
        assert cs.count == 2
        cs.insert_before('a', ('c', lambda : results.append('c ran')),
                              ('d', lambda : results.append('d ran')))
        assert cs.count == 4
        cs()
        assert results == ['c ran', 'd ran', 'a ran', 'b ran']