]> www.infradead.org Git - users/borneoa/openocd-next.git/commitdiff
target: cortex-m: don't query cache on hla targets master next
authorAntonio Borneo <borneo.antonio@gmail.com>
Mon, 3 Nov 2025 10:18:02 +0000 (11:18 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 8 Nov 2025 16:00:22 +0000 (16:00 +0000)
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 <vanekt@fbl.cz>
Change-Id: Ief4499caedcee477b9517a7ad4597d06b5cb061e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 04da6e2c6246 ("target: cortex-m: add support for armv8m caches")
Reviewed-on: https://review.openocd.org/c/openocd/+/9202
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
src/target/cortex_m.c

index 21b611b297297adf5f0f9d29c38b0f645b534dfe..9f0b6284b0aa5fbac4e4759eacb94ce40113cb89 100644 (file)
@@ -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;
+                       }
                }
        }