changeset 196:3daa8ebbe74d

pirexplore: a bit of refactoring
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sat, 14 Dec 2013 07:55:22 +0000
parents 549e6cd1e77d
children fa7174faa9aa
files target-utils/Makefile target-utils/libmpffs/Makefile target-utils/libmpffs/cmd_find.c target-utils/pirexplore/Makefile target-utils/pirexplore/cmdtab.c target-utils/pirexplore/ffs.c
diffstat 6 files changed, 32 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/target-utils/Makefile	Tue Nov 26 20:23:38 2013 +0000
+++ b/target-utils/Makefile	Sat Dec 14 07:55:22 2013 +0000
@@ -7,7 +7,7 @@
 
 helloapp:	libcommon libprintf
 loadagent:	libcommon libload libprintf
-pirexplore:	libcommon libmpffs libprintf
+pirexplore:	libcommon libload libmpffs libprintf
 
 ${SUBDIR}: FRC
 	cd $@; ${MAKE} ${MFLAGS}
--- a/target-utils/libmpffs/Makefile	Tue Nov 26 20:23:38 2013 +0000
+++ b/target-utils/libmpffs/Makefile	Sat Dec 14 07:55:22 2013 +0000
@@ -4,7 +4,7 @@
 AR=	arm-elf-ar
 RANLIB=	arm-elf-ranlib
 
-OBJS=	basicfind.o findfile.o globals.o init.o rdinmem.o
+OBJS=	basicfind.o cmd_find.o findfile.o globals.o init.o rdinmem.o
 
 all:	libmpffs.a
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/libmpffs/cmd_find.c	Sat Dec 14 07:55:22 2013 +0000
@@ -0,0 +1,25 @@
+#include <sys/types.h>
+#include "types.h"
+
+void
+cmd_find(argbulk)
+	char *argbulk;
+{
+	char *argv[2];
+	int stat, cont;
+	u8 *start;
+	size_t size;
+
+	if (parse_args(argbulk, 1, 1, argv, 0) < 0)
+		return;
+	stat = mpffs_find_file(argv[0], &start, &size, &cont);
+	if (stat < 0)
+		return;
+	printf("chunk @%08X size %x\n", (u32)start, (u32)size);
+	while (cont) {
+		stat = mpffs_get_segment(cont, &start, &size, &cont);
+		if (stat < 0)
+			return;
+		printf("chunk @%08X size %x\n", (u32)start, (u32)size);
+	}
+}
--- a/target-utils/pirexplore/Makefile	Tue Nov 26 20:23:38 2013 +0000
+++ b/target-utils/pirexplore/Makefile	Sat Dec 14 07:55:22 2013 +0000
@@ -5,8 +5,9 @@
 OBJCOPY=arm-elf-objcopy
 
 PROG=	pirexplore
-OBJS=	crt0.o cmdtab.o ffs.o ffsparam.o lcd.o main.o mygetchar.o rtc.o
-LIBS=	../libcommon/libcommon.a ../libmpffs/libmpffs.a ../libprintf/libprintf.a
+OBJS=	crt0.o cmdtab.o ffsparam.o lcd.o main.o mygetchar.o rtc.o
+LIBS=	../libcommon/libcommon.a ../libload/libload.a ../libmpffs/libmpffs.a \
+	../libprintf/libprintf.a
 LDS=	../env/iram.lds
 
 TC_LIBS=`${CC} -print-file-name=libc.a` \
--- a/target-utils/pirexplore/cmdtab.c	Tue Nov 26 20:23:38 2013 +0000
+++ b/target-utils/pirexplore/cmdtab.c	Sat Dec 14 07:55:22 2013 +0000
@@ -19,12 +19,14 @@
 extern void cmd_w16();
 extern void cmd_w32();
 
+extern void cmd_memdump_human();
 extern void mpffs_init();
 
 const struct cmdtab cmdtab[] = {
 	{"baud", cmd_baud_switch},
 	{"blit", cmd_blit},
 	{"dieid", cmd_dieid},
+	{"dump", cmd_memdump_human},
 	{"ffsinit", mpffs_init},
 	{"find", cmd_find},
 	{"jump", cmd_jump},
--- a/target-utils/pirexplore/ffs.c	Tue Nov 26 20:23:38 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#include <sys/types.h>
-#include "types.h"
-
-void
-cmd_find(argbulk)
-	char *argbulk;
-{
-	char *argv[2];
-	int stat, cont;
-	u8 *start;
-	size_t size;
-
-	if (parse_args(argbulk, 1, 1, argv, 0) < 0)
-		return;
-	stat = mpffs_find_file(argv[0], &start, &size, &cont);
-	if (stat < 0)
-		return;
-	printf("chunk @%08X size %x\n", (u32)start, (u32)size);
-	while (cont) {
-		stat = mpffs_get_segment(cont, &start, &size, &cont);
-		if (stat < 0)
-			return;
-		printf("chunk @%08X size %x\n", (u32)start, (u32)size);
-	}
-}