2005-01-28 12:51:10 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
|
2005-05-07 23:16:25 +00:00
|
|
|
INCLUDES= -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(OBJDIR) \
|
|
|
|
-I$(BUILDDIR)
|
2005-01-28 12:51:10 +00:00
|
|
|
|
2005-01-28 23:25:40 +00:00
|
|
|
DEPFILE = $(OBJDIR)/dep-bootloader
|
2005-01-28 12:51:10 +00:00
|
|
|
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
|
2005-05-07 23:16:25 +00:00
|
|
|
all: $(BUILDDIR)/$(BINARY) $(FLASHFILE)
|
2005-01-28 12:51:10 +00:00
|
|
|
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)
|
|
|
|
|
2005-05-07 23:16:25 +00:00
|
|
|
$(OBJDIR)/bootloader.elf : $(OBJS) $(LINKFILE) $(DEPFILE)
|
2005-01-28 12:51:10 +00:00
|
|
|
@echo "LD bootloader.elf"
|
2005-05-07 23:16:25 +00:00
|
|
|
$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJS) -L$(BUILDDIR) -L$(BUILDDIR)/firmware -lrockbox -lgcc -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/bootloader.map
|
2005-01-28 12:51:10 +00:00
|
|
|
|
|
|
|
$(OBJDIR)/bootloader.bin : $(OBJDIR)/bootloader.elf
|
|
|
|
@echo "OBJCOPY $<"
|
|
|
|
@$(OC) -O binary $< $@
|
|
|
|
|
|
|
|
$(OBJDIR)/bootloader.asm: $(OBJDIR)/bootloader.bin
|
|
|
|
$(TOOLSDIR)/sh2d -sh1 $< > $@
|
|
|
|
|
2005-05-07 23:16:25 +00:00
|
|
|
$(BUILDDIR)/$(BINARY) : $(OBJDIR)/bootloader.bin
|
2005-01-28 12:51:10 +00:00
|
|
|
@echo "Build bootloader file"
|
|
|
|
@$(MKFIRMWARE) $< $@
|
|
|
|
|
|
|
|
include $(TOOLSDIR)/make.inc
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@echo "cleaning bootloader"
|
2005-05-07 23:16:25 +00:00
|
|
|
@-rm -f $(OBJS) $(BUILDDIR)/$(BINARY) $(OBJDIR)/bootloader.asm \
|
2005-01-28 12:51:10 +00:00
|
|
|
$(OBJDIR)/bootloader.bin $(OBJDIR)/bootloader.elf $(OBJDIR)/*.map \
|
|
|
|
$(LINKFILE) $(MAXOUTFILE) $(DEPFILE)
|
|
|
|
|
|
|
|
-include $(DEPFILE)
|