2018-04-30 22:15:48 -07:00
|
|
|
ifeq ($(strip $(DEVKITARM)),)
|
|
|
|
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
|
|
endif
|
|
|
|
|
2018-06-08 02:42:24 -07:00
|
|
|
include $(DEVKITARM)/base_rules
|
2018-04-30 22:15:48 -07:00
|
|
|
|
2019-02-23 16:43:13 -08:00
|
|
|
IPL_LOAD_ADDR := 0x40008000
|
2019-03-07 13:53:58 -08:00
|
|
|
IPL_MAGIC := 0x43544349 #"ICTC"
|
2018-09-18 14:36:40 -07:00
|
|
|
BLVERSION_MAJOR := 4
|
2019-02-23 17:09:07 -08:00
|
|
|
BLVERSION_MINOR := 8
|
2019-03-07 13:53:58 -08:00
|
|
|
BLVERSION_HOTFX := 0
|
|
|
|
|
|
|
|
BL_RESERVED := 0
|
2019-02-23 16:43:13 -08:00
|
|
|
|
|
|
|
TARGET := hekate
|
2018-08-13 01:58:24 -07:00
|
|
|
BUILD := build
|
2018-08-07 07:53:58 -07:00
|
|
|
OUTPUT := output
|
2018-08-13 01:58:24 -07:00
|
|
|
SOURCEDIR = bootloader
|
|
|
|
VPATH = $(dir $(wildcard ./$(SOURCEDIR)/*/)) $(dir $(wildcard ./$(SOURCEDIR)/*/*/))
|
2018-08-07 07:53:58 -07:00
|
|
|
|
2018-08-13 01:58:24 -07:00
|
|
|
OBJS = $(addprefix $(BUILD)/$(TARGET)/, \
|
2018-04-30 22:15:48 -07:00
|
|
|
start.o \
|
|
|
|
main.o \
|
2018-11-27 01:45:43 -08:00
|
|
|
fe_emmc_tools.o \
|
|
|
|
fe_info.o \
|
|
|
|
fe_tools.o \
|
2018-07-01 10:45:25 -07:00
|
|
|
config.o \
|
2018-04-30 22:15:48 -07:00
|
|
|
btn.o \
|
|
|
|
clock.o \
|
|
|
|
cluster.o \
|
|
|
|
fuse.o \
|
|
|
|
gpio.o \
|
|
|
|
heap.o \
|
|
|
|
hos.o \
|
2018-11-28 11:26:16 -08:00
|
|
|
hos_config.o \
|
2018-12-01 10:46:59 -08:00
|
|
|
secmon_exo.o \
|
2019-02-23 17:03:17 -08:00
|
|
|
sept.o \
|
2018-04-30 22:15:48 -07:00
|
|
|
i2c.o \
|
|
|
|
kfuse.o \
|
2018-06-24 12:42:46 -07:00
|
|
|
bq24193.o \
|
2018-04-30 22:15:48 -07:00
|
|
|
max7762x.o \
|
2018-06-24 12:42:46 -07:00
|
|
|
max17050.o \
|
2018-04-30 22:15:48 -07:00
|
|
|
mc.o \
|
|
|
|
nx_emmc.o \
|
|
|
|
sdmmc.o \
|
|
|
|
sdmmc_driver.o \
|
|
|
|
sdram.o \
|
|
|
|
tui.o \
|
|
|
|
util.o \
|
|
|
|
di.o \
|
|
|
|
gfx.o \
|
|
|
|
pinmux.o \
|
|
|
|
pkg1.o \
|
|
|
|
pkg2.o \
|
|
|
|
se.o \
|
|
|
|
tsec.o \
|
|
|
|
uart.o \
|
2018-11-27 01:45:43 -08:00
|
|
|
hw_init.o \
|
2018-08-20 18:37:40 -07:00
|
|
|
dirlist.o \
|
2018-04-30 22:15:48 -07:00
|
|
|
ini.o \
|
2018-08-20 18:14:31 -07:00
|
|
|
ianos.o \
|
2018-11-30 13:20:15 -08:00
|
|
|
smmu.o \
|
2019-02-11 14:45:27 -08:00
|
|
|
max77620-rtc.o \
|
2018-04-30 22:15:48 -07:00
|
|
|
)
|
2018-08-07 07:53:58 -07:00
|
|
|
|
2018-08-13 01:58:24 -07:00
|
|
|
OBJS += $(addprefix $(BUILD)/$(TARGET)/, \
|
|
|
|
lz.o blz.o \
|
|
|
|
diskio.o ff.o ffunicode.o ffsystem.o \
|
|
|
|
elfload.o elfreloc_arm.o \
|
|
|
|
)
|
2018-04-30 22:15:48 -07:00
|
|
|
|
2019-03-07 13:53:58 -08:00
|
|
|
CUSTOMDEFINES := -DIPL_LOAD_ADDR=$(IPL_LOAD_ADDR) -DBL_MAGIC=$(IPL_MAGIC)
|
|
|
|
CUSTOMDEFINES += -DBL_VER_MJ=$(BLVERSION_MAJOR) -DBL_VER_MN=$(BLVERSION_MINOR) -DBL_VER_HF=$(BLVERSION_HOTFX) -DBL_RESERVED=$(BL_RESERVED)
|
2019-02-23 16:43:13 -08:00
|
|
|
CUSTOMDEFINES += -DMENU_LOGO_ENABLE
|
2019-03-07 13:53:58 -08:00
|
|
|
|
2018-12-16 09:04:46 -08:00
|
|
|
# 0: UART_A, 1: UART_B.
|
2018-12-16 06:52:38 -08:00
|
|
|
#CUSTOMDEFINES += -DDEBUG_UART_PORT=0
|
|
|
|
|
2019-03-07 13:53:58 -08:00
|
|
|
#CUSTOMDEFINES += -DDEBUG
|
|
|
|
|
2018-04-30 22:15:48 -07:00
|
|
|
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb -mthumb-interwork
|
2018-08-20 18:14:31 -07:00
|
|
|
CFLAGS = $(ARCH) -O2 -nostdlib -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-inline -std=gnu11 -Wall $(CUSTOMDEFINES)
|
2019-02-23 16:43:13 -08:00
|
|
|
LDFLAGS = $(ARCH) -nostartfiles -lgcc -Wl,--nmagic,--gc-sections -Xlinker --defsym=IPL_LOAD_ADDR=$(IPL_LOAD_ADDR)
|
2018-04-30 22:15:48 -07:00
|
|
|
|
2018-08-07 07:53:58 -07:00
|
|
|
MODULEDIRS := $(wildcard modules/*)
|
|
|
|
|
|
|
|
.PHONY: all clean $(MODULEDIRS)
|
2018-04-30 22:15:48 -07:00
|
|
|
|
2018-05-10 19:28:53 -07:00
|
|
|
all: $(TARGET).bin
|
2018-06-30 18:56:58 -07:00
|
|
|
@echo -n "Payload size is "
|
2018-08-07 07:53:58 -07:00
|
|
|
@wc -c < $(OUTPUT)/$(TARGET).bin
|
2018-06-30 18:56:58 -07:00
|
|
|
@echo "Max size is 126296 Bytes."
|
2018-04-30 22:15:48 -07:00
|
|
|
|
|
|
|
clean:
|
|
|
|
@rm -rf $(OBJS)
|
2018-05-10 19:28:53 -07:00
|
|
|
@rm -rf $(BUILD)
|
2018-08-07 07:53:58 -07:00
|
|
|
@rm -rf $(OUTPUT)
|
|
|
|
|
|
|
|
$(MODULEDIRS):
|
|
|
|
$(MAKE) -C $@ $(MAKECMDGOALS)
|
2018-04-30 22:15:48 -07:00
|
|
|
|
2018-08-13 01:58:24 -07:00
|
|
|
$(TARGET).bin: $(BUILD)/$(TARGET)/$(TARGET).elf $(MODULEDIRS)
|
2018-08-07 07:53:58 -07:00
|
|
|
$(OBJCOPY) -S -O binary $< $(OUTPUT)/$@
|
2018-08-20 18:41:16 -07:00
|
|
|
@printf ICTC$(BLVERSION_MAJOR)$(BLVERSION_MINOR) >> $(OUTPUT)/$@
|
2018-04-30 22:15:48 -07:00
|
|
|
|
2018-08-13 01:58:24 -07:00
|
|
|
$(BUILD)/$(TARGET)/$(TARGET).elf: $(OBJS)
|
|
|
|
$(CC) $(LDFLAGS) -T $(SOURCEDIR)/link.ld $^ -o $@
|
2018-04-30 22:15:48 -07:00
|
|
|
|
2018-08-13 01:58:24 -07:00
|
|
|
$(BUILD)/$(TARGET)/%.o: %.c
|
2018-04-30 22:15:48 -07:00
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
2018-08-13 01:58:24 -07:00
|
|
|
$(BUILD)/$(TARGET)/%.o: %.S
|
2018-05-10 19:28:53 -07:00
|
|
|
@mkdir -p "$(BUILD)"
|
2018-08-13 01:58:24 -07:00
|
|
|
@mkdir -p "$(BUILD)/$(TARGET)"
|
2018-08-07 07:53:58 -07:00
|
|
|
@mkdir -p "$(OUTPUT)"
|
2018-04-30 22:15:48 -07:00
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|