target: Add 64-bit target address support

Define a target_addr_t type to support 32-bit and 64-bit addresses at
the same time. Also define matching TARGET_PRI*ADDR format macros as
well as a convenient TARGET_ADDR_FMT.

In targets that are 32-bit (avr32, nds32, arm7/9/11, fm4, xmc1000)
be least invasive by leaving the formatting unchanged apart from the
type;
for generic code adopt TARGET_ADDR_FMT as unified address format.

Don't silently change gdb formatting here, leave that to later.

Add COMMAND_PARSE_ADDRESS() macro to abstract the address type.
Implement it using its own parse_target_addr() function, in the hopes
of catching pointer type mismatches better.

Add '--disable-target64' configure option to revert to previous 32-bit
target address behavior.

Change-Id: I2e91d205862ceb14f94b3e72a7e99ee0373a85d5
Signed-off-by: Dongxue Zhang <elta.era@gmail.com>
Signed-off-by: David Ung <david.ung.42@gmail.com>
[AF: Default to enabling (Paul Fertser), rename macros, simplify]
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
This commit is contained in:
Dongxue Zhang
2013-09-23 16:27:03 +08:00
committed by Matthias Welwarsky
parent 0ecee83266
commit 47b8cf8420
68 changed files with 728 additions and 546 deletions

View File

