How to use the pyocd.core.memory_map.FlashRegion function in pyocd

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 / 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 / pyocd / target / builtin / target_STM32L031x6.py View on Github external
# Flash information
    'flash_start': 0x8000000,
    'flash_size': 0x8000,
    'sector_sizes': (
        (0x0, 0x80),
    )
}


class STM32L031x6(CoreSightTarget):

    VENDOR = "STMicroelectronics"
    
    memoryMap = MemoryMap(
        FlashRegion(name='Flash', start=0x08000000, length=0x8000, blocksize=0x1000,  is_boot_memory=True, algo=FLASH_ALGO),
        RamRegion(name='RAM', start=0x20000000, length=0x2000),
        FlashRegion(name='EEPROM', start=0x08080000, length=0x400, blocksize=0x400, algo=FLASH_ALGO)
        )

    def __init__(self, link):
        super(STM32L031x6, self).__init__(link, self.memoryMap)
        self._svd_location = SVDFile.from_builtin("STM32L0x1.svd")

    def create_init_sequence(self):
        seq = super(STM32L031x6, self).create_init_sequence()

        seq.insert_after('create_cores',
            ('setup_dbgmcu', self.setup_dbgmcu)
            )

        return seq
github mbedmicro / pyOCD / pyocd / target / builtin / target_MKL82Z128xxx7.py View on Github external
'static_base' : 0x20000000 + 0x00000020 + 0x000004f4,
    'begin_stack' : 0x20000000 + 0x00000800,
    'begin_data' : 0x20000000 + 0x00000A00,
    'page_size' : 0x00000200,

    # All keys above are auto-generated. The following are added or modified.
    'analyzer_supported' : True,                 # [modified] default is False
    'analyzer_address' : 0x1fffa000,             # [modified] default is zero. Use 8K block before flash algo. Can be any unused SRAM.
    'page_buffers' : [0x20000a00, 0x20001200],   # [added] Use areas above algo. Note 'begin_data' is unused if double buffering. Can be any unused SRAM.
    'min_program_length' : 4                     # [added] See FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE in KSDK features header file
}

class KL82Z7(Kinetis):

    memoryMap = MemoryMap(
        FlashRegion(    start=0,           length=0x20000,      blocksize=0x800, is_boot_memory=True,
            algo=FLASH_ALGO, flash_class=Flash_Kinetis),
        RomRegion(      start=0x1c000000,  end=0x1c007fff),
        RomRegion(      start=0x68000000,  end=0x6fffffff),
        RamRegion(      start=0x1fffA000,  length=0x18000)
        )

    def __init__(self, link):
        super(KL82Z7, self).__init__(link, self.memoryMap)
        self._svd_location = SVDFile.from_builtin("MKL82Z7.svd")
github mbedmicro / pyOCD / pyocd / target / builtin / target_lpc4088dm.py View on Github external
'page_size' : 0x00000200,
    'analyzer_supported' : False,
    'min_program_length' : 512,
    'analyzer_supported' : True,
    'analyzer_address' : 0x10002000  # Analyzer 0x10002000..0x10002600
}


class LPC4088dm(LPC4088):

    memoryMap = MemoryMap(
        FlashRegion(    start=0,           length=0x10000,      is_boot_memory=True,
                                                                blocksize=0x1000,
                                                                page_size=0x200,
                                                                algo=INTERNAL_FLASH_ALGO),
        FlashRegion(    start=0x10000,     length=0x70000,      blocksize=0x8000,
                                                                page_size=0x400,
                                                                erase_sector_weight=LARGE_ERASE_SECTOR_WEIGHT,
                                                                program_page_weight=LARGE_PROGRAM_PAGE_WEIGHT,
                                                                algo=INTERNAL_FLASH_ALGO),
        FlashRegion(    start=0x28000000,  length=0x1000000,    blocksize=0x1000,
                                                                page_size=0x200,
                                                                algo=FLASH_ALGO),
        RamRegion(      start=0x10000000,  length=0x10000),
        )

    def __init__(self, link):
        super(LPC4088dm, self).__init__(link, self.memoryMap)
