Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def memmap2(flash, rom, ram1, ram2, ram_alias):
return MemoryMap(flash, rom, ram1, ram2, ram_alias)
self.target.halt()
self.target.reset_and_halt()
# update core register to execute the init subroutine
result = self._call_function_and_wait(self.flash_algo['pc_init'], init=True)
# check the return code
if result != 0:
LOG.error('init error: %i', result)
class CC3220SF(CoreSightTarget):
VENDOR = "Texas Instruments"
memoryMap = MemoryMap(
RomRegion(start=0x00000000, length=0x00080000),
FlashRegion(start=0x01000000, length=0x00100000, blocksize=0x800, is_boot_memory=True, flash_class=Flash_cc3220sf),
RamRegion(start=0x20000000, length=0x40000)
)
def __init__(self, link):
super(CC3220SF, self).__init__(link, self.memoryMap)
def create_init_sequence(self):
seq = super(CC3220SF,self).create_init_sequence()
seq.wrap_task('create_cores', self.setup_CC3220SF_core)
return seq
def setup_CC3220SF_core(self, arg):
self.cores[0].default_reset_type = self.ResetType.SW_VECTRESET
'pc_erase_sector' : 0x10000092,
'pc_program_page' : 0x100000d4,
'begin_data' : 0x10000400, # Analyzer uses a max of 128 B data (32 pages * 4 bytes / page)
# Double buffering is not supported since there is not enough ram
'begin_stack' : 0x10001000,
'static_base' : 0x10000300,
'min_program_length' : 64,
'analyzer_supported' : True,
'analyzer_address' : 0x10000800 # Analyzer 0x10000800..0x10000e00
}
class LPC800(CoreSightTarget):
VENDOR = "NXP"
memoryMap = MemoryMap(
FlashRegion( start=0, length=0x4000, blocksize=0x400, is_boot_memory=True, algo=FLASH_ALGO),
RamRegion( start=0x10000000, length=0x1000)
)
def __init__(self, link):
super(LPC800, self).__init__(link, self.memoryMap)
self._svd_location = SVDFile.from_builtin("LPC800_v0.3.svd")
def reset_and_halt(self, reset_type=None, map_to_user=True):
super(LPC800, self).reset_and_halt(reset_type)
# Remap to use flash and set SP and SP accordingly
if map_to_user:
self.write_memory(0x40048000, 0x2, 32)
sp = self.read_memory(0x0)
pc = self.read_memory(0x4)
'pc_init' : 0x20000021,
'pc_eraseAll' : 0x20000059,
'pc_erase_sector' : 0x2000007D,
'pc_program_page' : 0x200000AB,
'begin_stack' : 0x20001000,
'begin_data' : 0x20003000, # Analyzer uses a max of 1024 B data (256 pages * 4 bytes / page)
'page_buffers' : [0x20003000, 0x20004000], # Enable double buffering
'static_base' : 0x20000000 + 0x20 + 0x474,
'min_program_length' : 8,
'analyzer_supported' : True,
'analyzer_address' : 0x1ffff000 # Analyzer 0x1ffff000..0x1ffff600
}
class K64F(Kinetis):
memoryMap = MemoryMap(
FlashRegion( start=0, length=0x100000, blocksize=0x1000, is_boot_memory=True,
algo=FLASH_ALGO, flash_class=Flash_Kinetis),
RamRegion( start=0x1fff0000, length=0x40000)
)
def __init__(self, link):
super(K64F, self).__init__(link, self.memoryMap)
self._svd_location = SVDFile.from_builtin("MK64F12.svd")
],
'pc_init' : 0x20000021,
'pc_eraseAll' : 0x20000049,
'pc_erase_sector' : 0x2000006F,
'pc_program_page' : 0x2000009F,
'begin_stack' : 0x20000800,
'begin_data' : 0x20000800, # Analyzer uses a max of 1 KB data (256 pages * 4 bytes / page)
# Note: 128 pages on KL25 and KL26, 256 pages on KL46
'static_base' : 0x20000000 + 0x20 + 0x5E8,
'min_program_length' : 4,
'analyzer_supported' : False # Not enough space on KL02 and KL05
}
class KL02Z(Kinetis):
memoryMap = MemoryMap(
FlashRegion( start=0, length=0x8000, blocksize=0x400, is_boot_memory=True,
algo=FLASH_ALGO, flash_class=Flash_Kinetis),
RamRegion( start=0x1ffffc00, length=0x1000)
)
def __init__(self, link):
super(KL02Z, self).__init__(link, self.memoryMap)
self._svd_location = SVDFile.from_builtin("MKL02Z4.svd")
'pc_program_page' : 0x100000ED,
'pc_erase_sector' : 0x10000071,
'static_base' : 0x10000000 + 0x00000020 + 0x00000148,
'begin_data' : 0x10000000 + 0x00000A00,
# Double buffering is not supported since there is not enough ram
'begin_stack' : 0x10000800,
'min_program_length' : 256, #1024,
'analyzer_supported' : False,
}
class LPC11XX_32(CoreSightTarget):
VENDOR = "NXP"
memoryMap = MemoryMap(
FlashRegion( start=0, length=0x8000, is_boot_memory=True,
blocksize=4096,
page_size=256,
algo=FLASH_ALGO),
RamRegion( start=0x10000000, length=0x1000)
)
def __init__(self, link):
super(LPC11XX_32, self).__init__(link, self.memoryMap)
def reset_and_halt(self, reset_type=None, map_to_user=True):
super(LPC11XX_32, self).reset_and_halt(reset_type)
# Remap to use flash and set SP and SP accordingly
if map_to_user:
self.write_memory(0x40048000, 0x2, 32)
'pc_erase_sector': 0x200000B5,
'pc_eraseAll' : 0x20000095,
'static_base' : 0x20000000 + 0x00000020 + 0x0000050c,
'begin_stack' : 0x20000000 + 0x00000800,
'begin_data' : 0x20000000 + 0x00000A00,
'page_size' : 0x00000200,
'analyzer_supported' : True,
'analyzer_address' : 0x1ffff000, # Analyzer 0x1ffff000..0x1ffff600
'page_buffers' : [0x20003000, 0x20004000], # Enable double buffering
'min_program_length' : 8,
}
class K82F25615(Kinetis):
memoryMap = MemoryMap(
FlashRegion( start=0, length=0x40000, blocksize=0x1000, is_boot_memory=True,
algo=FLASH_ALGO, flash_class=Flash_Kinetis),
RamRegion( start=0x1fff0000, length=0x40000)
)
def __init__(self, transport):
super(K82F25615, self).__init__(transport, self.memoryMap)
self._svd_location = SVDFile.from_builtin("MK82F25615.svd")
seq.insert_after('create_cores',
('setup_dbgmcu', self.setup_dbgmcu)
)
return seq
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 STM32F439xI(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,
'pc_eraseAll' : 0x20000095,
'static_base' : 0x20000000 + 0x00000020 + 0x00000504,
'begin_stack' : 0x20000000 + 0x00000800,
'begin_data' : 0x20000000 + 0x00000A00,
'page_size' : 0x00000200,
'analyzer_supported' : True,
'analyzer_address' : 0x1ffff000, # Analyzer 0x1ffff000..0x1ffff600
'page_buffers' : [0x20003000, 0x20004000], # Enable double buffering
'min_program_length' : 8,
}
class K22FA12(Kinetis):
# 1MB flash with 4kB sectors, 128kB RAM
memoryMap = MemoryMap(
FlashRegion( start=0, length=0x100000, blocksize=0x1000, is_boot_memory=True,
algo=FLASH_ALGO, flash_class=Flash_Kinetis),
RamRegion( start=0x1fff0000, length=0x20000)
)
def __init__(self, link):
super(K22FA12, self).__init__(link, self.memoryMap)
self._svd_location = SVDFile.from_builtin("MK22FA12.svd")
def create_init_sequence(self):
seq = super(K22FA12, self).create_init_sequence()
# Modify the memory map for FlexNVM devices.
seq.insert_before('create_cores',
('fixup_memory_map', self.fixup_memory_map)
)
'pc_eraseAll' : 0x20000059,
'pc_erase_sector' : 0x2000007D,
'pc_program_page' : 0x200000AB,
'begin_stack' : 0x20000800,
'begin_data' : 0x20001000, # Analyzer uses a max of 1024 B data (256 pages * 4 bytes / page)
'page_buffers' : [0x20001000, 0x20001800], # Enable double buffering
'static_base' : 0x20000000 + 0x20 + 0x48c,
'min_program_length' : 8,
'analyzer_supported' : True,
'analyzer_address' : 0x1ffff000 # Analyzer 0x1ffff000..0x1ffff600
}
class K22F(Kinetis):
# 512kB flash with 2kB sectors, 128kB RAM
memoryMap = MemoryMap(
FlashRegion( start=0, length=0x80000, blocksize=0x800, is_boot_memory=True,
algo=FLASH_ALGO, flash_class=Flash_Kinetis),
RamRegion( start=0x1fff0000, length=0x20000)
)
def __init__(self, link):
super(K22F, self).__init__(link, self.memoryMap)
self._svd_location = SVDFile.from_builtin("MK22F51212.svd")