blob: a2883fb2af040d4397eab14fc3e0e72e132aa605 [file] [log] [blame]
Björn Stenbergc6b3d382008-11-20 11:27:31 +00001# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
Björn Stenberga091d202008-11-25 19:54:23 +00007# $Id$
Björn Stenbergc6b3d382008-11-20 11:27:31 +00008#
9
10INCLUDES += -I$(APPSDIR)
11SRC += $(call preprocess, $(APPSDIR)/SOURCES)
12
13BOOTLDS := $(FIRMDIR)/target/$(CPU)/$(MANUFACTURER)/boot.lds
14BOOTLINK := $(BUILDDIR)/boot.link
15
16CLEANOBJS += $(BUILDDIR)/bootloader.*
17
18.SECONDEXPANSION:
19
20$(BOOTLINK): $(BOOTLDS)
21 $(call PRINTS,PP $(@F))
22 $(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS))
23
24$(BUILDDIR)/bootloader.elf: $$(OBJ) $$(FIRMLIB) $$(BOOTLINK)
25 $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJ) \
26 $(FIRMLIB) -lgcc -L$(BUILDDIR)/firmware -T$(BOOTLINK) \
27 -Wl,--gc-sections -Wl,-Map,$(BUILDDIR)/bootloader.map
28
29$(BUILDDIR)/bootloader.bin : $(BUILDDIR)/bootloader.elf
30 $(call PRINTS,OBJCOPY $(@F))$(OC) $(if $(filter yes, $(USE_ELF)), -S -x, -O binary) $< $@
31
32$(BUILDDIR)/bootloader.asm: $(BUILDDIR)/bootloader.bin
33 $(TOOLSDIR)/sh2d -sh1 $< > $@
34
35$(BUILDDIR)/$(BINARY) : $(BUILDDIR)/bootloader.bin
36 $(call PRINTS,Build bootloader file)$(MKFIRMWARE) $< $@
37