2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 INCLUDES
+= -I
$(APPSDIR
)
11 SRC
+= $(call preprocess
, $(APPSDIR
)/SOURCES
)
13 BOOTLDS
:= $(FIRMDIR
)/target
/$(CPU
)/$(MANUFACTURER
)/boot.lds
14 BOOTLINK
:= $(BUILDDIR
)/boot.link
16 CLEANOBJS
+= $(BUILDDIR
)/bootloader.
*
20 $(BOOTLINK
): $(BOOTLDS
)
21 $(call PRINTS
,PP
$(@F
))
22 $(call preprocess2file
,$<,$@
,-DLOADADDRESS
=$(LOADADDRESS
))
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
29 $(BUILDDIR
)/bootloader.bin
: $(BUILDDIR
)/bootloader.elf
30 $(call PRINTS
,OBJCOPY
$(@F
))$(OC
) $(if
$(filter yes
, $(USE_ELF
)), -S
-x
, -O binary
) $< $@
32 $(BUILDDIR
)/bootloader.asm
: $(BUILDDIR
)/bootloader.bin
33 $(TOOLSDIR
)/sh2d
-sh1
$< > $@
35 $(BUILDDIR
)/$(BINARY
) : $(BUILDDIR
)/bootloader.bin
36 $(call PRINTS
,Build bootloader file
)$(MKFIRMWARE
) $< $@