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 | |
| 13 | BOOTLDS := $(FIRMDIR)/target/$(CPU)/$(MANUFACTURER)/boot.lds |
| 14 | BOOTLINK := $(BUILDDIR)/boot.link |
| 15 | |
| 16 | CLEANOBJS += $(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 | |