From 948e384f4d4046ce43b2b16136ffb74698817552 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 6 Sep 2004 08:50:47 +0000 Subject: [PATCH] removed the hard-coded size limit from the Makefile with some preprocessor magic and a modified perl script git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5045 a1c6a512-1295-4272-9138-f99709370657 --- apps/Makefile | 20 ++++++++++++-------- tools/romsizetest.pl | 12 +++++++++++- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/apps/Makefile b/apps/Makefile index 478045f047..06260a019f 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -55,14 +55,9 @@ SRC := $(wildcard *.c) ifeq ($(TARGET), -DARCHOS_FMRECORDER) TOOL_OPT = -fm - MAXROMSIZE = 180208 # 176KB -16 endif ifeq ($(TARGET), -DARCHOS_RECORDERV2) TOOL_OPT = -v2 - MAXROMSIZE = 188400 # 184KB - 16 -endif -ifeq ($(TARGET), -DARCHOS_RECORDER) - MAXROMSIZE = 192496 # 188KB - 16 endif @@ -104,6 +99,9 @@ ifndef TOOLSDIR TOOLSDIR=../tools endif +MAXINFILE = $(OBJDIR)/romstart.temp +MAXOUTFILE = $(OBJDIR)/romstart + ifdef DEBUG all : $(OBJDIR)/rockbox.elf rocks else @@ -123,7 +121,13 @@ $(LINKFILE): $(LDS) cat $< | $(CC) -DMEMORYSIZE=$(MEM) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@ $(LINKROM): $(ROMLDS) - cat $< | $(CC) -DMEMORYSIZE=$(MEM) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@ + cat $< | $(CC) -DMEMORYSIZE=$(MEM) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@ + +$(MAXOUTFILE): + @echo '#include "config.h"' > $(MAXINFILE) + @echo "ROM_START" >> $(MAXINFILE) + @cat $(MAXINFILE) | $(CC) -DMEMORYSIZE=$(MEM) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - > $(MAXOUTFILE) + @rm $(MAXINFILE) $(OBJDIR)/rombox.elf : $(OBJS) $(LINKROM) $(OBJDIR)/librockbox.a @echo "LD rombox.elf" @@ -157,13 +161,13 @@ $(OBJDIR)/rockbox.ucl: $(OBJDIR)/rockbox.bin echo "fake" > $@; \ fi -$(OBJDIR)/rombox.ucl: $(OBJDIR)/rombox.bin +$(OBJDIR)/rombox.ucl: $(OBJDIR)/rombox.bin $(MAXOUTFILE) @a=`uclpack -h 2>/dev/null`; \ if test -n "$$a"; then \ echo "UCLPACK rombox" ; \ uclpack --none $< $@ >/dev/null 2>&1; \ if test -s $@; then \ - perl $(TOOLSDIR)/romsizetest.pl $(MAXROMSIZE) $@; \ + perl $(TOOLSDIR)/romsizetest.pl `cat $(MAXOUTFILE)` $@; \ if test $$? -ne 0; then \ echo "removing UCL file again, making it a fake one"; \ echo "fake" > $@; \ diff --git a/tools/romsizetest.pl b/tools/romsizetest.pl index 2b96c3cdaf..6f260caa8d 100755 --- a/tools/romsizetest.pl +++ b/tools/romsizetest.pl @@ -13,7 +13,17 @@ sub filesize { return $size; } -my $max = $ARGV[0]; +my $romsize = 256*1024; # 256 KB + +my $romstart = $ARGV[0]; + +if($romstart =~ /^0x(.*)/i) { + $romstart = hex($romstart); +} + + +my $max = $romsize - $romstart; + my $file = filesize($ARGV[1]); if($file > $max ) {