@@ -339,6 +339,10 @@ AC_ARG_ENABLE([internal-libjaylink],
[Disable building internal libjaylink]), [Disable building internal libjaylink]),
[use_internal_libjaylink=$enableval], [use_internal_libjaylink=yes]) [use_internal_libjaylink=$enableval], [use_internal_libjaylink=yes])
AC_ARG_ENABLE([target64],
AS_HELP_STRING([--disable-target64], [Disable 64-bit target address]),
[build_target64=$enableval], [build_target64=yes])
build_minidriver=no build_minidriver=no
AC_MSG_CHECKING([whether to enable ZY1000 minidriver]) AC_MSG_CHECKING([whether to enable ZY1000 minidriver])
AS_IF([test "x$build_zy1000" = "xyes"], [ AS_IF([test "x$build_zy1000" = "xyes"], [
@@ -572,6 +576,13 @@ AS_IF([test "x$build_sysfsgpio" = "xyes"], [
AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don't want SysfsGPIO driver.]) AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don't want SysfsGPIO driver.])
]) ])
AS_IF([test "x$build_target64" = "xyes"], [
AC_DEFINE([BUILD_TARGET64], [1], [1 if you want 64-bit addresses.])
], [
AC_DEFINE([BUILD_TARGET64], [0], [0 if you don't want 64-bit addresses.])
])
PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [ PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [
use_libusb1=yes use_libusb1=yes
AC_DEFINE([HAVE_LIBUSB1], [1], [Define if you have libusb-1.x]) AC_DEFINE([HAVE_LIBUSB1], [1], [Define if you have libusb-1.x])
@@ -689,6 +700,7 @@ AM_CONDITIONAL([BITQ], [test "x$build_bitq" = "xyes"])
AM_CONDITIONAL([USE_LIBFTDI], [test "x$use_libftdi" = "xyes"]) AM_CONDITIONAL([USE_LIBFTDI], [test "x$use_libftdi" = "xyes"])
AM_CONDITIONAL([USE_HIDAPI], [test "x$use_hidapi" = "xyes"]) AM_CONDITIONAL([USE_HIDAPI], [test "x$use_hidapi" = "xyes"])
AM_CONDITIONAL([USE_LIBJAYLINK], [test "x$use_libjaylink" = "xyes"]) AM_CONDITIONAL([USE_LIBJAYLINK], [test "x$use_libjaylink" = "xyes"])
AM_CONDITIONAL([TARGET64], [test "x$build_target64" = "xyes"])
AM_CONDITIONAL([MINIDRIVER], [test "x$build_minidriver" = "xyes"]) AM_CONDITIONAL([MINIDRIVER], [test "x$build_minidriver" = "xyes"])
AM_CONDITIONAL([MINIDRIVER_DUMMY], [test "x$build_minidriver_dummy" = "xyes"]) AM_CONDITIONAL([MINIDRIVER_DUMMY], [test "x$build_minidriver_dummy" = "xyes"])

View File

@@ -1312,7 +1312,7 @@ static int cfi_intel_write_block(struct flash_bank *bank, const uint8_t *buffer,
busy_pattern_val = cfi_command_val(bank, 0x80); busy_pattern_val = cfi_command_val(bank, 0x80);
error_pattern_val = cfi_command_val(bank, 0x7e); error_pattern_val = cfi_command_val(bank, 0x7e);
LOG_DEBUG("Using target buffer at 0x%08" PRIx32 " and of size 0x%04" PRIx32, LOG_DEBUG("Using target buffer at " TARGET_ADDR_FMT " and of size 0x%04" PRIx32,
source->address, buffer_size); source->address, buffer_size);
/* Programming main loop */ /* Programming main loop */

View File

@@ -272,7 +272,7 @@ static int fm4_flash_write(struct flash_bank *bank, const uint8_t *buffer,
uint32_t halfwords = MIN(halfword_count, data_workarea->size / 2); uint32_t halfwords = MIN(halfword_count, data_workarea->size / 2);
uint32_t addr = bank->base + offset; uint32_t addr = bank->base + offset;
LOG_DEBUG("copying %" PRId32 " bytes to SRAM 0x%08" PRIx32, LOG_DEBUG("copying %" PRId32 " bytes to SRAM 0x%08" TARGET_PRIxADDR,
MIN(halfwords * 2, byte_count), data_workarea->address); MIN(halfwords * 2, byte_count), data_workarea->address);
retval = target_write_buffer(target, data_workarea->address, retval = target_write_buffer(target, data_workarea->address,

View File

@@ -688,7 +688,7 @@ static int lpc2000_iap_working_area_init(struct flash_bank *bank, struct working
int retval = target_write_memory(target, (*iap_working_area)->address, 4, 2, jump_gate); int retval = target_write_memory(target, (*iap_working_area)->address, 4, 2, jump_gate);
if (retval != ERROR_OK) { if (retval != ERROR_OK) {
LOG_ERROR("Write memory at address 0x%8.8" PRIx32 " failed (check work_area definition)", LOG_ERROR("Write memory at address 0x%8.8" TARGET_PRIxADDR " failed (check work_area definition)",
(*iap_working_area)->address); (*iap_working_area)->address);
target_free_working_area(target, *iap_working_area); target_free_working_area(target, *iap_working_area);
} }

View File

@@ -186,7 +186,7 @@ static int lpcspifi_set_hw_mode(struct flash_bank *bank)
return retval; return retval;
} }
LOG_DEBUG("Writing algorithm to working area at 0x%08" PRIx32, LOG_DEBUG("Writing algorithm to working area at 0x%08" TARGET_PRIxADDR,
spifi_init_algorithm->address); spifi_init_algorithm->address);
/* Write algorithm to working area */ /* Write algorithm to working area */
retval = target_write_buffer(target, retval = target_write_buffer(target,

View File

@@ -305,7 +305,7 @@ static int xmc1xxx_write(struct flash_bank *bank, const uint8_t *buffer,
uint32_t blocks = MIN(block_count, data_workarea->size / NVM_BLOCK_SIZE); uint32_t blocks = MIN(block_count, data_workarea->size / NVM_BLOCK_SIZE);
uint32_t addr = bank->base + offset; uint32_t addr = bank->base + offset;
LOG_DEBUG("copying %" PRId32 " bytes to SRAM 0x%08" PRIx32, LOG_DEBUG("copying %" PRId32 " bytes to SRAM 0x%08" TARGET_PRIxADDR,
MIN(blocks * NVM_BLOCK_SIZE, byte_count), MIN(blocks * NVM_BLOCK_SIZE, byte_count),
data_workarea->address); data_workarea->address);

View File

@@ -1410,6 +1410,8 @@ DEFINE_PARSE_ULONGLONG(_u32, uint32_t, 0, UINT32_MAX)
DEFINE_PARSE_ULONGLONG(_u16, uint16_t, 0, UINT16_MAX) DEFINE_PARSE_ULONGLONG(_u16, uint16_t, 0, UINT16_MAX)
DEFINE_PARSE_ULONGLONG(_u8, uint8_t, 0, UINT8_MAX) DEFINE_PARSE_ULONGLONG(_u8, uint8_t, 0, UINT8_MAX)
DEFINE_PARSE_ULONGLONG(_target_addr, target_addr_t, 0, TARGET_ADDR_MAX)
#define DEFINE_PARSE_LONGLONG(name, type, min, max) \ #define DEFINE_PARSE_LONGLONG(name, type, min, max) \
DEFINE_PARSE_WRAPPER(name, type, min, max, long long, _llong) DEFINE_PARSE_WRAPPER(name, type, min, max, long long, _llong)
DEFINE_PARSE_LONGLONG(_int, int, n < INT_MIN, INT_MAX) DEFINE_PARSE_LONGLONG(_int, int, n < INT_MIN, INT_MAX)

View File

@@ -357,10 +357,13 @@ DECLARE_PARSE_WRAPPER(_u16, uint16_t);
DECLARE_PARSE_WRAPPER(_u8, uint8_t); DECLARE_PARSE_WRAPPER(_u8, uint8_t);
DECLARE_PARSE_WRAPPER(_int, int); DECLARE_PARSE_WRAPPER(_int, int);
DECLARE_PARSE_WRAPPER(_s64, int64_t);
DECLARE_PARSE_WRAPPER(_s32, int32_t); DECLARE_PARSE_WRAPPER(_s32, int32_t);
DECLARE_PARSE_WRAPPER(_s16, int16_t); DECLARE_PARSE_WRAPPER(_s16, int16_t);
DECLARE_PARSE_WRAPPER(_s8, int8_t); DECLARE_PARSE_WRAPPER(_s8, int8_t);
DECLARE_PARSE_WRAPPER(_target_addr, target_addr_t);
/** /**
* @brief parses the string @a in into @a out as a @a type, or prints * @brief parses the string @a in into @a out as a @a type, or prints
* a command error and passes the error code to the caller. If an error * a command error and passes the error code to the caller. If an error
@@ -382,6 +385,9 @@ DECLARE_PARSE_WRAPPER(_s8, int8_t);
} \ } \
} while (0) } while (0)
#define COMMAND_PARSE_ADDRESS(in, out) \
COMMAND_PARSE_NUMBER(target_addr, in, out)
/** /**
* Parse the string @c as a binary parameter, storing the boolean value * Parse the string @c as a binary parameter, storing the boolean value
* in @c out. The strings @c on and @c off are used to match different * in @c out. The strings @c on and @c off are used to match different

View File

@@ -296,14 +296,21 @@ static inline int parity_u32(uint32_t x)
*/ */
#if !defined(_STDINT_H) #if !defined(_STDINT_H)
#define PRIx32 "x"
#define PRId32 "d" #define PRId32 "d"
#define SCNx32 "x"
#define PRIi32 "i" #define PRIi32 "i"
#define PRIo32 "o"
#define PRIu32 "u" #define PRIu32 "u"
#define PRIx32 "x"
#define PRIX32 "X"
#define SCNx32 "x"
#define PRId8 PRId32 #define PRId8 PRId32
#define SCNx64 "llx" #define SCNx64 "llx"
#define PRId64 "lld"
#define PRIi64 "lli"
#define PRIo64 "llo"
#define PRIu64 "llu"
#define PRIx64 "llx" #define PRIx64 "llx"
#define PRIX64 "llX"
typedef CYG_ADDRWORD intptr_t; typedef CYG_ADDRWORD intptr_t;
typedef int64_t intmax_t; typedef int64_t intmax_t;
@@ -337,4 +344,23 @@ typedef uint64_t uintmax_t;
#endif #endif
#if BUILD_TARGET64
typedef uint64_t target_addr_t;
#define TARGET_ADDR_MAX UINT64_MAX
#define TARGET_PRIdADDR PRId64
#define TARGET_PRIuADDR PRIu64
#define TARGET_PRIoADDR PRIo64
#define TARGET_PRIxADDR PRIx64
#define TARGET_PRIXADDR PRIX64
#else
typedef uint32_t target_addr_t;
#define TARGET_ADDR_MAX UINT32_MAX
#define TARGET_PRIdADDR PRId32
#define TARGET_PRIuADDR PRIu32
#define TARGET_PRIoADDR PRIo32
#define TARGET_PRIxADDR PRIx32
#define TARGET_PRIXADDR PRIX32
#endif
#define TARGET_ADDR_FMT "0x%8.8" TARGET_PRIxADDR
#endif /* OPENOCD_HELPER_TYPES_H */ #endif /* OPENOCD_HELPER_TYPES_H */

View File

@@ -786,8 +786,8 @@ static int aice_pipe_memory_mode(uint32_t coreid, enum nds_memory_select mem_sel
return ERROR_FAIL; return ERROR_FAIL;
} }
static int aice_pipe_read_tlb(uint32_t coreid, uint32_t virtual_address, static int aice_pipe_read_tlb(uint32_t coreid, target_addr_t virtual_address,
uint32_t *physical_address) target_addr_t *physical_address)
{ {
char line[AICE_PIPE_MAXLINE]; char line[AICE_PIPE_MAXLINE];
char command[AICE_PIPE_MAXLINE]; char command[AICE_PIPE_MAXLINE];

View File

@@ -180,7 +180,7 @@ struct aice_port_api_s {
int (*memory_mode)(uint32_t coreid, enum nds_memory_select mem_select); int (*memory_mode)(uint32_t coreid, enum nds_memory_select mem_select);
/** */ /** */
int (*read_tlb)(uint32_t coreid, uint32_t virtual_address, uint32_t *physical_address); int (*read_tlb)(uint32_t coreid, target_addr_t virtual_address, target_addr_t *physical_address);
/** */ /** */
int (*cache_ctl)(uint32_t coreid, uint32_t subtype, uint32_t address); int (*cache_ctl)(uint32_t coreid, uint32_t subtype, uint32_t address);

View File

@@ -3424,10 +3424,10 @@ static int aice_usb_memory_mode(uint32_t coreid, enum nds_memory_select mem_sele
return ERROR_OK; return ERROR_OK;
} }
static int aice_usb_read_tlb(uint32_t coreid, uint32_t virtual_address, static int aice_usb_read_tlb(uint32_t coreid, target_addr_t virtual_address,
uint32_t *physical_address) target_addr_t *physical_address)
{ {
LOG_DEBUG("aice_usb_read_tlb, virtual address: 0x%08" PRIx32, virtual_address); LOG_DEBUG("aice_usb_read_tlb, virtual address: 0x%08" TARGET_PRIxADDR, virtual_address);
uint32_t instructions[4]; uint32_t instructions[4];
uint32_t probe_result; uint32_t probe_result;

View File

@@ -105,11 +105,11 @@ static int linux_os_dummy_update(struct rtos *rtos)
return 0; return 0;
} }
static int linux_compute_virt2phys(struct target *target, uint32_t address) static int linux_compute_virt2phys(struct target *target, target_addr_t address)
{ {
struct linux_os *linux_os = (struct linux_os *) struct linux_os *linux_os = (struct linux_os *)
target->rtos->rtos_specific_params; target->rtos->rtos_specific_params;
uint32_t pa = 0; target_addr_t pa = 0;
int retval = target->type->virt2phys(target, address, &pa); int retval = target->type->virt2phys(target, address, &pa);
if (retval != ERROR_OK) { if (retval != ERROR_OK) {
LOG_ERROR("Cannot compute linux virt2phys translation"); LOG_ERROR("Cannot compute linux virt2phys translation");

View File

@@ -735,22 +735,22 @@ static void gdb_signal_reply(struct target *target, struct connection *connectio
stop_reason[0] = '\0'; stop_reason[0] = '\0';
if (target->debug_reason == DBG_REASON_WATCHPOINT) { if (target->debug_reason == DBG_REASON_WATCHPOINT) {
enum watchpoint_rw hit_wp_type; enum watchpoint_rw hit_wp_type;
uint32_t hit_wp_address; target_addr_t hit_wp_address;
if (watchpoint_hit(target, &hit_wp_type, &hit_wp_address) == ERROR_OK) { if (watchpoint_hit(target, &hit_wp_type, &hit_wp_address) == ERROR_OK) {
switch (hit_wp_type) { switch (hit_wp_type) {
case WPT_WRITE: case WPT_WRITE:
snprintf(stop_reason, sizeof(stop_reason), snprintf(stop_reason, sizeof(stop_reason),
"watch:%08" PRIx32 ";", hit_wp_address); "watch:%08" TARGET_PRIxADDR ";", hit_wp_address);
break; break;
case WPT_READ: case WPT_READ:
snprintf(stop_reason, sizeof(stop_reason), snprintf(stop_reason, sizeof(stop_reason),
"rwatch:%08" PRIx32 ";", hit_wp_address); "rwatch:%08" TARGET_PRIxADDR ";", hit_wp_address);
break; break;
case WPT_ACCESS: case WPT_ACCESS:
snprintf(stop_reason, sizeof(stop_reason), snprintf(stop_reason, sizeof(stop_reason),
"awatch:%08" PRIx32 ";", hit_wp_address); "awatch:%08" TARGET_PRIxADDR ";", hit_wp_address);
break; break;
default: default:
break; break;

View File

@@ -26,7 +26,7 @@ enum param_direction {
}; };
struct mem_param { struct mem_param {
uint32_t address; target_addr_t address;
uint32_t size; uint32_t size;
uint8_t *value; uint8_t *value;
enum param_direction direction; enum param_direction direction;

View File

@@ -231,7 +231,7 @@ int arm_init_arch_info(struct target *target, struct arm *arm);
int armv4_5_run_algorithm(struct target *target, int armv4_5_run_algorithm(struct target *target,
int num_mem_params, struct mem_param *mem_params, int num_mem_params, struct mem_param *mem_params,
int num_reg_params, struct reg_param *reg_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); int timeout_ms, void *arch_info);
int armv4_5_run_algorithm_inner(struct target *target, int armv4_5_run_algorithm_inner(struct target *target,
int num_mem_params, struct mem_param *mem_params, int num_mem_params, struct mem_param *mem_params,
@@ -242,9 +242,9 @@ int armv4_5_run_algorithm_inner(struct target *target,
int timeout_ms, void *arch_info)); int timeout_ms, void *arch_info));
int arm_checksum_memory(struct target *target, int arm_checksum_memory(struct target *target,
uint32_t address, uint32_t count, uint32_t *checksum); target_addr_t address, uint32_t count, uint32_t *checksum);
int arm_blank_check_memory(struct target *target, int arm_blank_check_memory(struct target *target,
uint32_t address, uint32_t count, uint32_t *blank, uint8_t erased_value); target_addr_t address, uint32_t count, uint32_t *blank, uint8_t erased_value);
void arm_set_cpsr(struct arm *arm, uint32_t cpsr); void arm_set_cpsr(struct arm *arm, uint32_t cpsr);
struct reg *arm_reg_current(struct arm *arm, unsigned regnum); struct reg *arm_reg_current(struct arm *arm, unsigned regnum);

View File

@@ -42,7 +42,7 @@
static int arm11_step(struct target *target, int current, static int arm11_step(struct target *target, int current,
uint32_t address, int handle_breakpoints); target_addr_t address, int handle_breakpoints);
/** Check and if necessary take control of the system /** Check and if necessary take control of the system
@@ -449,7 +449,7 @@ static uint32_t arm11_nextpc(struct arm11_common *arm11, int current, uint32_t a
} }
static int arm11_resume(struct target *target, int current, static int arm11_resume(struct target *target, int current,
uint32_t address, int handle_breakpoints, int debug_execution) target_addr_t address, int handle_breakpoints, int debug_execution)
{ {
/* LOG_DEBUG("current %d address %08x handle_breakpoints %d debug_execution %d", */ /* LOG_DEBUG("current %d address %08x handle_breakpoints %d debug_execution %d", */
/* current, address, handle_breakpoints, debug_execution); */ /* current, address, handle_breakpoints, debug_execution); */
@@ -467,7 +467,7 @@ static int arm11_resume(struct target *target, int current,
address = arm11_nextpc(arm11, current, address); address = arm11_nextpc(arm11, current, address);
LOG_DEBUG("RESUME PC %08" PRIx32 "%s", address, !current ? "!" : ""); LOG_DEBUG("RESUME PC %08" TARGET_PRIxADDR "%s", address, !current ? "!" : "");
/* clear breakpoints/watchpoints and VCR*/ /* clear breakpoints/watchpoints and VCR*/
CHECK_RETVAL(arm11_sc7_clear_vbw(arm11)); CHECK_RETVAL(arm11_sc7_clear_vbw(arm11));
@@ -481,7 +481,7 @@ static int arm11_resume(struct target *target, int current,
for (bp = target->breakpoints; bp; bp = bp->next) { for (bp = target->breakpoints; bp; bp = bp->next) {
if (bp->address == address) { if (bp->address == address) {
LOG_DEBUG("must step over %08" PRIx32 "", bp->address); LOG_DEBUG("must step over %08" TARGET_PRIxADDR "", bp->address);
arm11_step(target, 1, 0, 0); arm11_step(target, 1, 0, 0);
break; break;
} }
@@ -507,7 +507,7 @@ static int arm11_resume(struct target *target, int current,
CHECK_RETVAL(arm11_sc7_run(arm11, brp, ARRAY_SIZE(brp))); CHECK_RETVAL(arm11_sc7_run(arm11, brp, ARRAY_SIZE(brp)));
LOG_DEBUG("Add BP %d at %08" PRIx32, brp_num, LOG_DEBUG("Add BP %d at %08" TARGET_PRIxADDR, brp_num,
bp->address); bp->address);
brp_num++; brp_num++;
@@ -557,7 +557,7 @@ static int arm11_resume(struct target *target, int current,
} }
static int arm11_step(struct target *target, int current, static int arm11_step(struct target *target, int current,
uint32_t address, int handle_breakpoints) target_addr_t address, int handle_breakpoints)
{ {
LOG_DEBUG("target->state: %s", LOG_DEBUG("target->state: %s",
target_state_name(target)); target_state_name(target));
@@ -571,7 +571,7 @@ static int arm11_step(struct target *target, int current,
address = arm11_nextpc(arm11, current, address); address = arm11_nextpc(arm11, current, address);
LOG_DEBUG("STEP PC %08" PRIx32 "%s", address, !current ? "!" : ""); LOG_DEBUG("STEP PC %08" TARGET_PRIxADDR "%s", address, !current ? "!" : "");
/** \todo TODO: Thumb not supported here */ /** \todo TODO: Thumb not supported here */
@@ -583,13 +583,13 @@ static int arm11_step(struct target *target, int current,
/* skip over BKPT */ /* skip over BKPT */
if ((next_instruction & 0xFFF00070) == 0xe1200070) { if ((next_instruction & 0xFFF00070) == 0xe1200070) {
address = arm11_nextpc(arm11, 0, address + 4); address = arm11_nextpc(arm11, 0, address + 4);
LOG_DEBUG("Skipping BKPT %08" PRIx32, address); LOG_DEBUG("Skipping BKPT %08" TARGET_PRIxADDR, address);
} }
/* skip over Wait for interrupt / Standby /* skip over Wait for interrupt / Standby
* mcr 15, 0, r?, cr7, cr0, {4} */ * mcr 15, 0, r?, cr7, cr0, {4} */
else if ((next_instruction & 0xFFFF0FFF) == 0xee070f90) { else if ((next_instruction & 0xFFFF0FFF) == 0xee070f90) {
address = arm11_nextpc(arm11, 0, address + 4); address = arm11_nextpc(arm11, 0, address + 4);
LOG_DEBUG("Skipping WFI %08" PRIx32, address); LOG_DEBUG("Skipping WFI %08" TARGET_PRIxADDR, address);
} }
/* ignore B to self */ /* ignore B to self */
else if ((next_instruction & 0xFEFFFFFF) == 0xeafffffe) else if ((next_instruction & 0xFEFFFFFF) == 0xeafffffe)
@@ -887,7 +887,7 @@ static int arm11_read_memory_inner(struct target *target,
} }
static int arm11_read_memory(struct target *target, static int arm11_read_memory(struct target *target,
uint32_t address, target_addr_t address,
uint32_t size, uint32_t size,
uint32_t count, uint32_t count,
uint8_t *buffer) uint8_t *buffer)
@@ -1043,7 +1043,7 @@ static int arm11_write_memory_inner(struct target *target,
} }
static int arm11_write_memory(struct target *target, static int arm11_write_memory(struct target *target,
uint32_t address, uint32_t size, target_addr_t address, uint32_t size,
uint32_t count, const uint8_t *buffer) uint32_t count, const uint8_t *buffer)
{ {
/* pointer increment matters only for multi-unit writes ... /* pointer increment matters only for multi-unit writes ...

View File

@@ -271,7 +271,7 @@ static int arm720_mmu(struct target *target, int *enabled)
} }
static int arm720_virt2phys(struct target *target, static int arm720_virt2phys(struct target *target,
uint32_t virtual, uint32_t *physical) target_addr_t virtual, target_addr_t *physical)
{ {
uint32_t cb; uint32_t cb;
struct arm720t_common *arm720t = target_to_arm720(target); struct arm720t_common *arm720t = target_to_arm720(target);
@@ -286,7 +286,7 @@ static int arm720_virt2phys(struct target *target,
} }
static int arm720t_read_memory(struct target *target, static int arm720t_read_memory(struct target *target,
uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer) target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
{ {
int retval; int retval;
struct arm720t_common *arm720t = target_to_arm720(target); struct arm720t_common *arm720t = target_to_arm720(target);
@@ -309,7 +309,7 @@ static int arm720t_read_memory(struct target *target,
} }
static int arm720t_read_phys_memory(struct target *target, static int arm720t_read_phys_memory(struct target *target,
uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer) target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
{ {
struct arm720t_common *arm720t = target_to_arm720(target); struct arm720t_common *arm720t = target_to_arm720(target);
@@ -317,7 +317,7 @@ static int arm720t_read_phys_memory(struct target *target,
} }
static int arm720t_write_phys_memory(struct target *target, static int arm720t_write_phys_memory(struct target *target,
uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer) target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
{ {
struct arm720t_common *arm720t = target_to_arm720(target); struct arm720t_common *arm720t = target_to_arm720(target);

View File

@@ -101,7 +101,8 @@ static void arm7_9_assign_wp(struct arm7_9_common *arm7_9, struct breakpoint *br
arm7_9->wp_available--; arm7_9->wp_available--;
} else } else
LOG_ERROR("BUG: no hardware comparator available"); LOG_ERROR("BUG: no hardware comparator available");
LOG_DEBUG("BPID: %" PRId32 " (0x%08" PRIx32 ") using hw wp: %d",
LOG_DEBUG("BPID: %" PRId32 " (0x%08" TARGET_PRIxADDR ") using hw wp: %d",
breakpoint->unique_id, breakpoint->unique_id,
breakpoint->address, breakpoint->address,
breakpoint->set); breakpoint->set);
@@ -187,7 +188,7 @@ static int arm7_9_set_breakpoint(struct target *target, struct breakpoint *break
struct arm7_9_common *arm7_9 = target_to_arm7_9(target); struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
int retval = ERROR_OK; int retval = ERROR_OK;
LOG_DEBUG("BPID: %" PRId32 ", Address: 0x%08" PRIx32 ", Type: %d", LOG_DEBUG("BPID: %" PRId32 ", Address: 0x%08" TARGET_PRIxADDR ", Type: %d",
breakpoint->unique_id, breakpoint->unique_id,
breakpoint->address, breakpoint->address,
breakpoint->type); breakpoint->type);
@@ -244,7 +245,7 @@ static int arm7_9_set_breakpoint(struct target *target, struct breakpoint *break
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
if (verify != arm7_9->arm_bkpt) { if (verify != arm7_9->arm_bkpt) {
LOG_ERROR("Unable to set 32 bit software breakpoint at address %08" PRIx32 LOG_ERROR("Unable to set 32 bit software breakpoint at address %08" TARGET_PRIxADDR
" - check that memory is read/writable", breakpoint->address); " - check that memory is read/writable", breakpoint->address);
return ERROR_OK; return ERROR_OK;
} }
@@ -264,7 +265,7 @@ static int arm7_9_set_breakpoint(struct target *target, struct breakpoint *break
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
if (verify != arm7_9->thumb_bkpt) { if (verify != arm7_9->thumb_bkpt) {
LOG_ERROR("Unable to set thumb software breakpoint at address %08" PRIx32 LOG_ERROR("Unable to set thumb software breakpoint at address %08" TARGET_PRIxADDR
" - check that memory is read/writable", breakpoint->address); " - check that memory is read/writable", breakpoint->address);
return ERROR_OK; return ERROR_OK;
} }
@@ -299,7 +300,7 @@ static int arm7_9_unset_breakpoint(struct target *target, struct breakpoint *bre
int retval = ERROR_OK; int retval = ERROR_OK;
struct arm7_9_common *arm7_9 = target_to_arm7_9(target); struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
LOG_DEBUG("BPID: %" PRId32 ", Address: 0x%08" PRIx32, LOG_DEBUG("BPID: %" PRId32 ", Address: 0x%08" TARGET_PRIxADDR,
breakpoint->unique_id, breakpoint->unique_id,
breakpoint->address); breakpoint->address);
@@ -1692,7 +1693,7 @@ static void arm7_9_enable_breakpoints(struct target *target)
int arm7_9_resume(struct target *target, int arm7_9_resume(struct target *target,
int current, int current,
uint32_t address, target_addr_t address,
int handle_breakpoints, int handle_breakpoints,
int debug_execution) int debug_execution)
{ {
@@ -1724,7 +1725,7 @@ int arm7_9_resume(struct target *target,
breakpoint = breakpoint_find(target, breakpoint = breakpoint_find(target,
buf_get_u32(arm->pc->value, 0, 32)); buf_get_u32(arm->pc->value, 0, 32));
if (breakpoint != NULL) { if (breakpoint != NULL) {
LOG_DEBUG("unset breakpoint at 0x%8.8" PRIx32 " (id: %" PRId32, LOG_DEBUG("unset breakpoint at 0x%8.8" TARGET_PRIxADDR " (id: %" PRId32,
breakpoint->address, breakpoint->address,
breakpoint->unique_id); breakpoint->unique_id);
retval = arm7_9_unset_breakpoint(target, breakpoint); retval = arm7_9_unset_breakpoint(target, breakpoint);
@@ -1783,7 +1784,7 @@ int arm7_9_resume(struct target *target,
LOG_DEBUG("new PC after step: 0x%8.8" PRIx32, LOG_DEBUG("new PC after step: 0x%8.8" PRIx32,
buf_get_u32(arm->pc->value, 0, 32)); buf_get_u32(arm->pc->value, 0, 32));
LOG_DEBUG("set breakpoint at 0x%8.8" PRIx32 "", breakpoint->address); LOG_DEBUG("set breakpoint at 0x%8.8" TARGET_PRIxADDR "", breakpoint->address);
retval = arm7_9_set_breakpoint(target, breakpoint); retval = arm7_9_set_breakpoint(target, breakpoint);
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
@@ -1894,7 +1895,7 @@ void arm7_9_disable_eice_step(struct target *target)
embeddedice_store_reg(&arm7_9->eice_cache->reg_list[EICE_W1_CONTROL_VALUE]); embeddedice_store_reg(&arm7_9->eice_cache->reg_list[EICE_W1_CONTROL_VALUE]);
} }
int arm7_9_step(struct target *target, int current, uint32_t address, int handle_breakpoints) int arm7_9_step(struct target *target, int current, target_addr_t address, int handle_breakpoints)
{ {
struct arm7_9_common *arm7_9 = target_to_arm7_9(target); struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
struct arm *arm = &arm7_9->arm; struct arm *arm = &arm7_9->arm;
@@ -2094,7 +2095,7 @@ static int arm7_9_write_core_reg(struct target *target, struct reg *r,
} }
int arm7_9_read_memory(struct target *target, int arm7_9_read_memory(struct target *target,
uint32_t address, target_addr_t address,
uint32_t size, uint32_t size,
uint32_t count, uint32_t count,
uint8_t *buffer) uint8_t *buffer)
@@ -2109,7 +2110,7 @@ int arm7_9_read_memory(struct target *target,
int retval; int retval;
int last_reg = 0; int last_reg = 0;
LOG_DEBUG("address: 0x%8.8" PRIx32 ", size: 0x%8.8" PRIx32 ", count: 0x%8.8" PRIx32 "", LOG_DEBUG("address: 0x%8.8" TARGET_PRIxADDR ", size: 0x%8.8" PRIx32 ", count: 0x%8.8" PRIx32 "",
address, size, count); address, size, count);
if (target->state != TARGET_HALTED) { if (target->state != TARGET_HALTED) {
@@ -2247,7 +2248,8 @@ int arm7_9_read_memory(struct target *target,
if (((cpsr & 0x1f) == ARM_MODE_ABT) && (arm->core_mode != ARM_MODE_ABT)) { if (((cpsr & 0x1f) == ARM_MODE_ABT) && (arm->core_mode != ARM_MODE_ABT)) {
LOG_WARNING( LOG_WARNING(
"memory read caused data abort (address: 0x%8.8" PRIx32 ", size: 0x%" PRIx32 ", count: 0x%" PRIx32 ")", "memory read caused data abort "
"(address: 0x%8.8" TARGET_PRIxADDR ", size: 0x%" PRIx32 ", count: 0x%" PRIx32 ")",
address, address,
size, size,
count); count);
@@ -2263,7 +2265,7 @@ int arm7_9_read_memory(struct target *target,
} }
int arm7_9_write_memory(struct target *target, int arm7_9_write_memory(struct target *target,
uint32_t address, target_addr_t address,
uint32_t size, uint32_t size,
uint32_t count, uint32_t count,
const uint8_t *buffer) const uint8_t *buffer)
@@ -2460,7 +2462,8 @@ int arm7_9_write_memory(struct target *target,
if (((cpsr & 0x1f) == ARM_MODE_ABT) && (arm->core_mode != ARM_MODE_ABT)) { if (((cpsr & 0x1f) == ARM_MODE_ABT) && (arm->core_mode != ARM_MODE_ABT)) {
LOG_WARNING( LOG_WARNING(
"memory write caused data abort (address: 0x%8.8" PRIx32 ", size: 0x%" PRIx32 ", count: 0x%" PRIx32 ")", "memory write caused data abort "
"(address: 0x%8.8" TARGET_PRIxADDR ", size: 0x%" PRIx32 ", count: 0x%" PRIx32 ")",
address, address,
size, size,
count); count);
@@ -2476,7 +2479,7 @@ int arm7_9_write_memory(struct target *target,
} }
int arm7_9_write_memory_opt(struct target *target, int arm7_9_write_memory_opt(struct target *target,
uint32_t address, target_addr_t address,
uint32_t size, uint32_t size,
uint32_t count, uint32_t count,
const uint8_t *buffer) const uint8_t *buffer)
@@ -2576,7 +2579,7 @@ static const uint32_t dcc_code[] = {
}; };
int arm7_9_bulk_write_memory(struct target *target, int arm7_9_bulk_write_memory(struct target *target,
uint32_t address, target_addr_t address,
uint32_t count, uint32_t count,
const uint8_t *buffer) const uint8_t *buffer)
{ {
@@ -2632,7 +2635,7 @@ int arm7_9_bulk_write_memory(struct target *target,
uint32_t endaddress = buf_get_u32(reg_params[0].value, 0, 32); uint32_t endaddress = buf_get_u32(reg_params[0].value, 0, 32);
if (endaddress != (address + count*4)) { if (endaddress != (address + count*4)) {
LOG_ERROR( LOG_ERROR(
"DCC write failed, expected end address 0x%08" PRIx32 " got 0x%0" PRIx32 "", "DCC write failed, expected end address 0x%08" TARGET_PRIxADDR " got 0x%0" PRIx32 "",
(address + count*4), (address + count*4),
endaddress); endaddress);
retval = ERROR_FAIL; retval = ERROR_FAIL;

View File

@@ -122,13 +122,13 @@ struct arm7_9_common {
* Used as a fallback when bulk writes are unavailable, or for writing data needed to * Used as a fallback when bulk writes are unavailable, or for writing data needed to
* do the bulk writes. * do the bulk writes.
*/ */
int (*write_memory)(struct target *target, uint32_t address, int (*write_memory)(struct target *target, target_addr_t address,
uint32_t size, uint32_t count, const uint8_t *buffer); uint32_t size, uint32_t count, const uint8_t *buffer);
/** /**
* Write target memory in multiples of 4 bytes, optimized for * Write target memory in multiples of 4 bytes, optimized for
* writing large quantities of data. * writing large quantities of data.
*/ */
int (*bulk_write_memory)(struct target *target, uint32_t address, int (*bulk_write_memory)(struct target *target, target_addr_t address,
uint32_t count, const uint8_t *buffer); uint32_t count, const uint8_t *buffer);
}; };
@@ -155,19 +155,19 @@ int arm7_9_early_halt(struct target *target);
int arm7_9_soft_reset_halt(struct target *target); int arm7_9_soft_reset_halt(struct target *target);
int arm7_9_halt(struct target *target); int arm7_9_halt(struct target *target);
int arm7_9_resume(struct target *target, int current, uint32_t address, int arm7_9_resume(struct target *target, int current, target_addr_t address,
int handle_breakpoints, int debug_execution); int handle_breakpoints, int debug_execution);
int arm7_9_step(struct target *target, int current, uint32_t address, int arm7_9_step(struct target *target, int current, target_addr_t address,
int handle_breakpoints); int handle_breakpoints);
int arm7_9_read_memory(struct target *target, uint32_t address, int arm7_9_read_memory(struct target *target, target_addr_t address,
uint32_t size, uint32_t count, uint8_t *buffer); uint32_t size, uint32_t count, uint8_t *buffer);
int arm7_9_write_memory(struct target *target, uint32_t address, int arm7_9_write_memory(struct target *target, target_addr_t address,
uint32_t size, uint32_t count, const uint8_t *buffer); uint32_t size, uint32_t count, const uint8_t *buffer);
int arm7_9_write_memory_opt(struct target *target, uint32_t address, int arm7_9_write_memory_opt(struct target *target, target_addr_t address,
uint32_t size, uint32_t count, const uint8_t *buffer); uint32_t size, uint32_t count, const uint8_t *buffer);
int arm7_9_write_memory_no_opt(struct target *target, uint32_t address, int arm7_9_write_memory_no_opt(struct target *target, uint32_t address,
uint32_t size, uint32_t count, const uint8_t *buffer); uint32_t size, uint32_t count, const uint8_t *buffer);
int arm7_9_bulk_write_memory(struct target *target, uint32_t address, int arm7_9_bulk_write_memory(struct target *target, target_addr_t address,
uint32_t count, const uint8_t *buffer); uint32_t count, const uint8_t *buffer);
int arm7_9_run_algorithm(struct target *target, int num_mem_params, int arm7_9_run_algorithm(struct target *target, int num_mem_params,

Some files were not shown because too many files have changed in this diff Show More