# HG changeset patch # User Mychaela Falconia # Date 1446670120 0 # Node ID 1557e15a012fc7bf124438a9cdb20615611063ab # Parent d7830aee0d35a12844f607d5374620469440bb5d target-utils refactoring: memory dump commands moved from libload to libcommon diff -r d7830aee0d35 -r 1557e15a012f target-utils/Makefile --- a/target-utils/Makefile Wed Nov 04 20:34:12 2015 +0000 +++ b/target-utils/Makefile Wed Nov 04 20:48:40 2015 +0000 @@ -9,7 +9,7 @@ c139explore: libcommon libprintf helloapp: libcommon libprintf loadagent: libcommon libload libprintf -pirexplore: libcommon libload libprintf libtiffs +pirexplore: libcommon libprintf libtiffs ${SUBDIR}: FRC cd $@; ${MAKE} ${MFLAGS} diff -r d7830aee0d35 -r 1557e15a012f target-utils/libcommon/Makefile --- a/target-utils/libcommon/Makefile Wed Nov 04 20:34:12 2015 +0000 +++ b/target-utils/libcommon/Makefile Wed Nov 04 20:48:40 2015 +0000 @@ -6,7 +6,8 @@ OBJS= cmdentry.o dispatch.o hexarg.o parseargs.o serio.o uartsel.o \ cmd_baud_switch.o cmd_dieid.o cmd_jump.o cmd_r8.o cmd_r16.o cmd_r32.o \ - cmd_w8.o cmd_w16.o cmd_w32.o abbcmd.o abbdrv.o osmodelay.o spidrv.o + cmd_w8.o cmd_w16.o cmd_w32.o cmd_memdump_human.o cmd_memdump_machine.o \ + abbcmd.o abbdrv.o osmodelay.o spidrv.o all: libcommon.a diff -r d7830aee0d35 -r 1557e15a012f target-utils/libcommon/cmd_memdump_human.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/target-utils/libcommon/cmd_memdump_human.c Wed Nov 04 20:48:40 2015 +0000 @@ -0,0 +1,50 @@ +/* + * This is a human-oriented memory dump command. The dump is given in + * both hex and ASCII, with readable spacing. + */ + +#include +#include "types.h" + +void +cmd_memdump_human(argbulk) + char *argbulk; +{ + char *argv[3]; + u_long start, length; + u_long offset; + u_char intbuf[16]; + int i, c; + + if (parse_args(argbulk, 2, 2, argv, 0) < 0) + return; + if (parse_hexarg(argv[0], 8, &start) < 0) { + printf("ERROR: arg1 must be a valid 32-bit hex address\n"); + return; + } + if (parse_hexarg(argv[1], 8, &length) < 0) { + printf("ERROR: arg2 must be a valid 32-bit hex value (length)\n"); + return; + } + if (start & 0xF || length & 0xF) { + printf("ERROR: implementation limit: 16-byte alignment required\n"); + return; + } + for (offset = 0; offset < length; offset += 0x10) { + bcopy(start + offset, intbuf, 0x10); + printf("%08X: ", start + offset); + for (i = 0; i < 16; i++) { + printf("%02X ", intbuf[i]); + if ((i & 3) == 3) + putchar(' '); + } + for (i = 0; i < 16; i++) { + c = intbuf[i]; + if (c >= ' ' && c <= '~') + putchar(c); + else + putchar('.'); + } + putchar('\n'); + } +} diff -r d7830aee0d35 -r 1557e15a012f target-utils/libcommon/cmd_memdump_machine.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/target-utils/libcommon/cmd_memdump_machine.c Wed Nov 04 20:48:40 2015 +0000 @@ -0,0 +1,50 @@ +/* + * This is a machine-oriented memory dump command. The output is in the + * form of S3 records. + */ + +#include +#include "types.h" + +void +cmd_memdump_machine(argbulk) + char *argbulk; +{ + char *argv[3]; + u_long start, length; + u_long addr; + u_char srbuf[0x86], cksum; + int i; + + if (parse_args(argbulk, 2, 2, argv, 0) < 0) + return; + if (parse_hexarg(argv[0], 8, &start) < 0) { + printf("ERROR: arg1 must be a valid 32-bit hex address\n"); + return; + } + if (parse_hexarg(argv[1], 8, &length) < 0) { + printf("ERROR: arg2 must be a valid 32-bit hex value (length)\n"); + return; + } + if (start & 0x7F || length & 0x7F) { + printf("ERROR: implementation limit: 128-byte alignment required\n"); + return; + } + srbuf[0] = 0x85; + for (addr = start; addr < start + length; addr += 0x80) { + srbuf[1] = addr >> 24; + srbuf[2] = addr >> 16; + srbuf[3] = addr >> 8; + srbuf[4] = addr; + bcopy(addr, srbuf + 5, 0x80); + cksum = 0; + for (i = 0; i < 0x85; i++) + cksum += srbuf[i]; + srbuf[i] = ~cksum; + putchar('S'); + putchar('3'); + for (i = 0; i < 0x86; i++) + printf("%02X", srbuf[i]); + putchar('\n'); + } +} diff -r d7830aee0d35 -r 1557e15a012f target-utils/libload/Makefile --- a/target-utils/libload/Makefile Wed Nov 04 20:34:12 2015 +0000 +++ b/target-utils/libload/Makefile Wed Nov 04 20:48:40 2015 +0000 @@ -4,8 +4,8 @@ AR= arm-elf-ar RANLIB= arm-elf-ranlib -OBJS= cmd_blankchk.o cmd_crc32.o cmd_memdump_human.o cmd_memdump_machine.o \ - cmd_memload.o amdflash.o hexstrings.o intelflash.o +OBJS= cmd_blankchk.o cmd_crc32.o cmd_memload.o \ + amdflash.o hexstrings.o intelflash.o all: libload.a diff -r d7830aee0d35 -r 1557e15a012f target-utils/libload/cmd_memdump_human.c --- a/target-utils/libload/cmd_memdump_human.c Wed Nov 04 20:34:12 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* - * This is a human-oriented memory dump command. The dump is given in - * both hex and ASCII, with readable spacing. - */ - -#include -#include "types.h" - -void -cmd_memdump_human(argbulk) - char *argbulk; -{ - char *argv[3]; - u_long start, length; - u_long offset; - u_char intbuf[16]; - int i, c; - - if (parse_args(argbulk, 2, 2, argv, 0) < 0) - return; - if (parse_hexarg(argv[0], 8, &start) < 0) { - printf("ERROR: arg1 must be a valid 32-bit hex address\n"); - return; - } - if (parse_hexarg(argv[1], 8, &length) < 0) { - printf("ERROR: arg2 must be a valid 32-bit hex value (length)\n"); - return; - } - if (start & 0xF || length & 0xF) { - printf("ERROR: implementation limit: 16-byte alignment required\n"); - return; - } - for (offset = 0; offset < length; offset += 0x10) { - bcopy(start + offset, intbuf, 0x10); - printf("%08X: ", start + offset); - for (i = 0; i < 16; i++) { - printf("%02X ", intbuf[i]); - if ((i & 3) == 3) - putchar(' '); - } - for (i = 0; i < 16; i++) { - c = intbuf[i]; - if (c >= ' ' && c <= '~') - putchar(c); - else - putchar('.'); - } - putchar('\n'); - } -} diff -r d7830aee0d35 -r 1557e15a012f target-utils/libload/cmd_memdump_machine.c --- a/target-utils/libload/cmd_memdump_machine.c Wed Nov 04 20:34:12 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* - * This is a machine-oriented memory dump command. The output is in the - * form of S3 records. - */ - -#include -#include "types.h" - -void -cmd_memdump_machine(argbulk) - char *argbulk; -{ - char *argv[3]; - u_long start, length; - u_long addr; - u_char srbuf[0x86], cksum; - int i; - - if (parse_args(argbulk, 2, 2, argv, 0) < 0) - return; - if (parse_hexarg(argv[0], 8, &start) < 0) { - printf("ERROR: arg1 must be a valid 32-bit hex address\n"); - return; - } - if (parse_hexarg(argv[1], 8, &length) < 0) { - printf("ERROR: arg2 must be a valid 32-bit hex value (length)\n"); - return; - } - if (start & 0x7F || length & 0x7F) { - printf("ERROR: implementation limit: 128-byte alignment required\n"); - return; - } - srbuf[0] = 0x85; - for (addr = start; addr < start + length; addr += 0x80) { - srbuf[1] = addr >> 24; - srbuf[2] = addr >> 16; - srbuf[3] = addr >> 8; - srbuf[4] = addr; - bcopy(addr, srbuf + 5, 0x80); - cksum = 0; - for (i = 0; i < 0x85; i++) - cksum += srbuf[i]; - srbuf[i] = ~cksum; - putchar('S'); - putchar('3'); - for (i = 0; i < 0x86; i++) - printf("%02X", srbuf[i]); - putchar('\n'); - } -} diff -r d7830aee0d35 -r 1557e15a012f target-utils/pirexplore/Makefile --- a/target-utils/pirexplore/Makefile Wed Nov 04 20:34:12 2015 +0000 +++ b/target-utils/pirexplore/Makefile Wed Nov 04 20:48:40 2015 +0000 @@ -6,8 +6,7 @@ PROG= pirexplore OBJS= crt0.o cmdtab.o ffsparam.o flashid.o lcd.o main.o mygetchar.o rtc.o -LIBS= ../libcommon/libcommon.a ../libload/libload.a ../libtiffs/libtiffs.a \ - ../libprintf/libprintf.a +LIBS= ../libcommon/libcommon.a ../libtiffs/libtiffs.a ../libprintf/libprintf.a LDS= ../env/iram.lds TC_LIBS=`${CC} -print-file-name=libc.a` \