target/arm: optimize architecture flags
In target/arm.h the struct arm do contain 3 flags to retain architecture version for some tweaks. The proposal is to have only one enumerated flag 'arch' for the same purpose. Change-Id: Ia5d5accfed8158ca21eb54af2fdea8e36f0266ae Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/6229 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
committed by
Antonio Borneo
parent
b19505a343
commit
f69adafb3d
@@ -504,7 +504,7 @@ static int cortex_m_debug_entry(struct target *target)
|
||||
|
||||
/* examine PE security state */
|
||||
bool secure_state = false;
|
||||
if (armv7m->arm.is_armv8m) {
|
||||
if (armv7m->arm.arch == ARM_ARCH_V8M) {
|
||||
uint32_t dscsr;
|
||||
|
||||
retval = mem_ap_read_u32(armv7m->debug_ap, DCB_DSCSR, &dscsr);
|
||||
@@ -1645,7 +1645,7 @@ static int cortex_m_read_memory(struct target *target, target_addr_t address,
|
||||
{
|
||||
struct armv7m_common *armv7m = target_to_armv7m(target);
|
||||
|
||||
if (armv7m->arm.is_armv6m) {
|
||||
if (armv7m->arm.arch == ARM_ARCH_V6M) {
|
||||
/* armv6m does not handle unaligned memory access */
|
||||
if (((size == 4) && (address & 0x3u)) || ((size == 2) && (address & 0x1u)))
|
||||
return ERROR_TARGET_UNALIGNED_ACCESS;
|
||||
@@ -1659,7 +1659,7 @@ static int cortex_m_write_memory(struct target *target, target_addr_t address,
|
||||
{
|
||||
struct armv7m_common *armv7m = target_to_armv7m(target);
|
||||
|
||||
if (armv7m->arm.is_armv6m) {
|
||||
if (armv7m->arm.arch == ARM_ARCH_V6M) {
|
||||
/* armv6m does not handle unaligned memory access */
|
||||
if (((size == 4) && (address & 0x3u)) || ((size == 2) && (address & 0x1u)))
|
||||
return ERROR_TARGET_UNALIGNED_ACCESS;
|
||||
@@ -2005,7 +2005,7 @@ int cortex_m_examine(struct target *target)
|
||||
unsigned int core = (cpuid >> 4) & 0xf;
|
||||
|
||||
/* Check if it is an ARMv8-M core */
|
||||
armv7m->arm.is_armv8m = true;
|
||||
armv7m->arm.arch = ARM_ARCH_V8M;
|
||||
|
||||
switch (cpuid & ARM_CPUID_PARTNO_MASK) {
|
||||
case CORTEX_M23_PARTNO:
|
||||
@@ -2021,7 +2021,7 @@ int cortex_m_examine(struct target *target)
|
||||
core = 55;
|
||||
break;
|
||||
default:
|
||||
armv7m->arm.is_armv8m = false;
|
||||
armv7m->arm.arch = ARM_ARCH_V7M;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2063,18 +2063,18 @@ int cortex_m_examine(struct target *target)
|
||||
}
|
||||
} else if (core == 0) {
|
||||
/* Cortex-M0 does not support unaligned memory access */
|
||||
armv7m->arm.is_armv6m = true;
|
||||
armv7m->arm.arch = ARM_ARCH_V6M;
|
||||
}
|
||||
|
||||
/* VECTRESET is supported only on ARMv7-M cores */
|
||||
cortex_m->vectreset_supported = !armv7m->arm.is_armv8m && !armv7m->arm.is_armv6m;
|
||||
cortex_m->vectreset_supported = armv7m->arm.arch == ARM_ARCH_V7M;
|
||||
|
||||
/* Check for FPU, otherwise mark FPU register as non-existent */
|
||||
if (armv7m->fp_feature == FP_NONE)
|
||||
for (size_t idx = ARMV7M_FPU_FIRST_REG; idx <= ARMV7M_FPU_LAST_REG; idx++)
|
||||
armv7m->arm.core_cache->reg_list[idx].exist = false;
|
||||
|
||||
if (!armv7m->arm.is_armv8m)
|
||||
if (armv7m->arm.arch != ARM_ARCH_V8M)
|
||||
for (size_t idx = ARMV8M_FIRST_REG; idx <= ARMV8M_LAST_REG; idx++)
|
||||
armv7m->arm.core_cache->reg_list[idx].exist = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user