OpenOCD
armv7m.c File Reference
Include dependency graph for armv7m.c:

Go to the source code of this file.

Macros

#define ARMV7M_NUM_REGS   ARRAY_SIZE(armv7m_regs)
 

Functions

int armv7m_arch_state (struct target *target)
 Logs summary of ARMv7-M state for a halted target. More...
 
int armv7m_blank_check_memory (struct target *target, struct target_memory_check_block *blocks, int num_blocks, uint8_t erased_value)
 Checks an array of memory regions whether they are erased. More...
 
struct reg_cachearmv7m_build_reg_cache (struct target *target)
 Builds cache of architecturally defined registers. More...
 
int armv7m_checksum_memory (struct target *target, target_addr_t address, uint32_t count, uint32_t *checksum)
 Generates a CRC32 checksum of a memory region. More...
 
const char * armv7m_exception_string (int number)
 Maps ISR number (from xPSR) to name. More...
 
void armv7m_free_reg_cache (struct target *target)
 
static int armv7m_get_core_reg (struct reg *reg)
 
int armv7m_get_gdb_reg_list (struct target *target, struct reg **reg_list[], int *reg_list_size, enum target_register_class reg_class)
 Returns generic ARM userspace registers to GDB. More...
 
int armv7m_init_arch_info (struct target *target, struct armv7m_common *armv7m)
 Sets up target as a generic ARMv7-M core. More...
 
uint32_t armv7m_map_id_to_regsel (unsigned int arm_reg_id)
 
bool armv7m_map_reg_packing (unsigned int arm_reg_id, unsigned int *reg32_id, uint32_t *offset)
 
int armv7m_maybe_skip_bkpt_inst (struct target *target, bool *inst_found)
 
static int armv7m_read_core_reg (struct target *target, struct reg *r, int num, enum arm_mode mode)
 
int armv7m_restore_context (struct target *target)
 Restores target context using the cache of core registers set up by armv7m_build_reg_cache(), calling optional core-specific hooks. More...
 
int armv7m_run_algorithm (struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, target_addr_t entry_point, target_addr_t exit_point, int timeout_ms, void *arch_info)
 Runs a Thumb algorithm in the target. More...
 
static int armv7m_set_core_reg (struct reg *reg, uint8_t *buf)
 
static int armv7m_setup_semihosting (struct target *target, int enable)
 
int armv7m_start_algorithm (struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, target_addr_t entry_point, target_addr_t exit_point, void *arch_info)
 Starts a Thumb algorithm in the target. More...
 
int armv7m_wait_algorithm (struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, target_addr_t exit_point, int timeout_ms, void *arch_info)
 Waits for an algorithm in the target. More...
 
static int armv7m_write_core_reg (struct target *target, struct reg *r, int num, enum arm_mode mode, uint8_t *value)
 

Variables

const struct command_registration armv7m_command_handlers []
 
static const char *const armv7m_exception_strings []
 
const int armv7m_msp_reg_map [ARMV7M_NUM_CORE_REGS]
 
const int armv7m_psp_reg_map [ARMV7M_NUM_CORE_REGS]
 
static const struct reg_arch_type armv7m_reg_type
 
struct {
   unsigned   bits
 
   const char *   feature
 
   const char *   group
 
   unsigned   id
 
   const char *   name
 