github mbedmicro / pyOCD / pyocd / target / builtin / target_CY8C64xx.py View on Github external
algo=flash_algo_main,
                    erase_all_weight=ERASE_ALL_WEIGHT,
                    erase_sector_weight=ERASE_SECTOR_WEIGHT,
                    program_page_weight=PROGRAM_PAGE_WEIGHT,
                    flash_class=Flash_CY8C64xx_Main),

        FlashRegion(start=0x14000000, length=0x8000, blocksize=0x200,
                    is_boot_memory=False,
                    erased_byte_value=0,
                    algo=flash_algo_work,
                    erase_all_weight=ERASE_ALL_WEIGHT,
                    erase_sector_weight=ERASE_SECTOR_WEIGHT,
                    program_page_weight=PROGRAM_PAGE_WEIGHT,
                    flash_class=Flash_CY8C64xx_Work),

        FlashRegion(start=0x18000000, length=0x1000000, blocksize=0x40000, page_size=0x1000,
                    is_boot_memory=False,
                    is_testable=False,
                    erased_byte_value=0xFF,
                    is_powered_on_boot=False,
                    algo=flash_algo_smif,
                    erase_all_weight=140,
                    erase_sector_weight=1,
                    program_page_weight=1,
                    flash_class=Flash_CY8C64xx_SMIF),

        RamRegion(start=0x08000000, length=0x20000)
    )

    def __init__(self, link):
        super(cy8c64xx_cm4_full, self).__init__(link, self.memoryMap)
github mbedmicro / pyOCD / pyocd / target / builtin / target_MK28FN2M0xxx15.py View on Github external
'pc_program_page': 0x2000009F,
    'pc_erase_sector': 0x20000071,
    'pc_eraseAll' : 0x2000004D,
    'static_base' : 0x20000000 + 0x00000020 + 0x0000046c,
    'begin_stack' : 0x20000000 + 0x00000800,
    'begin_data' : 0x20000000 + 0x00000A00,
    'analyzer_supported' : True,
    'analyzer_address' : 0x1ffff000,  # Analyzer 0x1ffff000..0x1ffff600
    'page_buffers' : [0x20003000, 0x20004000],   # Enable double buffering
    'min_program_length' : 8,
  }

class K28F15(Kinetis):

    memoryMap = MemoryMap(
        FlashRegion(    start=0,           length=0x200000,     blocksize=0x1000, is_boot_memory=True,
            algo=FLASH_ALGO, flash_class=Flash_Kinetis),
        RamRegion(      start=0x1ffC0000,  length=0x80000),
        RamRegion(      start=0x34000000,  length=0x80000),
        RamRegion(      start=0x14000000,  length=0x1000)
        )

    def __init__(self, transport):
        super(K28F15, self).__init__(transport, self.memoryMap)
        self._svd_location = SVDFile.from_builtin("MK28FA15.xml")
github mbedmicro / pyOCD / pyocd / target / builtin / target_nRF51822_xxAA.py View on Github external
'begin_stack'      : 0x20001000,
               'static_base'      : 0x20000170,
               'min_program_length' : 4,
               'analyzer_supported' : True,
               'analyzer_address' : 0x20003000  # Analyzer 0x20003000..0x20003600
              }

class NRF51(CoreSightTarget):

    VENDOR = "Nordic Semiconductor"
    
    memoryMap = MemoryMap(
        FlashRegion(    start=0,           length=0x40000,      blocksize=0x400, is_boot_memory=True,
            algo=FLASH_ALGO),
        # User Information Configation Registers (UICR) as a flash region
        FlashRegion(    start=0x10001000,  length=0x100,        blocksize=0x100, is_testable=False,
            algo=FLASH_ALGO),
        RamRegion(      start=0x20000000,  length=0x4000)
        )

    def __init__(self, link):
        super(NRF51, self).__init__(link, self.memoryMap)
        self._svd_location = SVDFile.from_builtin("nrf51.svd")

    def resetn(self):
        """
        reset a core. After a call to this function, the core
        is running
        """
        #Regular reset will kick NRF out of DBG mode
        LOG.debug("target_nrf51.reset: enable reset pin")
        self.write_memory(RESET, RESET_ENABLE)
