From 12a32b8bede21a6011d240bf7e63fc6705322717 Mon Sep 17 00:00:00 2001 From: Bernard Blackham Date: Wed, 23 Jun 2004 15:44:53 +0000 Subject: [PATCH] A little sanity checker. --- ROM2/Makefile | 3 ++- ROM2/check-romsrc.pl | 32 ++++++++++++++++++++++++++++++++ ROM2/src2asm.pl | 3 ++- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 ROM2/check-romsrc.pl diff --git a/ROM2/Makefile b/ROM2/Makefile index 38780bf..4a37218 100644 --- a/ROM2/Makefile +++ b/ROM2/Makefile @@ -36,9 +36,10 @@ LD = $(DEVC_PREFIX)ld all: rom2.b rom2.elf rom2.s19 -rom2.elf: $(OBJS) memory.x +rom2.elf: $(OBJS) memory.x check-romsrc.pl $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBADD) $(SIZE) $@ + @perl -w check-romsrc.pl clean: rm -f *.o *.elf *.s19 *.b *.a rom.tar.bz2 romsrc.s crctab.h m68hc11-gdb gencrctab diff --git a/ROM2/check-romsrc.pl b/ROM2/check-romsrc.pl new file mode 100644 index 0000000..cf74d0e --- /dev/null +++ b/ROM2/check-romsrc.pl @@ -0,0 +1,32 @@ +#!/usr/bin/perl -w + +# looking for a line like: +# 00009800 g .rodata 00000000 _rom_src_data + +open(OD, "m68hc11-objdump -x rom2.elf|") or die "Could not open objdump of rom image!\n"; +while () { + if (/^([0-9a-fA-F]+).*_rom_src_data$/) { $origin = $1 } +} +close OD; +if (!defined $origin) { + print "WARNING!!! No bz2 data could be found in the ROM image!\n"; + exit 1; +} +$origin = hex($origin); + +open(PL, "src2asm.pl") or die "Could not open src2asm.pl\n"; +while () { + if (/^\$origin = 0x([0-9a-fA-F]+);$/) { $pl_origin = $1 } +} +close PL; +if (!defined $pl_origin) { + print "WARNING!!! Couldn't find origin in src2asm.pl!\n"; + exit 2; +} +$pl_origin = hex($pl_origin); +if ($pl_origin != $origin) { + printf "WARNING!!! The origin of the bz2 data is now 0x%04x. This needs to\n", $origin; + printf " be updated in src2asm.pl (which currently says 0x%04x).\n", $pl_origin; + exit 3; +} +printf "Origin of bz2 data is 0x%04x and correct.\n", $origin; diff --git a/ROM2/src2asm.pl b/ROM2/src2asm.pl index e382f24..0500e78 100644 --- a/ROM2/src2asm.pl +++ b/ROM2/src2asm.pl @@ -1,6 +1,7 @@ #!/usr/bin/perl -w -$origin = 0x9800; # must match address of .romsrc in memory.x +# keep the format of this next line the same to match regex in check-romsrc.pl +$origin = 0x9800; $hole_start = 0xb600; $hole_size = 0x0200; -- 2.20.1