Make mem2array work with 64-bit addresses. (#475)

Change-Id: I805389dc9934db5affe3c8059d9630acede956c1
riscv
Tim Newsome 2020-05-14 10:19:24 -07:00 committed by GitHub
parent 0c3e50a06a
commit fcdb5d64ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -4206,7 +4206,7 @@ static int target_mem2array(Jim_Interp *interp, struct target *target, int argc,
long l; long l;
uint32_t width; uint32_t width;
int len; int len;
uint32_t addr; target_addr_t addr;
uint32_t count; uint32_t count;
uint32_t v; uint32_t v;
const char *varname; const char *varname;
@ -4233,8 +4233,9 @@ static int target_mem2array(Jim_Interp *interp, struct target *target, int argc,
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
e = Jim_GetLong(interp, argv[2], &l); jim_wide w;
addr = l; e = Jim_GetWide(interp, argv[2], &w);
addr = w;
if (e != JIM_OK) if (e != JIM_OK)
return e; return e;
e = Jim_GetLong(interp, argv[3], &l); e = Jim_GetLong(interp, argv[3], &l);
@ -4288,7 +4289,7 @@ static int target_mem2array(Jim_Interp *interp, struct target *target, int argc,
} else { } else {
char buf[100]; char buf[100];
Jim_SetResult(interp, Jim_NewEmptyStringObj(interp)); Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
sprintf(buf, "mem2array address: 0x%08" PRIx32 " is not aligned for %" PRId32 " byte reads", sprintf(buf, "mem2array address: " TARGET_ADDR_FMT " is not aligned for %" PRId32 " byte reads",
addr, addr,
width); width);
Jim_AppendStrings(interp, Jim_GetResult(interp), buf, NULL); Jim_AppendStrings(interp, Jim_GetResult(interp), buf, NULL);
@ -4320,7 +4321,7 @@ static int target_mem2array(Jim_Interp *interp, struct target *target, int argc,
retval = target_read_memory(target, addr, width, count, buffer); retval = target_read_memory(target, addr, width, count, buffer);
if (retval != ERROR_OK) { if (retval != ERROR_OK) {
/* BOO !*/ /* BOO !*/
LOG_ERROR("mem2array: Read @ 0x%08" PRIx32 ", w=%" PRId32 ", cnt=%" PRId32 ", failed", LOG_ERROR("mem2array: Read @ " TARGET_ADDR_FMT ", w=%" PRId32 ", cnt=%" PRId32 ", failed",
addr, addr,
width, width,
count); count);