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
This commit is contained in:
Daniel Stenberg 2004-09-06 08:50:47 +00:00
parent 6bbe00d9a3
commit 948e384f4d
2 changed files with 23 additions and 9 deletions

View file

@ -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" > $@; \

View file

@ -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 ) {