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-03-07 14:19:04 -08: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"
|
2019-12-11 01:22:11 -08:00
|
|
|
include ./Versions.inc
|
2019-02-23 16:43:13 -08:00
|
|
|
|
2019-03-07 14:19:04 -08:00
|
|
|
################################################################################
|
|
|
|
|
2019-02-23 16:43:13 -08:00
|
|
|
TARGET := hekate
|
2019-03-07 14:19:04 -08:00
|
|
|
BUILDDIR := build
|
|
|
|
OUTPUTDIR := output
|
2018-08-13 01:58:24 -07:00
|
|
|
SOURCEDIR = bootloader
|
2020-03-03 15:34:35 -08:00
|
|
|
VPATH = $(dir ./$(SOURCEDIR)/) $(dir $(wildcard ./$(SOURCEDIR)/*/)) $(dir $(wildcard ./$(SOURCEDIR)/*/*/))
|
2018-08-07 07:53:58 -07:00
|
|
|
|
2019-03-07 14:19:04 -08:00
|
|
|
# Main and graphics.
|
|
|
|
OBJS = $(addprefix $(BUILDDIR)/$(TARGET)/, \
|
2018-04-30 22:15:48 -07:00
|
|
|
start.o \
|
2019-03-07 14:19:04 -08:00
|
|
|
main.o heap.o \
|
|
|
|
gfx.o tui.o \
|
|
|
|
fe_emmc_tools.o fe_info.o fe_tools.o \
|
|
|
|
)
|
|
|
|
|
|
|
|
# Hardware.
|
|
|
|
OBJS += $(addprefix $(BUILDDIR)/$(TARGET)/, \
|
2019-06-29 17:57:45 -07:00
|
|
|
bpmp.o clock.o cluster.o di.o gpio.o i2c.o mc.o sdram.o pinmux.o se.o smmu.o tsec.o uart.o \
|
2019-06-29 17:49:33 -07:00
|
|
|
fuse.o kfuse.o minerva.o \
|
2019-06-29 17:40:37 -07:00
|
|
|
sdmmc.o sdmmc_driver.o emummc.o nx_emmc.o \
|
2019-03-07 14:19:04 -08:00
|
|
|
bq24193.o max17050.o max7762x.o max77620-rtc.o \
|
2018-11-27 01:45:43 -08:00
|
|
|
hw_init.o \
|
2018-04-30 22:15:48 -07:00
|
|
|
)
|
2018-08-07 07:53:58 -07:00
|
|
|
|
2019-03-07 14:19:04 -08:00
|
|
|
# Utilities.
|
|
|
|
OBJS += $(addprefix $(BUILDDIR)/$(TARGET)/, \
|
|
|
|
btn.o dirlist.o ianos.o util.o \
|
|
|
|
config.o ini.o \
|
|
|
|
)
|
|
|
|
|
|
|
|
# Horizon.
|
|
|
|
OBJS += $(addprefix $(BUILDDIR)/$(TARGET)/, \
|
2019-06-29 17:49:33 -07:00
|
|
|
hos.o hos_config.o pkg1.o pkg2.o pkg2_ini_kippatch.o fss.o secmon_exo.o sept.o \
|
2019-03-07 14:19:04 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
# Libraries.
|
|
|
|
OBJS += $(addprefix $(BUILDDIR)/$(TARGET)/, \
|
2018-08-13 01:58:24 -07:00
|
|
|
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 14:19:04 -08:00
|
|
|
################################################################################
|
|
|
|
|
2019-12-07 16:23:03 -08:00
|
|
|
CUSTOMDEFINES := -DIPL_LOAD_ADDR=$(IPL_LOAD_ADDR) -DBL_MAGIC=$(IPL_MAGIC)
|
2019-12-11 01:22:11 -08:00
|
|
|
CUSTOMDEFINES += -DBL_VER_MJ=$(BLVERSION_MAJOR) -DBL_VER_MN=$(BLVERSION_MINOR) -DBL_VER_HF=$(BLVERSION_HOTFX) -DBL_RESERVED=$(BLVERSION_RSVD)
|
|
|
|
CUSTOMDEFINES += -DNYX_VER_MJ=$(NYXVERSION_MAJOR) -DNYX_VER_MN=$(NYXVERSION_MINOR) -DNYX_VER_HF=$(NYXVERSION_HOTFX) -DNYX_RESERVED=$(NYXVERSION_RSVD)
|
2019-09-12 13:55:48 -07: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/*)
|
2019-06-29 18:03:00 -07:00
|
|
|
NYXDIR := $(wildcard nyx)
|
2018-08-07 07:53:58 -07:00
|
|
|
|
2019-03-07 14:19:04 -08:00
|
|
|
################################################################################
|
|
|
|
|
2019-06-29 18:03:00 -07:00
|
|
|
.PHONY: all clean $(MODULEDIRS) $(NYXDIR)
|
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 "
|
2020-03-24 11:06:10 -07:00
|
|
|
$(eval BIN_SIZE = $(shell wc -c < $(OUTPUTDIR)/$(TARGET).bin))
|
|
|
|
@echo $(BIN_SIZE)
|
|
|
|
@echo "Max size is 126296 Bytes."
|
|
|
|
@if [ ${BIN_SIZE} -gt 126296 ]; then echo "\e[1;33mPayload size exceeds limit!\e[0m"; fi
|
2018-04-30 22:15:48 -07:00
|
|
|
|
|
|
|
clean:
|
|
|
|
@rm -rf $(OBJS)
|
2019-03-07 14:19:04 -08:00
|
|
|
@rm -rf $(BUILDDIR)
|
|
|
|
@rm -rf $(OUTPUTDIR)
|
2018-08-07 07:53:58 -07:00
|
|
|
|
|
|
|
$(MODULEDIRS):
|
2019-07-08 12:17:15 -07:00
|
|
|
$(MAKE) -C $@ $(MAKECMDGOALS) -$(MAKEFLAGS)
|
2018-04-30 22:15:48 -07:00
|
|
|
|
2019-06-29 18:03:00 -07:00
|
|
|
$(NYXDIR):
|
2019-07-08 12:17:15 -07:00
|
|
|
$(MAKE) -C $@ $(MAKECMDGOALS) -$(MAKEFLAGS)
|
2019-06-29 18:03:00 -07:00
|
|
|
|
|
|
|
$(TARGET).bin: $(BUILDDIR)/$(TARGET)/$(TARGET).elf $(MODULEDIRS) $(NYXDIR)
|
2019-03-07 14:19:04 -08:00
|
|
|
$(OBJCOPY) -S -O binary $< $(OUTPUTDIR)/$@
|
2019-04-21 07:38:29 -07:00
|
|
|
@printf ICTC49 >> $(OUTPUTDIR)/$@
|
2018-04-30 22:15:48 -07:00
|
|
|
|
2019-03-07 14:19:04 -08:00
|
|
|
$(BUILDDIR)/$(TARGET)/$(TARGET).elf: $(OBJS)
|
2018-08-13 01:58:24 -07:00
|
|
|
$(CC) $(LDFLAGS) -T $(SOURCEDIR)/link.ld $^ -o $@
|
2018-04-30 22:15:48 -07:00
|
|
|
|
2019-03-07 14:19:04 -08:00
|
|
|
$(BUILDDIR)/$(TARGET)/%.o: %.c
|
2018-04-30 22:15:48 -07:00
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
2019-03-07 14:19:04 -08:00
|
|
|
$(BUILDDIR)/$(TARGET)/%.o: %.S
|
2020-03-03 15:34:35 -08:00
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
$(OBJS): $(BUILDDIR)/$(TARGET)
|
|
|
|
|
|
|
|
$(BUILDDIR)/$(TARGET):
|
2019-03-07 14:19:04 -08:00
|
|
|
@mkdir -p "$(BUILDDIR)"
|
|
|
|
@mkdir -p "$(BUILDDIR)/$(TARGET)"
|
|
|
|
@mkdir -p "$(OUTPUTDIR)"
|