Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 1 | # __________ __ ___. |
| 2 | # Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 3 | # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 4 | # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 5 | # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 6 | # \/ \/ \/ \/ \/ |
Björn Stenberg | a091d20 | 2008-11-25 19:54:23 +0000 | [diff] [blame] | 7 | # $Id$ |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 8 | # |
| 9 | |
| 10 | INCLUDES += -I$(APPSDIR) |
| 11 | SRC += $(call preprocess, $(APPSDIR)/SOURCES) |
| 12 | |
Jens Arnold | 91ce4b2 | 2011-06-19 17:23:18 +0000 | [diff] [blame] | 13 | CONFIGFILE := $(FIRMDIR)/export/config/$(MODELNAME).h |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 14 | BOOTLDS := $(FIRMDIR)/target/$(CPU)/$(MANUFACTURER)/boot.lds |
| 15 | BOOTLINK := $(BUILDDIR)/boot.link |
| 16 | |
| 17 | CLEANOBJS += $(BUILDDIR)/bootloader.* |
| 18 | |
| 19 | .SECONDEXPANSION: |
| 20 | |
Jens Arnold | 91ce4b2 | 2011-06-19 17:23:18 +0000 | [diff] [blame] | 21 | $(BOOTLINK): $(BOOTLDS) $(CONFIGFILE) |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 22 | $(call PRINTS,PP $(@F)) |
| 23 | $(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS)) |
| 24 | |
Thomas Martitz | 045c69c | 2012-03-26 23:55:02 +0200 | [diff] [blame] | 25 | $(BUILDDIR)/bootloader.elf: $$(OBJ) $(FIRMLIB) $(CORE_LIBS) $$(BOOTLINK) |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 26 | $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJ) \ |
Thomas Martitz | 045c69c | 2012-03-26 23:55:02 +0200 | [diff] [blame] | 27 | -L$(BUILDDIR)/firmware -lfirmware \ |
| 28 | -L$(BUILDDIR)/lib $(call a2lnk, $(CORE_LIBS)) \ |
| 29 | -lgcc -T$(BOOTLINK) $(GLOBAL_LDOPTS) \ |
Marcin Bukat | 164cb21 | 2012-02-22 09:01:09 +0100 | [diff] [blame] | 30 | -Wl,--gc-sections -Wl,-Map,$(BUILDDIR)/bootloader.map |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 31 | |
| 32 | $(BUILDDIR)/bootloader.bin : $(BUILDDIR)/bootloader.elf |
Thomas Martitz | 4b56ee0 | 2012-04-04 21:43:22 +0200 | [diff] [blame] | 33 | $(call PRINTS,OC $(@F))$(call objcopy,$<,$@) |
Björn Stenberg | c6b3d38 | 2008-11-20 11:27:31 +0000 | [diff] [blame] | 34 | |
| 35 | $(BUILDDIR)/bootloader.asm: $(BUILDDIR)/bootloader.bin |
| 36 | $(TOOLSDIR)/sh2d -sh1 $< > $@ |
| 37 | |
| 38 | $(BUILDDIR)/$(BINARY) : $(BUILDDIR)/bootloader.bin |
| 39 | $(call PRINTS,Build bootloader file)$(MKFIRMWARE) $< $@ |
| 40 | |