diff options
author | Tarek BOCHKATI <tarek.bouchkati@gmail.com> | 2021-01-12 20:10:23 +0100 |
---|---|---|
committer | Tomas Vanek <vanekt@fbl.cz> | 2021-04-30 08:23:29 +0100 |
commit | ef0da7944886466bc09386616fa089925be5ac62 (patch) | |
tree | 3065468212123fc98891bd101acfd98d264c6761 /src/target/cortex_m.c | |
parent | fd40d0967607f8ee7d0aabf7ea7fd93cfc419bf1 (diff) | |
download | riscv-openocd-ef0da7944886466bc09386616fa089925be5ac62.zip riscv-openocd-ef0da7944886466bc09386616fa089925be5ac62.tar.gz riscv-openocd-ef0da7944886466bc09386616fa089925be5ac62.tar.bz2 |
cortex_m: mark FPU register as non-existent instead of playing with num_regs
Change-Id: Iac7c5bfbb95c8d9a8c6d65104d138692a44eca78
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6015
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Diffstat (limited to 'src/target/cortex_m.c')
-rw-r--r-- | src/target/cortex_m.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c index e7a2fad..46b0e3c 100644 --- a/src/target/cortex_m.c +++ b/src/target/cortex_m.c @@ -2038,19 +2038,11 @@ int cortex_m_examine(struct target *target) armv7m->arm.is_armv6m = true; } - if (armv7m->fp_feature == FP_NONE && - armv7m->arm.core_cache->num_regs > ARMV7M_NUM_CORE_REGS_NOFP) { - /* free unavailable FPU registers */ - size_t idx; - - for (idx = ARMV7M_NUM_CORE_REGS_NOFP; - idx < armv7m->arm.core_cache->num_regs; - idx++) { - free(armv7m->arm.core_cache->reg_list[idx].feature); - free(armv7m->arm.core_cache->reg_list[idx].reg_data_type); - } - armv7m->arm.core_cache->num_regs = ARMV7M_NUM_CORE_REGS_NOFP; - } + /* 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->stlink) { if (i == 3 || i == 4) |