OpenOCD
|
Go to the source code of this file.
Data Structures | |
struct | armv7m_algorithm |
struct | armv7m_common |
Macros | |
#define | ARMV7M_COMMON_MAGIC 0x2A452A45U |
#define | ARMV7M_NUM_CORE_REGS (ARMV7M_CORE_LAST_REG - ARMV7M_CORE_FIRST_REG + 1) |
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) |
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... | |
int | armv7m_invalidate_core_regs (struct target *target) |
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) |
int | armv7m_mode_to_number (enum armv7m_mode mode) |
enum armv7m_mode | armv7m_number_to_mode (int number) |
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, unsigned int timeout_ms, void *arch_info) |
Runs a Thumb algorithm in the target. More... | |
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, unsigned int timeout_ms, void *arch_info) |
Waits for an algorithm in the target. More... | |
static bool | is_armv7m (const struct armv7m_common *armv7m) |
static struct armv7m_common * | target_to_armv7m (struct target *target) |
static struct armv7m_common * | target_to_armv7m_safe (struct target *target) |
Variables | |
const struct command_registration | armv7m_command_handlers [] |
const int | armv7m_msp_reg_map [] |
const int | armv7m_psp_reg_map [] |
#define ARMV7M_NUM_CORE_REGS (ARMV7M_CORE_LAST_REG - ARMV7M_CORE_FIRST_REG + 1) |
anonymous enum |
anonymous enum |
anonymous enum |
int armv7m_arch_state | ( | struct target * | target | ) |
Logs summary of ARMv7-M state for a halted target.
Definition at line 728 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, sp, 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 933 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 763 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 882 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 204 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 826 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().
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 459 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 860 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().
int armv7m_invalidate_core_regs | ( | struct target * | target | ) |
uint32_t armv7m_map_id_to_regsel | ( | unsigned int | arm_reg_id | ) |
Definition at line 246 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 284 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 1065 of file armv7m.c.
Referenced by adapter_resume(), adapter_step(), cortex_m_restore_one(), and cortex_m_step().
int armv7m_mode_to_number | ( | enum armv7m_mode | mode | ) |
enum armv7m_mode armv7m_number_to_mode | ( | int | number | ) |
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_restore_one(), 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, | ||
unsigned int | timeout_ms, | ||
void * | arch_info | ||
) |
Runs a Thumb algorithm in the target.
Definition at line 483 of file armv7m.c.
References armv7m_start_algorithm(), armv7m_wait_algorithm(), and ERROR_OK.
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 508 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_ERROR, LOG_TARGET_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, | ||
unsigned int | timeout_ms, | ||
void * | arch_info | ||
) |
Waits for an algorithm in the target.
Definition at line 622 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().
|
inlinestatic |
Definition at line 250 of file armv7m.h.
References ARMV7M_COMMON_MAGIC, and armv7m_common::common_magic.
Referenced by arm_nandread(), arm_nandwrite(), arm_semihosting(), cfi_spansion_write_block(), chibios_update_stacking(), freertos_get_thread_reg_list(), riot_create(), rtkernel_get_thread_reg_list(), and target_to_armv7m_safe().
|
inlinestatic |
Definition at line 262 of file armv7m.h.
References target::arch_info, and container_of.
Referenced by adapter_debug_entry(), adapter_load_context(), adapter_poll(), adapter_resume(), adapter_step(), arm_nandread(), arm_nandwrite(), arm_semihosting(), armv7m_arch_state(), armv7m_build_reg_cache(), armv7m_free_reg_cache(), armv7m_get_gdb_reg_list(), armv7m_read_core_reg(), armv7m_restore_context(), armv7m_start_algorithm(), armv7m_trace_itm_config(), armv7m_wait_algorithm(), armv7m_write_core_reg(), cfi_spansion_write_block(), chibios_update_stacking(), COMMAND_HANDLER(), cortex_m_dcc_read(), cortex_m_deinit_target(), cortex_m_examine(), cortex_m_examine_exception_reason(), cortex_m_fast_read_all_regs(), cortex_m_has_tz(), cortex_m_load_core_reg_u32(), cortex_m_profiling(), cortex_m_queue_reg_read(), cortex_m_read_dhcsr_atomic_sticky(), cortex_m_read_memory(), cortex_m_restart_one(), cortex_m_restore_one(), cortex_m_slow_read_all_regs(), cortex_m_store_core_reg_u32(), cortex_m_write_memory(), freertos_get_thread_reg_list(), handle_reset_halt(), hl_assert_reset(), ipc_poll_lock_stat(), numicro_get_arm_arch(), psoc4_sysreq(), riot_create(), rtkernel_get_thread_reg_list(), stm32lx_read_id_code(), stm32lx_write_half_pages(), and target_to_armv7m_safe().
|
inlinestatic |
Definition at line 274 of file armv7m.h.
References target::arch_info, is_arm(), is_armv7m(), NULL, target_to_arm(), and target_to_armv7m().
Referenced by cortex_m_get_impl_part(), stm32l4_probe(), and stm32l4_read_idcode().
|
extern |
|
extern |
Definition at line 60 of file armv7m.c.
Referenced by adapter_debug_entry(), and cortex_m_debug_entry().
|
extern |
Definition at line 51 of file armv7m.c.
Referenced by adapter_debug_entry(), and cortex_m_debug_entry().