diff --git a/ROM2/Makefile b/ROM2/Makefile index 38780bfa9582d758ce4fdff80eb0ef8d8c5c8093..4a3721886c96ab8719529632fd3b44d2859d5657 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 0000000000000000000000000000000000000000..cf74d0e8d84b35b793d7fe5b9e81c063fca59cac --- /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 (<OD>) { + 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 (<PL>) { + 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 e382f24672f2d1fd51fd524879289a7bd1ca5d7e..0500e789cfe1131bc29488326ea84608426de26a 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;