X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Ftarget%2Fnds32_v3_common.c;h=271ffdd1cebdcc33dfa9bb700f337a420ac4d687;hp=e01025f2669ad61e842c4904353840707eaf39c5;hb=7a3eec2b4d9dbb9533acfb271dbe91afa0727c8e;hpb=18c40eb9e53f559e089b6f745284cf42718182da diff --git a/src/target/nds32_v3_common.c b/src/target/nds32_v3_common.c index e01025f266..271ffdd1ce 100644 --- a/src/target/nds32_v3_common.c +++ b/src/target/nds32_v3_common.c @@ -13,9 +13,7 @@ * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + * along with this program. If not, see . * ***************************************************************************/ #ifdef HAVE_CONFIG_H @@ -29,18 +27,6 @@ #include "nds32_aice.h" #include "nds32_v3_common.h" -static struct breakpoint syscall_breakpoint = { - 0x80, - 0, - 4, - BKPT_SOFT, - 0, - NULL, - NULL, - 0x515CA11, - 0, -}; - static struct nds32_v3_common_callback *v3_common_callback; static int nds32_v3_register_mapping(struct nds32 *nds32, int reg_no) @@ -90,17 +76,18 @@ static int nds32_v3_debug_entry(struct nds32 *nds32, bool enable_watchpoint) if (enable_watchpoint) CHECK_RETVAL(v3_common_callback->deactivate_hardware_watchpoint(nds32->target)); + struct breakpoint *syscall_break = &(nds32->syscall_break); if (nds32->virtual_hosting) { - if (syscall_breakpoint.set) { + if (syscall_break->set) { /** disable virtual hosting */ /* remove breakpoint at syscall entry */ - target_remove_breakpoint(nds32->target, &syscall_breakpoint); - syscall_breakpoint.set = 0; + target_remove_breakpoint(nds32->target, syscall_break); + syscall_break->set = 0; uint32_t value_pc; nds32_get_mapped_reg(nds32, PC, &value_pc); - if (value_pc == syscall_breakpoint.address) + if (value_pc == syscall_break->address) /** process syscall for virtual hosting */ nds32->hit_syscall = true; } @@ -218,10 +205,12 @@ static int nds32_v3_leave_debug_state(struct nds32 *nds32, bool enable_watchpoin } /* insert breakpoint at syscall entry */ - syscall_breakpoint.address = syscall_address; - syscall_breakpoint.type = BKPT_SOFT; - syscall_breakpoint.set = 1; - target_add_breakpoint(target, &syscall_breakpoint); + struct breakpoint *syscall_break = &(nds32->syscall_break); + + syscall_break->address = syscall_address; + syscall_break->type = BKPT_SOFT; + syscall_break->set = 1; + target_add_breakpoint(target, syscall_break); } return ERROR_OK; @@ -290,8 +279,8 @@ static int nds32_v3_get_exception_address(struct nds32 *nds32, nds32_read_opcode(nds32, val_pc, &opcode); nds32_evaluate_opcode(nds32, opcode, val_pc, &instruction); - LOG_DEBUG("PC: 0x%08x, access start: 0x%08x, end: 0x%08x", val_pc, - instruction.access_start, instruction.access_end); + LOG_DEBUG("PC: 0x%08" PRIx32 ", access start: 0x%08" PRIx32 ", end: 0x%08" PRIx32, + val_pc, instruction.access_start, instruction.access_end); /* check if multiple hits in the access range */ uint32_t in_range_watch_count = 0; @@ -378,14 +367,8 @@ int nds32_v3_target_request_data(struct target *target, return ERROR_OK; } -int nds32_v3_soft_reset_halt(struct target *target) -{ - struct aice_port_s *aice = target_to_aice(target); - return aice_assert_srst(aice, AICE_RESET_HOLD); -} - int nds32_v3_checksum_memory(struct target *target, - uint32_t address, uint32_t count, uint32_t *checksum) + target_addr_t address, uint32_t count, uint32_t *checksum) { LOG_WARNING("Not implemented: %s", __func__); @@ -451,8 +434,8 @@ int nds32_v3_run_algorithm(struct target *target, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, - uint32_t entry_point, - uint32_t exit_point, + target_addr_t entry_point, + target_addr_t exit_point, int timeout_ms, void *arch_info) { @@ -461,7 +444,7 @@ int nds32_v3_run_algorithm(struct target *target, return ERROR_FAIL; } -int nds32_v3_read_buffer(struct target *target, uint32_t address, +int nds32_v3_read_buffer(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer) { struct nds32 *nds32 = target_to_nds32(target); @@ -473,7 +456,7 @@ int nds32_v3_read_buffer(struct target *target, uint32_t address, return ERROR_TARGET_NOT_HALTED; } - uint32_t physical_address; + target_addr_t physical_address; /* BUG: If access range crosses multiple pages, the translation will not correct * for second page or so. */ @@ -519,7 +502,7 @@ int nds32_v3_read_buffer(struct target *target, uint32_t address, return result; } -int nds32_v3_write_buffer(struct target *target, uint32_t address, +int nds32_v3_write_buffer(struct target *target, target_addr_t address, uint32_t size, const uint8_t *buffer) { struct nds32 *nds32 = target_to_nds32(target); @@ -531,7 +514,7 @@ int nds32_v3_write_buffer(struct target *target, uint32_t address, return ERROR_TARGET_NOT_HALTED; } - uint32_t physical_address; + target_addr_t physical_address; /* BUG: If access range crosses multiple pages, the translation will not correct * for second page or so. */ @@ -581,7 +564,7 @@ int nds32_v3_write_buffer(struct target *target, uint32_t address, return nds32_write_buffer(target, address, size, buffer); } -int nds32_v3_read_memory(struct target *target, uint32_t address, +int nds32_v3_read_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer) { struct nds32 *nds32 = target_to_nds32(target); @@ -593,7 +576,7 @@ int nds32_v3_read_memory(struct target *target, uint32_t address, return ERROR_TARGET_NOT_HALTED; } - uint32_t physical_address; + target_addr_t physical_address; /* BUG: If access range crosses multiple pages, the translation will not correct * for second page or so. */ @@ -639,7 +622,7 @@ int nds32_v3_read_memory(struct target *target, uint32_t address, return result; } -int nds32_v3_write_memory(struct target *target, uint32_t address, +int nds32_v3_write_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer) { struct nds32 *nds32 = target_to_nds32(target); @@ -651,7 +634,7 @@ int nds32_v3_write_memory(struct target *target, uint32_t address, return ERROR_TARGET_NOT_HALTED; } - uint32_t physical_address; + target_addr_t physical_address; /* BUG: If access range crosses multiple pages, the translation will not correct * for second page or so. */