Add embedded payload version
This commit is contained in:
parent
7e7e6fa148
commit
229bc3cb44
7
Makefile
7
Makefile
|
@ -9,6 +9,7 @@ include $(DEVKITARM)/base_rules
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
IPL_LOAD_ADDR := 0x40008000
|
IPL_LOAD_ADDR := 0x40008000
|
||||||
|
MAGIC = 0x4B434F4C #"LOCK"
|
||||||
include ./Versions.inc
|
include ./Versions.inc
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -37,8 +38,8 @@ FFCFG_INC := '"../$(SOURCEDIR)/libs/fatfs/ffconf.h"'
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
CUSTOMDEFINES := -DIPL_LOAD_ADDR=$(IPL_LOAD_ADDR)
|
CUSTOMDEFINES := -DIPL_LOAD_ADDR=$(IPL_LOAD_ADDR) -DLP_MAGIC=$(MAGIC)
|
||||||
CUSTOMDEFINES += -DLP_VER_MJ=$(LPVERSION_MAJOR) -DLP_VER_MN=$(LPVERSION_MINOR) -DLP_VER_BF=$(LPVERSION_BUGFX)
|
CUSTOMDEFINES += -DLP_VER_MJ=$(LPVERSION_MAJOR) -DLP_VER_MN=$(LPVERSION_MINOR) -DLP_VER_BF=$(LPVERSION_BUGFX) -DLP_RESERVED=$(LPVERSION_RSVD)
|
||||||
CUSTOMDEFINES += -DGFX_INC=$(GFX_INC) -DFFCFG_INC=$(FFCFG_INC)
|
CUSTOMDEFINES += -DGFX_INC=$(GFX_INC) -DFFCFG_INC=$(FFCFG_INC)
|
||||||
|
|
||||||
#CUSTOMDEFINES += -DDEBUG
|
#CUSTOMDEFINES += -DDEBUG
|
||||||
|
@ -51,7 +52,7 @@ CUSTOMDEFINES += -DGFX_INC=$(GFX_INC) -DFFCFG_INC=$(FFCFG_INC)
|
||||||
WARNINGS := -Wall -Wno-array-bounds -Wno-stringop-overread -Wno-stringop-overflow
|
WARNINGS := -Wall -Wno-array-bounds -Wno-stringop-overread -Wno-stringop-overflow
|
||||||
|
|
||||||
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb -mthumb-interwork
|
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb -mthumb-interwork
|
||||||
CFLAGS = $(ARCH) -O2 -nostdlib -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-inline -std=gnu11 $(WARNINGS) $(CUSTOMDEFINES)
|
CFLAGS = $(ARCH) -O2 -g -nostdlib -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-inline -std=gnu11 $(WARNINGS) $(CUSTOMDEFINES)
|
||||||
LDFLAGS = $(ARCH) -nostartfiles -lgcc -Wl,--nmagic,--gc-sections -Xlinker --defsym=IPL_LOAD_ADDR=$(IPL_LOAD_ADDR)
|
LDFLAGS = $(ARCH) -nostartfiles -lgcc -Wl,--nmagic,--gc-sections -Xlinker --defsym=IPL_LOAD_ADDR=$(IPL_LOAD_ADDR)
|
||||||
|
|
||||||
LDRDIR := $(wildcard loader)
|
LDRDIR := $(wildcard loader)
|
||||||
|
|
|
@ -109,6 +109,14 @@ typedef struct __attribute__((__packed__)) _boot_cfg_t
|
||||||
|
|
||||||
static_assert(sizeof(boot_cfg_t) == 0x84, "Boot CFG size is wrong!");
|
static_assert(sizeof(boot_cfg_t) == 0x84, "Boot CFG size is wrong!");
|
||||||
|
|
||||||
|
typedef struct __attribute__((__packed__)) _ipl_ver_meta_t
|
||||||
|
{
|
||||||
|
u32 magic;
|
||||||
|
u32 version;
|
||||||
|
u16 rsvd0;
|
||||||
|
u16 rsvd1;
|
||||||
|
} ipl_ver_meta_t;
|
||||||
|
|
||||||
typedef struct __attribute__((__packed__)) _reloc_meta_t
|
typedef struct __attribute__((__packed__)) _reloc_meta_t
|
||||||
{
|
{
|
||||||
u32 start;
|
u32 start;
|
||||||
|
|
|
@ -7,7 +7,7 @@ include $(DEVKITARM)/base_rules
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
LDR_LOAD_ADDR := 0x40007000
|
LDR_LOAD_ADDR := 0x40007000
|
||||||
IPL_MAGIC := 0x43544349 #"ICTC"
|
MAGIC := 0x4B434F4C #"LOCK"
|
||||||
include ../Versions.inc
|
include ../Versions.inc
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -26,8 +26,8 @@ OBJS = $(addprefix $(BUILDDIR)/$(TARGET)/, \
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
CUSTOMDEFINES := -DBL_MAGIC=$(IPL_MAGIC)
|
CUSTOMDEFINES := -DLP_MAGIC=$(MAGIC)
|
||||||
CUSTOMDEFINES += -DBL_VER_MJ=$(BLVERSION_MAJOR) -DBL_VER_MN=$(BLVERSION_MINOR) -DBL_VER_HF=$(BLVERSION_HOTFX) -DBL_RESERVED=$(BLVERSION_RSVD)
|
CUSTOMDEFINES += -DLP_VER_MJ=$(LPVERSION_MAJOR) -DLP_VER_MN=$(LPVERSION_MINOR) -DLP_VER_BF=$(LPVERSION_BUGFX) -DLP_RESERVED=$(LPVERSION_RSVD)
|
||||||
|
|
||||||
#TODO: Considering reinstating some of these when pointer warnings have been fixed.
|
#TODO: Considering reinstating some of these when pointer warnings have been fixed.
|
||||||
WARNINGS := -Wall -Wno-array-bounds -Wno-stringop-overflow
|
WARNINGS := -Wall -Wno-array-bounds -Wno-stringop-overflow
|
||||||
|
|
|
@ -6,6 +6,7 @@ SECTIONS {
|
||||||
.text : {
|
.text : {
|
||||||
*(.text._start);
|
*(.text._start);
|
||||||
KEEP(*(._boot_cfg));
|
KEEP(*(._boot_cfg));
|
||||||
|
KEEP(*(._ipl_version));
|
||||||
*(.text*);
|
*(.text*);
|
||||||
}
|
}
|
||||||
.data : {
|
.data : {
|
||||||
|
|
|
@ -30,6 +30,12 @@
|
||||||
#define IPL_PATCHED_RELOC_SZ 0x94
|
#define IPL_PATCHED_RELOC_SZ 0x94
|
||||||
|
|
||||||
boot_cfg_t __attribute__((section ("._boot_cfg"))) b_cfg;
|
boot_cfg_t __attribute__((section ("._boot_cfg"))) b_cfg;
|
||||||
|
const volatile ipl_ver_meta_t __attribute__((section ("._ipl_version"))) ipl_ver = {
|
||||||
|
.magic = LP_MAGIC,
|
||||||
|
.version = (LP_VER_MJ + '0') | ((LP_VER_MN + '0') << 8) | ((LP_VER_BF + '0') << 16),
|
||||||
|
.rsvd0 = 0,
|
||||||
|
.rsvd1 = 0
|
||||||
|
};
|
||||||
|
|
||||||
void loader_main()
|
void loader_main()
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,6 +6,7 @@ SECTIONS {
|
||||||
.text : {
|
.text : {
|
||||||
*(.text._start);
|
*(.text._start);
|
||||||
KEEP(*(._boot_cfg));
|
KEEP(*(._boot_cfg));
|
||||||
|
KEEP(*(._ipl_version));
|
||||||
*(.text._irq_setup);
|
*(.text._irq_setup);
|
||||||
*(.text*);
|
*(.text*);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,12 @@
|
||||||
|
|
||||||
hekate_config h_cfg;
|
hekate_config h_cfg;
|
||||||
boot_cfg_t __attribute__((section ("._boot_cfg"))) b_cfg;
|
boot_cfg_t __attribute__((section ("._boot_cfg"))) b_cfg;
|
||||||
|
const volatile ipl_ver_meta_t __attribute__((section ("._ipl_version"))) ipl_ver = {
|
||||||
|
.magic = LP_MAGIC,
|
||||||
|
.version = (LP_VER_MJ + '0') | ((LP_VER_MN + '0') << 8) | ((LP_VER_BF + '0') << 16),
|
||||||
|
.rsvd0 = 0,
|
||||||
|
.rsvd1 = 0
|
||||||
|
};
|
||||||
|
|
||||||
volatile nyx_storage_t *nyx_str = (nyx_storage_t *)NYX_STORAGE_ADDR;
|
volatile nyx_storage_t *nyx_str = (nyx_storage_t *)NYX_STORAGE_ADDR;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue