This is an automated email from Gerrit. "Antonio Borneo <[email protected]>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9508
-- gerrit commit 87ccaa828666884605662c8af9f9be992640570e Author: Antonio Borneo <[email protected]> Date: Mon Mar 16 16:02:41 2026 +0100 target: cortex-m: use specific instruction-set for capstone The old 'arm disassemble' command was only showing the standard thumb instructions on Cortex-M, missing the armv7m and armv8m specific instructions. In the new '$target_name disassemble' command use the capstone flags to enable disassembly of all Cortex-M instructions. ARM DDI0553B.y reports that Cortex-M only fetches instructions in little endian, so no need to check for target endianness. Instrument both Cortex-M and HLA targets. Change-Id: Ibaacb6662c5c5a8d9c83f51d126f515e12dbb615 Signed-off-by: Antonio Borneo <[email protected]> diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c index c4eee8c071..b34bed4202 100644 --- a/src/target/cortex_m.c +++ b/src/target/cortex_m.c @@ -3198,6 +3198,15 @@ static int cortex_m_target_create(struct target *target) return ERROR_OK; } +int cortex_m_insn_set(struct command_invocation *cmd, struct target *target, + const char **insn_set) +{ + // string match in target/oocd_capstone.c + *insn_set = "cortexm"; + + return ERROR_OK; +} + /*--------------------------------------------------------------------------*/ static int cortex_m_verify_pointer(struct command_invocation *cmd, @@ -3503,4 +3512,6 @@ struct target_type cortexm_target = { .deinit_target = cortex_m_deinit_target, .profiling = cortex_m_profiling, + + .insn_set = cortex_m_insn_set, }; diff --git a/src/target/cortex_m.h b/src/target/cortex_m.h index 615369f344..871e428690 100644 --- a/src/target/cortex_m.h +++ b/src/target/cortex_m.h @@ -399,6 +399,8 @@ void cortex_m_enable_watchpoints(struct target *target); void cortex_m_deinit_target(struct target *target); int cortex_m_profiling(struct target *target, uint32_t *samples, uint32_t max_num_samples, uint32_t *num_samples, uint32_t seconds); +int cortex_m_insn_set(struct command_invocation *cmd, struct target *target, + const char **insn_set); /** * Forces Cortex-M core to the basic secure context with SAU and MPU off diff --git a/src/target/hla_target.c b/src/target/hla_target.c index 2fc94790d9..65103412f8 100644 --- a/src/target/hla_target.c +++ b/src/target/hla_target.c @@ -681,4 +681,6 @@ struct target_type hla_target = { .add_watchpoint = cortex_m_add_watchpoint, .remove_watchpoint = cortex_m_remove_watchpoint, .profiling = cortex_m_profiling, + + .insn_set = cortex_m_insn_set, }; diff --git a/src/target/oocd_capstone.c b/src/target/oocd_capstone.c index 10507ed304..5475857a62 100644 --- a/src/target/oocd_capstone.c +++ b/src/target/oocd_capstone.c @@ -29,6 +29,7 @@ static struct { } all_archs[] = { { "arm", CS_ARCH_ARM, CS_MODE_ARM }, { "arm64", CS_ARCH_ARM64, CS_MODE_LITTLE_ENDIAN }, + { "cortexm", CS_ARCH_ARM, CS_MODE_ARM | CS_MODE_THUMB | CS_MODE_MCLASS }, { "thumb", CS_ARCH_ARM, CS_MODE_ARM | CS_MODE_THUMB }, }; --
