summaryrefslogtreecommitdiffstats
path: root/bootloader/Makefile
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2005-01-28 12:51:10 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2005-01-28 12:51:10 +0000
commitd39714555498ffaed2b4d29459d58243691b16db (patch)
tree49c7ba78eb09c7db2f1c8a6c5b35e9d9c8e9c831 /bootloader/Makefile
parent2b8c52d98c7e62f9a47e3c76f2796cfdbffadd20 (diff)
downloadrockbox-d39714555498ffaed2b4d29459d58243691b16db.tar.gz
rockbox-d39714555498ffaed2b4d29459d58243691b16db.tar.bz2
rockbox-d39714555498ffaed2b4d29459d58243691b16db.zip
iRiver Boot loader
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5694 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'bootloader/Makefile')
-rw-r--r--bootloader/Makefile78
1 files changed, 78 insertions, 0 deletions
diff --git a/bootloader/Makefile b/bootloader/Makefile
new file mode 100644
index 0000000000..8daa23f041
--- /dev/null
+++ b/bootloader/Makefile
@@ -0,0 +1,78 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id$
+#
+
+INCLUDES= -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(OBJDIR)
+
+DEPFILE = $(OBJDIR)/dep-apps
+LDS := $(FIRMDIR)/boot.lds
+
+ifdef DEBUG
+ DEFINES := -DDEBUG
+ CFLAGS += -g
+endif
+
+SRC := $(shell cat SOURCES | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P -include "config.h" - )
+DIRS = .
+
+ifdef APPEXTRA
+ DIRS += $(APPEXTRA)
+ INCLUDES += -I$(APPEXTRA)
+endif
+
+CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(DEFINES) \
+ -DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE}
+
+OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
+SOURCES = $(SRC)
+LINKFILE = $(OBJDIR)/linkage.lds
+MAXINFILE = $(OBJDIR)/romstart.temp
+MAXOUTFILE = $(OBJDIR)/romstart
+
+ifdef DEBUG
+all: $(OBJDIR)/bootloader.elf
+else
+all: $(OBJDIR)/$(BINARY) $(FLASHFILE)
+endif
+
+dep: $(DEPFILE)
+
+$(LINKFILE): $(LDS)
+ @echo "Build LDS file"
+ @cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@
+
+$(MAXOUTFILE):
+ @echo '#include "config.h"' > $(MAXINFILE)
+ @echo "ROM_START" >> $(MAXINFILE)
+ @cat $(MAXINFILE) | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - > $(MAXOUTFILE)
+ @rm $(MAXINFILE)
+
+$(OBJDIR)/bootloader.elf : $(OBJS) $(LINKFILE) $(OBJDIR)/librockbox.a $(DEPFILE)
+ @echo "LD bootloader.elf"
+ $(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJS) -L$(OBJDIR) -lrockbox -lgcc -L$(FIRMDIR) -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/bootloader.map
+
+$(OBJDIR)/bootloader.bin : $(OBJDIR)/bootloader.elf
+ @echo "OBJCOPY $<"
+ @$(OC) -O binary $< $@
+
+$(OBJDIR)/bootloader.asm: $(OBJDIR)/bootloader.bin
+ $(TOOLSDIR)/sh2d -sh1 $< > $@
+
+$(OBJDIR)/$(BINARY) : $(OBJDIR)/bootloader.bin
+ @echo "Build bootloader file"
+ @$(MKFIRMWARE) $< $@
+
+include $(TOOLSDIR)/make.inc
+
+clean:
+ @echo "cleaning bootloader"
+ @-rm -f $(OBJS) $(OBJDIR)/$(BINARY) $(OBJDIR)/bootloader.asm \
+ $(OBJDIR)/bootloader.bin $(OBJDIR)/bootloader.elf $(OBJDIR)/*.map \
+ $(LINKFILE) $(MAXOUTFILE) $(DEPFILE)
+
+-include $(DEPFILE)