diff options
author | Tomas Vanek <vanekt@fbl.cz> | 2019-02-05 09:39:11 +0100 |
---|---|---|
committer | Tomas Vanek <vanekt@fbl.cz> | 2021-11-18 21:09:34 +0000 |
commit | 88f429ead019fd6df96ec15f0d897385f3cef0d0 (patch) | |
tree | 440bbcfde629b8a2020b6c2234ab3c371f57cabf /src/target/cortex_m.h | |
parent | 65d7629183288595177301ce262dac4ba716618b (diff) | |
download | riscv-openocd-88f429ead019fd6df96ec15f0d897385f3cef0d0.zip riscv-openocd-88f429ead019fd6df96ec15f0d897385f3cef0d0.tar.gz riscv-openocd-88f429ead019fd6df96ec15f0d897385f3cef0d0.tar.bz2 |
target/cortex_m: faster reading of all CPU registers
Without the change cortex_m_debug_entry() reads all registers
calling cortex_m_load_core_reg_u32() for each register with
a poor usage of JTAG/SWD queue.
It is time consuming, especially on an USB FS based adapter.
Moreover if target_request debugmsgs are enabled, DCB_DCRDR
is saved and restored on each register read.
This change introduces cortex_m_fast_read_all_regs()
which queues all register reads and a single dap_run() transaction
does all work.
cortex_m_fast_read_all_regs() reads all registers unconditionally
regardless register cache is valid or not. This is a difference
from the original cortex_m_debug_entry() code.
cortex_m_debug_entry times from -d3 log, Cortex-M4F and CMSIS-DAP
(Kinetis K28F-FRDM kit)
target_request | time [ms]
debugmsgs | without the change | with the change
---------------+--------------------+-----------------
disable | 186 | 27
enable | 232 | 29
Added checking of DHCSR.S_REGRDY flag. If "not ready" is seen,
cortex_m->slow_register_read is set and fallback to the old
register read method cortex_m_slow_read_all_regs() is used
instead of cortex_m_fast_read_all_regs().
Change-Id: I0665d94b97ede217394640871dc451ec93410254
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/5321
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Diffstat (limited to 'src/target/cortex_m.h')
-rw-r--r-- | src/target/cortex_m.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/target/cortex_m.h b/src/target/cortex_m.h index a5dfbf8..57ef1e7 100644 --- a/src/target/cortex_m.h +++ b/src/target/cortex_m.h @@ -238,6 +238,8 @@ struct cortex_m_common { const struct cortex_m_part_info *core_info; struct armv7m_common armv7m; + bool slow_register_read; /* A register has not been ready, poll S_REGRDY */ + int apsel; /* Whether this target has the erratum that makes C_MASKINTS not apply to |