OpenOCD
|
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_cache * | armv7m_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 [] |
#define ARMV7M_NUM_REGS ARRAY_SIZE(armv7m_regs) |
int armv7m_arch_state | ( | struct target * | target | ) |
Logs summary of ARMv7-M state for a halted target.
Definition at line 725 of file armv7m.c.
References armv7m_common::arm, arm_mode_name(), ARMV7M_CONTROL, armv7m_exception_string(), ARMV7M_R13, buf_get_u32(), arm::core_cache, arm::core_mode, arm::cpsr, ctrl, debug_reason_name(), ERROR_OK, armv7m_common::exception_number, semihosting::hit_fileio, semihosting::is_active, semihosting::is_fileio, LOG_USER, arm::pc, reg_cache::reg_list, target::semihosting, target_name(), target_to_armv7m(), and reg::value.
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.
Definition at line 930 of file armv7m.c.
References working_area::address, ARM_MODE_THREAD, ARMV7M_COMMON_MAGIC, ARRAY_SIZE, buf_set_u32(), armv7m_algorithm::common_magic, armv7m_algorithm::core_mode, destroy_reg_param(), ERROR_FAIL, ERROR_OK, ERROR_TARGET_RESOURCE_NOT_AVAILABLE, ERROR_TARGET_TIMEOUT, init_reg_param(), LOG_DEBUG, LOG_INFO, NULL, PARAM_OUT, target_memory_check_block::result, size, target_memory_check_block::size, TARGET_ADDR_FMT, target_alloc_working_area(), target_buffer_get_u32(), target_buffer_set_u32(), target_free_working_area(), target_get_working_area_avail(), target_read_buffer(), target_run_algorithm(), and target_write_buffer().
Referenced by psoc5lp_erase_check().
Builds cache of architecturally defined registers.
Definition at line 760 of file armv7m.c.
References reg::arch_info, arm_reg::arm, armv7m_common::arm, ARMV7M_NUM_REGS, ARMV7M_PC, ARMV7M_PMSK_BPRI_FLTMSK_CTRL, armv7m_reg_type, armv7m_regs, ARMV7M_XPSR, ARMV8M_PMSK_BPRI_FLTMSK_CTRL_NS, ARMV8M_PMSK_BPRI_FLTMSK_CTRL_S, reg::caller_save, arm::core_cache, arm::cpsr, reg::dirty, reg::exist, feature, reg::feature, reg::group, reg::hidden, LOG_ERROR, reg::name, reg_cache::name, reg_cache::next, NULL, arm_reg::num, reg_cache::num_regs, reg::number, arm::pc, target::reg_cache, reg::reg_data_type, reg_cache::reg_list, register_get_last_cache_p(), reg::size, target, arm_reg::target, target_to_armv7m(), reg_data_type::type, reg::type, reg::valid, arm_reg::value, and reg::value.
Referenced by adapter_init_target(), and cortex_m_init_target().
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.
Definition at line 879 of file armv7m.c.
References working_area::address, ARM_MODE_THREAD, ARMV7M_COMMON_MAGIC, buf_get_u32(), buf_set_u32(), armv7m_algorithm::common_magic, armv7m_algorithm::core_mode, count, destroy_reg_param(), ERROR_OK, init_reg_param(), LOG_ERROR, NULL, PARAM_IN_OUT, PARAM_OUT, target_alloc_working_area(), target_free_working_area(), target_run_algorithm(), target_write_buffer(), and reg_param::value.
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().
void armv7m_free_reg_cache | ( | struct target * | target | ) |
Definition at line 823 of file armv7m.c.
References reg::arch_info, armv7m_common::arm, arm::core_cache, reg::feature, NULL, reg_cache::num_regs, reg::reg_data_type, reg_cache::reg_list, and target_to_armv7m().
Referenced by cortex_m_deinit_target().
|
static |
Definition at line 213 of file armv7m.c.
References reg::arch_info, arm::core_mode, ERROR_TARGET_NOT_HALTED, reg::number, arm::read_core_reg, target::state, arm_reg::target, TARGET_HALTED, and target_to_arm().
Referenced by armv7m_start_algorithm().
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().
int armv7m_init_arch_info | ( | struct target * | target, |
struct armv7m_common * | armv7m | ||
) |
Sets up target as a generic ARMv7-M core.
Definition at line 857 of file armv7m.c.
References arm::arch_info, armv7m_common::arm, ARM_CORE_TYPE_M_PROFILE, arm_init_arch_info(), ARM_STATE_THUMB, ARMV7M_COMMON_MAGIC, armv7m_read_core_reg(), armv7m_setup_semihosting(), armv7m_write_core_reg(), armv7m_common::common_magic, arm::core_state, arm::core_type, armv7m_common::fp_feature, FP_NONE, armv7m_trace_config::itm_ter, arm::read_core_reg, arm::setup_semihosting, armv7m_trace_config::trace_bus_id, armv7m_common::trace_config, and arm::write_core_reg.
Referenced by adapter_init_arch_info(), and cortex_m_init_arch_info().
uint32_t armv7m_map_id_to_regsel | ( | unsigned int | arm_reg_id | ) |
Definition at line 243 of file armv7m.c.
References ARMV7M_D0, ARMV7M_D15, ARMV7M_FPSCR, ARMV7M_MSP, ARMV7M_PC, ARMV7M_PMSK_BPRI_FLTMSK_CTRL, ARMV7M_PSP, ARMV7M_R0, ARMV7M_R14, ARMV7M_REGSEL_FPSCR, ARMV7M_REGSEL_PMSK_BPRI_FLTMSK_CTRL, ARMV7M_REGSEL_S0, ARMV7M_XPSR, ARMV8M_MSP_NS, ARMV8M_PMSK_BPRI_FLTMSK_CTRL_NS, ARMV8M_PMSK_BPRI_FLTMSK_CTRL_S, ARMV8M_REGSEL_MSP_NS, ARMV8M_REGSEL_PMSK_BPRI_FLTMSK_CTRL_NS, ARMV8M_REGSEL_PMSK_BPRI_FLTMSK_CTRL_S, and LOG_ERROR.
Referenced by armv7m_read_core_reg(), armv7m_write_core_reg(), and cortex_m_fast_read_all_regs().
bool armv7m_map_reg_packing | ( | unsigned int | arm_reg_id, |
unsigned int * | reg32_id, | ||
uint32_t * | offset | ||
) |
Definition at line 281 of file armv7m.c.
References ARMV7M_PMSK_BPRI_FLTMSK_CTRL, ARMV7M_PRIMASK, ARMV8M_PMSK_BPRI_FLTMSK_CTRL_NS, ARMV8M_PMSK_BPRI_FLTMSK_CTRL_S, ARMV8M_PRIMASK_NS, ARMV8M_PRIMASK_S, and offset.
Referenced by armv7m_read_core_reg(), armv7m_write_core_reg(), and cortex_m_fast_read_all_regs().
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().
|
static |
Definition at line 306 of file armv7m.c.
References reg::arch_info, armv7m_common::arm, armv7m_map_id_to_regsel(), armv7m_map_reg_packing(), buf_cpy(), buf_get_u64(), buf_set_u32(), arm::core_cache, reg::dirty, ERROR_FAIL, ERROR_OK, armv7m_common::load_core_reg_u32, LOG_DEBUG, mode, reg::name, arm_reg::num, reg_cache::num_regs, reg::number, offset, reg_cache::reg_list, reg::size, target_to_armv7m(), reg::valid, and reg::value.
Referenced by armv7m_init_arch_info(), and armv7m_write_core_reg().
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().
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.
|
static |
Definition at line 228 of file armv7m.c.
References reg::arch_info, buf_cpy(), reg::dirty, ERROR_OK, ERROR_TARGET_NOT_HALTED, reg::size, target::state, arm_reg::target, TARGET_HALTED, reg::valid, and reg::value.
Referenced by armv7m_start_algorithm().
|
static |
Definition at line 850 of file armv7m.c.
References ERROR_OK.
Referenced by armv7m_init_arch_info().
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.
Definition at line 505 of file armv7m.c.
References armv7m_common::arm, ARM_MODE_ANY, ARM_MODE_HANDLER, ARM_MODE_THREAD, ARMV7M_COMMON_MAGIC, ARMV7M_CONTROL, armv7m_get_core_reg(), armv7m_set_core_reg(), ARMV7M_XPSR, buf_get_u32(), buf_set_u32(), armv7m_algorithm::common_magic, armv7m_algorithm::context, arm::core_cache, arm::core_mode, armv7m_algorithm::core_mode, direction, reg::dirty, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, ERROR_TARGET_INVALID, ERROR_TARGET_NOT_HALTED, reg::exist, LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_TARGET_WARNING, LOG_WARNING, reg::name, reg_cache::num_regs, PARAM_IN, reg_cache::reg_list, reg_param::reg_name, register_get_by_name(), size, reg_param::size, reg::size, target::state, TARGET_HALTED, target_resume(), target_to_armv7m(), target_write_buffer(), reg::valid, and reg::value.
Referenced by armv7m_run_algorithm().
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.
Definition at line 619 of file armv7m.c.
References armv7m_common::arm, ARMV7M_COMMON_MAGIC, ARMV7M_CONTROL, buf_get_u32(), buf_set_u32(), armv7m_algorithm::common_magic, armv7m_algorithm::context, arm::core_cache, arm::core_mode, armv7m_algorithm::core_mode, direction, reg::dirty, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, ERROR_TARGET_ALGO_EXIT, ERROR_TARGET_INVALID, ERROR_TARGET_TIMEOUT, reg::exist, LOG_DEBUG, LOG_ERROR, reg::name, reg_cache::num_regs, PARAM_OUT, arm::pc, reg_cache::reg_list, reg_param::reg_name, register_get_by_name(), size, reg_param::size, reg::size, target::state, target_halt(), TARGET_HALTED, TARGET_PRIxADDR, target_read_buffer(), target_to_armv7m(), target_wait_state(), reg::valid, and reg::value.
Referenced by armv7m_run_algorithm().
|
static |
Definition at line 377 of file armv7m.c.
References reg::arch_info, armv7m_common::arm, armv7m_map_id_to_regsel(), armv7m_map_reg_packing(), armv7m_read_core_reg(), buf_cpy(), buf_get_u32(), buf_get_u64(), arm::core_cache, reg::dirty, ERROR_FAIL, ERROR_OK, LOG_DEBUG, LOG_ERROR, mode, reg::name, arm_reg::num, reg_cache::num_regs, reg::number, offset, reg_cache::reg_list, reg::size, armv7m_common::store_core_reg_u32, target_to_armv7m(), reg::valid, arm_reg::value, and reg::value.
Referenced by armv7m_init_arch_info().
const struct command_registration armv7m_command_handlers[] |
|
static |
Definition at line 43 of file armv7m.c.
Referenced by armv7m_exception_string().
const int armv7m_msp_reg_map[ARMV7M_NUM_CORE_REGS] |
Definition at line 60 of file armv7m.c.
Referenced by adapter_debug_entry(), and cortex_m_debug_entry().
const int armv7m_psp_reg_map[ARMV7M_NUM_CORE_REGS] |
Definition at line 51 of file armv7m.c.
Referenced by adapter_debug_entry(), and cortex_m_debug_entry().
|
static |
Definition at line 725 of file armv7m.c.
Referenced by armv7m_build_reg_cache().
const { ... } armv7m_regs[] |
Referenced by armv7m_build_reg_cache().
const char* feature |
Definition at line 82 of file armv7m.c.
Referenced by armv7m_build_reg_cache().