   enum reg_type   type
 
armv7m_regs []
 

Macro Definition Documentation

◆ ARMV7M_NUM_REGS

#define ARMV7M_NUM_REGS   ARRAY_SIZE(armv7m_regs)

Definition at line 162 of file armv7m.c.

Function Documentation

◆ armv7m_arch_state()

◆ armv7m_blank_check_memory()

◆ armv7m_build_reg_cache()

◆ armv7m_checksum_memory()

◆ armv7m_exception_string()

const char* armv7m_exception_string ( int  number)

Maps ISR number (from xPSR) to name.

Note that while names and meanings for the first sixteen are standardized (with zero not a true exception), external interrupts are only numbered. They are assigned by vendors, which generally assign different numbers to peripherals (such as UART0 or a USB peripheral controller).

Definition at line 201 of file armv7m.c.

References armv7m_exception_strings, and number.

Referenced by armv7m_arch_state(), and cortex_m_examine_exception_reason().

◆ armv7m_free_reg_cache()

void armv7m_free_reg_cache ( struct target target)

◆ armv7m_get_core_reg()

static int armv7m_get_core_reg ( struct reg reg)
static

◆ armv7m_get_gdb_reg_list()

int armv7m_get_gdb_reg_list ( struct target target,
struct reg **  reg_list[],
int *  reg_list_size,
enum target_register_class  reg_class 
)

Returns generic ARM userspace registers to GDB.

Definition at line 456 of file armv7m.c.

References armv7m_common::arm, ARMV7M_NUM_CORE_REGS, arm::core_cache, ERROR_FAIL, ERROR_OK, reg_cache::num_regs, REG_CLASS_ALL, reg_cache::reg_list, size, and target_to_armv7m().

◆ armv7m_init_arch_info()

◆ armv7m_map_id_to_regsel()

◆ armv7m_map_reg_packing()

bool armv7m_map_reg_packing ( unsigned int  arm_reg_id,
unsigned int *  reg32_id,
uint32_t *  offset 
)

◆ armv7m_maybe_skip_bkpt_inst()

int armv7m_maybe_skip_bkpt_inst ( struct target target,
bool *  inst_found 
)

Definition at line 1062 of file armv7m.c.

Referenced by adapter_resume(), adapter_step(), cortex_m_resume(), and cortex_m_step().

◆ armv7m_read_core_reg()

◆ armv7m_restore_context()

int armv7m_restore_context ( struct target target)

Restores target context using the cache of core registers set up by armv7m_build_reg_cache(), calling optional core-specific hooks.

Definition at line 168 of file armv7m.c.

References armv7m_common::arm, ARM_MODE_ANY, arm::core_cache, reg::dirty, ERROR_OK, reg::exist, LOG_DEBUG, reg_cache::num_regs, armv7m_common::pre_restore_context, reg_cache::reg_list, target_to_armv7m(), reg::value, and arm::write_core_reg.

Referenced by adapter_resume(), adapter_step(), cortex_m_resume(), and cortex_m_step().

◆ armv7m_run_algorithm()

int armv7m_run_algorithm ( struct target target,
int  num_mem_params,
struct mem_param mem_params,
int  num_reg_params,
struct reg_param reg_params,
target_addr_t  entry_point,
target_addr_t  exit_point,
int  timeout_ms,
void *  arch_info 
)

Runs a Thumb algorithm in the target.

Definition at line 480 of file armv7m.c.

References armv7m_start_algorithm(), armv7m_wait_algorithm(), and ERROR_OK.

◆ armv7m_set_core_reg()

static int armv7m_set_core_reg ( struct reg reg,
uint8_t *  buf 
)
static

◆ armv7m_setup_semihosting()

static int armv7m_setup_semihosting ( struct target target,
int  enable 
)
static

Definition at line 850 of file armv7m.c.

References ERROR_OK.

Referenced by armv7m_init_arch_info().

◆ armv7m_start_algorithm()

◆ armv7m_wait_algorithm()

◆ armv7m_write_core_reg()

Variable Documentation

◆ armv7m_command_handlers

const struct command_registration armv7m_command_handlers[]
Initial value:
= {
{
.name = "arm",
.mode = COMMAND_ANY,
.help = "ARM command group",
.usage = "",
},
}
const struct command_registration arm_all_profiles_command_handlers[]
Definition: armv4_5.c:1148
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:247
@ COMMAND_ANY
Definition: command.h:42

Definition at line 1062 of file armv7m.c.

◆ armv7m_exception_strings

const char* const armv7m_exception_strings[]
static
Initial value:
= {
"", "Reset", "NMI", "HardFault",
"MemManage", "BusFault", "UsageFault", "SecureFault",
"RESERVED", "RESERVED", "RESERVED", "SVCall",
"DebugMonitor", "RESERVED", "PendSV", "SysTick"
}

Definition at line 43 of file armv7m.c.

Referenced by armv7m_exception_string().

◆ armv7m_msp_reg_map

const int armv7m_msp_reg_map[ARMV7M_NUM_CORE_REGS]
Initial value:
= {
}
@ ARMV7M_R1
Definition: armv7m.h:108
@ ARMV7M_MSP
Definition: armv7m.h:128
@ ARMV7M_R6
Definition: armv7m.h:114
@ ARMV7M_R2
Definition: armv7m.h:109
@ ARMV7M_R3
Definition: armv7m.h:110
@ ARMV7M_R14
Definition: armv7m.h:124
@ ARMV7M_R9
Definition: armv7m.h:118
@ ARMV7M_R12
Definition: armv7m.h:122
@ ARMV7M_R0
Definition: armv7m.h:107
@ ARMV7M_PC
Definition: armv7m.h:125
@ ARMV7M_R7
Definition: armv7m.h:115
@ ARMV7M_R4
Definition: armv7m.h:112
@ ARMV7M_XPSR
Definition: armv7m.h:127
@ ARMV7M_R8
Definition: armv7m.h:117
@ ARMV7M_R11
Definition: armv7m.h:120
@ ARMV7M_R10
Definition: armv7m.h:119
@ ARMV7M_R5
Definition: armv7m.h:113

Definition at line 60 of file armv7m.c.

Referenced by adapter_debug_entry(), and cortex_m_debug_entry().

◆ armv7m_psp_reg_map

◆ armv7m_reg_type

const struct reg_arch_type armv7m_reg_type
static
Initial value:
= {
}
static int armv7m_set_core_reg(struct reg *reg, uint8_t *buf)
Definition: armv7m.c:228
static int armv7m_get_core_reg(struct reg *reg)
Definition: armv7m.c:213

Definition at line 725 of file armv7m.c.

Referenced by armv7m_build_reg_cache().

◆ 

const { ... } armv7m_regs[]

Referenced by armv7m_build_reg_cache().

◆ bits

unsigned bits

Definition at line 79 of file armv7m.c.

◆ feature

const char* feature

Definition at line 82 of file armv7m.c.

Referenced by armv7m_build_reg_cache().

◆ group

const char* group

Definition at line 81 of file armv7m.c.

◆ id

unsigned id

Definition at line 77 of file armv7m.c.

◆ name

const char* name

Definition at line 78 of file armv7m.c.

◆ type

enum reg_type type

Definition at line 79 of file armv7m.c.