Merge pull request #10189 from kfnta/rollup

Rollup
pull/10200/head
Martin Kojtal 2019-03-21 21:39:17 +01:00 committed by GitHub
commit 6f403217c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 59 additions and 100 deletions

View File

@ -8121,7 +8121,7 @@
"public-ram-start": "0x08047600", "public-ram-start": "0x08047600",
"public-ram-size": "0x200" "public-ram-size": "0x200"
}, },
"device_name": "CY8C6247BZI-D54", "sectors": [[268435456, 512]],
"bootloader_supported": true "bootloader_supported": true
}, },
"CY8CMOD_062_4343W": { "CY8CMOD_062_4343W": {
@ -8153,7 +8153,7 @@
"post_binary_hook": { "post_binary_hook": {
"function": "PSOC6Code.complete" "function": "PSOC6Code.complete"
}, },
"device_name": "CY8C6347BZI-BLD53", "sectors": [[268443648, 512]],
"bootloader_supported": true "bootloader_supported": true
}, },
"CY8CKIT_062_4343W": { "CY8CKIT_062_4343W": {

View File

@ -462778,56 +462778,5 @@
], ],
"vendor": "Nordic Semiconductor:54" "vendor": "Nordic Semiconductor:54"
}, },
"CY8C6347BZI-BLD53": {
"core": "Cortex-M4",
"vendor": "Cypress",
"sectors": [
[
268435456,
512
]
],
"memories": {
"IROM1": {
"access": {
"execute": true,
"non_secure": true,
"non_secure_callable": false,
"peripheral": false,
"read": true,
"secure": false,
"write": true
},
"default": true,
"start": "0x10002000",
"size": "0x000FE000"
}
}
},
"CY8C6247BZI-D54": {
"core": "Cortex-M4",
"vendor": "Cypress",
"sectors": [
[
268435456,
512
]
],
"memories": {
"IROM1": {
"access": {
"execute": true,
"non_secure": true,
"non_secure_callable": false,
"peripheral": false,
"read": true,
"secure": false,
"write": true
},
"start": "0x10040000",
"size": "0xB8000"
}
}
},
"version": "0.2.0" "version": "0.2.0"
} }

View File

@ -649,16 +649,21 @@ class Config(object):
@property @property
def sectors(self): def sectors(self):
"""Return a list of tuples of sector start,size""" """Return a list of tuples of sector start,size"""
cache = Cache(False, False) try:
if self.target.device_name not in cache.index: return self.target.sectors
raise ConfigException("Bootloader not supported on this target: " except AttributeError:
"targets.json `device_name` not found in " cache = Cache(False, False)
"arm_pack_manager index.") if self.target.device_name not in cache.index:
cmsis_part = cache.index[self.target.device_name] raise ConfigException(
sectors = cmsis_part['sectors'] "Bootloader not supported on this target: "
if sectors: "targets.json `device_name` not found in "
return sectors "arm_pack_manager index."
raise ConfigException("No sector info available") )
cmsis_part = cache.index[self.target.device_name]
sectors = cmsis_part['sectors']
if sectors:
return sectors
raise ConfigException("No sector info available")
def _get_cmsis_part(self): def _get_cmsis_part(self):
if not hasattr(self.target, "device_name"): if not hasattr(self.target, "device_name"):
@ -745,6 +750,48 @@ class Config(object):
try: try:
cmsis_part = self._get_cmsis_part() cmsis_part = self._get_cmsis_part()
present_memories = set(cmsis_part['memories'].keys())
valid_memories = set(memory_list).intersection(present_memories)
memories = self._get_mem_specs(
["read", "write" if active_memory == "RAM" else "execute"],
cmsis_part
)
for memory in valid_memories:
mem_start = memories[memory]["start"]
mem_size = memories[memory]["size"]
if memory in ['IROM1', 'PROGRAM_FLASH']:
start, size = self._get_primary_memory_override("rom")
if start:
mem_start = start
if size:
mem_size = size
memory = 'ROM'
elif memory in ['IRAM1', 'SRAM_OC', 'SRAM_UPPER', 'SRAM']:
if (self.has_ram_regions):
continue
start, size = self._get_primary_memory_override("ram")
if start:
mem_start = start
if size:
mem_size = size
memory = 'RAM'
else:
active_memory_counter += 1
memory = active_memory + str(active_memory_counter)
if not isinstance(mem_start, int):
mem_start = int(mem_start, 0)
if not isinstance(mem_size, int):
mem_size = int(mem_size, 0)
available_memories[memory] = [mem_start, mem_size]
if not available_memories:
raise ConfigException(
"Bootloader not supported on this target. "
"No memories found."
)
return available_memories
except ConfigException: except ConfigException:
""" If the target doesn't exits in cmsis, but present in targets.json """ If the target doesn't exits in cmsis, but present in targets.json
with ram and rom start/size defined""" with ram and rom start/size defined"""
@ -764,43 +811,6 @@ class Config(object):
available_memories[active_memory] = [start, size] available_memories[active_memory] = [start, size]
return available_memories return available_memories
present_memories = set(cmsis_part['memories'].keys())
valid_memories = set(memory_list).intersection(present_memories)
memories = self._get_mem_specs(
["read", "write" if active_memory == "RAM" else "execute"],
cmsis_part
)
for memory in valid_memories:
mem_start = memories[memory]["start"]
mem_size = memories[memory]["size"]
if memory in ['IROM1', 'PROGRAM_FLASH']:
start, size = self._get_primary_memory_override("rom")
if start:
mem_start = start
if size:
mem_size = size
memory = 'ROM'
elif memory in ['IRAM1', 'SRAM_OC', 'SRAM_UPPER', 'SRAM']:
if (self.has_ram_regions):
continue
start, size = self._get_primary_memory_override("ram")
if start:
mem_start = start
if size:
mem_size = size
memory = 'RAM'
else:
active_memory_counter += 1
memory = active_memory + str(active_memory_counter)
if not isinstance(mem_start, int):
mem_start = int(mem_start, 0)
if not isinstance(mem_size, int):
mem_size = int(mem_size, 0)
available_memories[memory] = [mem_start, mem_size]
return available_memories
@property @property
def ram_regions(self): def ram_regions(self):