2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 INCLUDES
+= -I
$(APPSDIR
)
11 SRC
+= $(call preprocess
, $(APPSDIR
)/SOURCES
)
13 CONFIGFILE
:= $(FIRMDIR
)/export/config
/$(MODELNAME
).h
14 BOOTLDS
:= $(FIRMDIR
)/target
/$(CPU
)/$(MANUFACTURER
)/boot.lds
15 BOOTLINK
:= $(BUILDDIR
)/boot.link
17 CLEANOBJS
+= $(BUILDDIR
)/bootloader.
*
21 $(BOOTLINK
): $(BOOTLDS
) $(CONFIGFILE
)
22 $(call PRINTS
,PP
$(@F
))
23 $(call preprocess2file
,$<,$@
,-DLOADADDRESS
=$(LOADADDRESS
))
25 $(BUILDDIR
)/bootloader.elf
: $$(OBJ
) $(FIRMLIB
) $(CORE_LIBS
) $$(BOOTLINK
)
26 $(call PRINTS
,LD
$(@F
))$(CC
) $(GCCOPTS
) -Os
-nostdlib
-o
$@
$(OBJ
) \
27 -L
$(BUILDDIR
)/firmware
-lfirmware \
28 -L
$(BUILDDIR
)/lib
$(call a2lnk
, $(CORE_LIBS
)) \
29 -lgcc
-T
$(BOOTLINK
) $(GLOBAL_LDOPTS
) \
30 -Wl
,--gc-sections
-Wl
,-Map
,$(BUILDDIR
)/bootloader.map
32 $(BUILDDIR
)/bootloader.bin
: $(BUILDDIR
)/bootloader.elf
33 $(call PRINTS
,OC
$(@F
))$(call objcopy
,$<,$@
)
35 $(BUILDDIR
)/bootloader.asm
: $(BUILDDIR
)/bootloader.bin
36 $(TOOLSDIR
)/sh2d
-sh1
$< > $@
38 $(BUILDDIR
)/$(BINARY
) : $(BUILDDIR
)/bootloader.bin
39 $(call PRINTS
,Build bootloader file
)$(MKFIRMWARE
) $< $@