2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
16 FIRMWARE
:= ..
/..
/firmware
25 @echo
"No platform given."
26 @echo
"Use make PLATFORM=PLAYER|RECORDER|FM|ONDIO {NO_ROM=1}"
29 ## @echo "Building bootloader for platform "$(PLATFORM)
33 INCLUDES
= -I
$(FIRMWARE
)/export -I.
-I
$(OBJDIR
)
34 DEFINES
= -DPLATFORM_
$(PLATFORM
)
38 CFLAGS
= -Os
-W
-Wall
-m1
-nostdlib
-ffreestanding
-Wstrict-prototypes
-fomit-frame-pointer
-fschedule-insns
$(INCLUDES
) $(DEFINES
)
39 AFLAGS
+= -small
-relax
47 SRC
:= $(wildcard *.c
)
49 OBJS
:= $(SRC
:%.c
=$(OBJDIR
)/%.o
) $(OBJDIR
)/sh_nrv2e_d8.o
52 LINKFILE
= $(OBJDIR
)/no_rom.lds
56 LINKFILE
= $(OBJDIR
)/$(TARGET
).lds
60 $(OBJDIR
)/$(TARGET
).bin
: $(OBJDIR
)/$(TARGET
).elf
61 $(OC
) -O binary
$(OBJDIR
)/$(TARGET
).elf
$(OBJDIR
)/$(TARGET
).bin
62 $(TOOLSDIR
)/sh2d
$(OBJDIR
)/$(TARGET
).bin
-o
$(ORIGIN
) > $(OBJDIR
)/$(TARGET
).asm
64 $(TOOLSDIR
)/scramble
$(OBJDIR
)/$(TARGET
).bin
$(OBJDIR
)/$(TARGET
).ajz
67 $(OBJDIR
)/$(TARGET
).elf
: $(OBJS
)
68 $(CC
) -Os
-nostdlib
-o
$@
$(OBJS
) -T
$(LINKFILE
) -Wl
,-Map
,$(OBJDIR
)/$(TARGET
).map
70 # cross-reference, saves code duplication
71 $(OBJDIR
)/sh_nrv2e_d8.o
: ..
/..
/firmware
/decompressor
/sh_nrv2e_d8.S
72 $(CC
) $(CFLAGS
) -c
$< -o
$@
77 $(OBJDIR
)/$(TARGET
).asm \
78 $(OBJDIR
)/$(TARGET
).bin \
79 $(OBJDIR
)/$(TARGET
).ajz \
80 $(OBJDIR
)/$(TARGET
).elf \
81 $(OBJDIR
)/$(TARGET
).map