github mbedmicro / pyOCD / pyocd / target / builtin / target_STM32F429xx.py View on Github external
def setup_dbgmcu(self):
        self.write32(DBGMCU.CR, DBGMCU.CR_VALUE)
        self.write32(DBGMCU.APB1_FZ, DBGMCU.APB1_FZ_VALUE)
        self.write32(DBGMCU.APB2_FZ, DBGMCU.APB2_FZ_VALUE)

class STM32F429xI(CoreSightTarget):

    VENDOR = "STMicroelectronics"

    memoryMap = MemoryMap(
        FlashRegion( start=0x08000000, length=0x10000,  sector_size=0x4000,
                                                        page_size=0x1000,
                                                        is_boot_memory=True,
                                                        erase_all_weight=CHIP_ERASE_WEIGHT,
                                                        algo=FLASH_ALGO),
        FlashRegion( start=0x08010000, length=0x10000,  sector_size=0x10000,
                                                        page_size=0x1000,
                                                        erase_all_weight=CHIP_ERASE_WEIGHT,
                                                        algo=FLASH_ALGO),
        FlashRegion( start=0x08020000, length=0xe0000,  sector_size=0x20000,
                                                        page_size=0x1000,
                                                        erase_all_weight=CHIP_ERASE_WEIGHT,
                                                        algo=FLASH_ALGO),
        FlashRegion( start=0x08100000, length=0x10000,  sector_size=0x4000,
                                                        page_size=0x1000,
                                                        erase_all_weight=CHIP_ERASE_WEIGHT,
                                                        algo=FLASH_ALGO),
        FlashRegion( start=0x08110000, length=0x10000,  sector_size=0x10000,
                                                        page_size=0x1000,
                                                        erase_all_weight=CHIP_ERASE_WEIGHT,
                                                        algo=FLASH_ALGO),
        FlashRegion( start=0x08120000, length=0xe0000,  sector_size=0x20000,
github mbedmicro / pyOCD / pyocd / target / builtin / target_lpc4088qsb.py View on Github external
'page_size' : 0x00000200,
    'analyzer_supported' : False,
    'min_program_length' : 512,
    'analyzer_supported' : True,
    'analyzer_address' : 0x10002000  # Analyzer 0x10002000..0x10002600
}


class LPC4088qsb(LPC4088):

    memoryMap = MemoryMap(
        FlashRegion(    start=0,           length=0x10000,      is_boot_memory=True,
                                                                blocksize=0x1000,
                                                                page_size=0x200,
                                                                algo=INTERNAL_FLASH_ALGO),
        FlashRegion(    start=0x10000,     length=0x70000,      blocksize=0x8000,
                                                                page_size=0x400,
                                                                erase_sector_weight=LARGE_ERASE_SECTOR_WEIGHT,
                                                                program_page_weight=LARGE_PROGRAM_PAGE_WEIGHT,
                                                                algo=INTERNAL_FLASH_ALGO),
        FlashRegion(    start=0x28000000,  length=0x1000000,    blocksize=0x1000,
                                                                page_size=0x200,
                                                                algo=FLASH_ALGO),
        RamRegion(      start=0x10000000,  length=0x10000),
        )

    def __init__(self, link):
        super(LPC4088qsb, self).__init__(link, self.memoryMap)
github mbedmicro / pyOCD / pyocd / core / memory_map.py View on Github external
DEFAULT_ATTRS.update({
        'access': 'rw', # By default device regions are not executable.
        'is_cacheable': False,
        'is_testable': False,
        })

    def __init__(self, start=0, end=0, length=None, **attrs):
        attrs['type'] = MemoryType.DEVICE
        super(DeviceRegion, self).__init__(start=start, end=end, length=length, **attrs)

## @brief Map from memory type to class.         
MEMORY_TYPE_CLASS_MAP = {
        MemoryType.OTHER:   MemoryRegion,
        MemoryType.RAM:     RamRegion,
        MemoryType.ROM:     RomRegion,
        MemoryType.FLASH:   FlashRegion,
        MemoryType.DEVICE:  DeviceRegion,
    }

class MemoryMap(object):
    """! @brief Memory map consisting of memory regions."""
    def __init__(self, *moreRegions):
        self._regions = []
        self.add_regions(*moreRegions)

    @property
    def regions(self):
        return self._regions

    @property
    def region_count(self):
        return len(self._regions)