target: Remove pc_read/pc_write methods.

This commit is contained in:
Gareth McMullin 2015-03-28 20:15:33 -07:00
parent 4313b64bbe
commit 1e54139f4a
6 changed files with 9 additions and 17 deletions

View File

@ -62,7 +62,6 @@ const struct command_s cortexm_cmd_list[] = {
static int cortexm_regs_read(target *t, void *data);
static int cortexm_regs_write(target *t, const void *data);
static int cortexm_pc_write(target *t, const uint32_t val);
static uint32_t cortexm_pc_read(target *t);
static void cortexm_reset(target *t);
@ -218,8 +217,6 @@ bool cortexm_probe(target *t)
t->tdesc = tdesc_cortex_m;
t->regs_read = cortexm_regs_read;
t->regs_write = cortexm_regs_write;
t->pc_write = cortexm_pc_write;
t->pc_read = cortexm_pc_read;
t->reset = cortexm_reset;
t->halt_request = cortexm_halt_request;
@ -428,7 +425,7 @@ static uint32_t cortexm_pc_read(target *t)
return 0;
}
static int cortexm_pc_write(target *t, const uint32_t val)
int cortexm_pc_write(target *t, const uint32_t val)
{
target_mem_write32(t, CORTEXM_DCRDR, val);
target_mem_write32(t, CORTEXM_DCRSR, CORTEXM_DCRSR_REGWnR | 0x0F);

View File

@ -149,6 +149,7 @@ void cortexm_halt_resume(struct target_s *target, bool step);
int cortexm_run_stub(struct target_s *target, uint32_t loadaddr,
const uint16_t *stub, uint32_t stublen,
uint32_t r0, uint32_t r1, uint32_t r2, uint32_t r3);
int cortexm_pc_write(target *t, const uint32_t val);
#endif

View File

@ -61,12 +61,6 @@ target *target_attach(target *t, target_destroy_callback destroy_cb);
#define target_regs_write(target, data) \
(target)->regs_write((target), (data))
#define target_pc_read(target) \
(target)->pc_read((target))
#define target_pc_write(target, val) \
(target)->pc_write((target), (val))
/* Halt/resume functions */
#define target_reset(target) \
@ -135,9 +129,6 @@ struct target_s {
int (*regs_read)(target *t, void *data);
int (*regs_write)(target *t, const void *data);
uint32_t (*pc_read)(target *t);
int (*pc_write)(target *t, const uint32_t val);
/* Halt/resume functions */
void (*reset)(target *t);
void (*halt_request)(target *t);

View File

@ -30,6 +30,7 @@
#include "general.h"
#include "adiv5.h"
#include "target.h"
#include "cortexm.h"
static int lmi_flash_erase(struct target_s *target, uint32_t addr, size_t len);
static int lmi_flash_write(struct target_s *target, uint32_t dest,
@ -163,7 +164,7 @@ int lmi_flash_write(struct target_s *target, uint32_t dest,
DEBUG("Sending data\n");
target_mem_write(target, 0x20000030, data, len + 8);
DEBUG("Running stub\n");
target_pc_write(target, 0x20000000);
cortexm_pc_write(target, 0x20000000);
target_halt_resume(target, 0);
DEBUG("Waiting for halt\n");
while(!target_halt_wait(target));

View File

@ -26,6 +26,7 @@
#include "target.h"
#include "command.h"
#include "gdb_packet.h"
#include "cortexm.h"
static int nrf51_flash_erase(struct target_s *target, uint32_t addr, size_t len);
static int nrf51_flash_write(struct target_s *target, uint32_t dest,
@ -229,7 +230,7 @@ static int nrf51_flash_write(struct target_s *target, uint32_t dest,
/* Write stub and data to target ram and set PC */
target_mem_write(target, 0x20000000, nrf51_flash_write_stub, 0x28);
target_mem_write(target, 0x20000028, data, len + 8);
target_pc_write(target, 0x20000000);
cortexm_pc_write(target, 0x20000000);
if(target_check_error(target))
return -1;

View File

@ -117,6 +117,7 @@
#include "target.h"
#include "command.h"
#include "gdb_packet.h"
#include "cortexm.h"
#include "stm32lx-nvm.h"
@ -386,7 +387,7 @@ static int stm32lx_nvm_prog_erase_stubbed(struct target_s* target,
&info, sizeof(info));
/* Execute stub */
target_pc_write(target, STM32Lx_STUB_PHYS);
cortexm_pc_write(target, STM32Lx_STUB_PHYS);
if (target_check_error(target))
return -1;
target_halt_resume(target, 0);
@ -462,7 +463,7 @@ static int stm32lx_nvm_prog_write_stubbed(struct target_s* target,
&info, sizeof(info));
/* Execute stub */
target_pc_write(target, STM32Lx_STUB_PHYS);
cortexm_pc_write(target, STM32Lx_STUB_PHYS);
if (target_check_error(target))
return -1;
target_halt_resume(target, 0);