From: Antonio Borneo Date: Mon, 3 Nov 2025 10:18:02 +0000 (+0100) Subject: target: cortex-m: don't query cache on hla targets X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fnext;p=users%2Fborneoa%2Fopenocd-next.git target: cortex-m: don't query cache on hla targets The cache handling code is written and optimized for dap queuing. On hla targets it causes a segmentation fault due to uninitialized AP pointer still set to NULL. While it's possible to modify the code to cope with hla targets, this would lower the OpenOCD performance on modern adapters. Make cache handling not available on hla targets. Reported-by: Tomas Vanek Change-Id: Ief4499caedcee477b9517a7ad4597d06b5cb061e Signed-off-by: Antonio Borneo Fixes: 04da6e2c6246 ("target: cortex-m: add support for armv8m caches") Reviewed-on: https://review.openocd.org/c/openocd/+/9202 Reviewed-by: Tomas Vanek Tested-by: jenkins --- diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c index 21b611b29..9f0b6284b 100644 --- a/src/target/cortex_m.c +++ b/src/target/cortex_m.c @@ -3007,10 +3007,12 @@ int cortex_m_examine(struct target *target) cortex_m->fp_num_code, cortex_m->dwt_num_comp); - retval = armv7m_identify_cache(target); - if (retval != ERROR_OK) { - LOG_ERROR("Cannot detect cache"); - return retval; + if (!armv7m->is_hla_target) { + retval = armv7m_identify_cache(target); + if (retval != ERROR_OK) { + LOG_ERROR("Cannot detect cache"); + return retval; + } } }