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
) \
28 -Wl
,--gc-sections
-Wl
,-Map
,$(BUILDDIR
)/bootloader.map
30 $(BUILDDIR
)/bootloader.bin
: $(BUILDDIR
)/bootloader.elf
31 $(call PRINTS
,OBJCOPY
$(@F
))$(OC
) $(if
$(filter yes
, $(USE_ELF
)), -S
-x
, -O binary
) $< $@
33 $(BUILDDIR
)/bootloader.asm
: $(BUILDDIR
)/bootloader.bin
34 $(TOOLSDIR
)/sh2d
-sh1
$< > $@
36 $(BUILDDIR
)/$(BINARY
) : $(BUILDDIR
)/bootloader.bin
37 $(call PRINTS
,Build bootloader file
)$(MKFIRMWARE
) $< $@