mirror of
https://github.com/CTCaer/hekate
synced 2024-11-16 00:49:27 +00:00
just use normal arm-none-eabi toolchain
This commit is contained in:
parent
c99ea77daf
commit
63184dcc95
11 changed files with 115 additions and 87 deletions
16
Makefile
16
Makefile
|
@ -1,8 +1,4 @@
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
include rules/dkarm_compat
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
include $(DEVKITARM)/base_rules
|
|
||||||
|
|
||||||
TARGET := hekate
|
TARGET := hekate
|
||||||
BLVERSION_MAJOR := 4
|
BLVERSION_MAJOR := 4
|
||||||
|
@ -54,11 +50,11 @@ OBJS += $(addprefix $(BUILD)/$(TARGET)/, \
|
||||||
elfload.o elfreloc_arm.o \
|
elfload.o elfreloc_arm.o \
|
||||||
)
|
)
|
||||||
|
|
||||||
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb -mthumb-interwork
|
CFLAGS += -mthumb
|
||||||
CUSTOMDEFINES := -DBLVERSIONMJ=$(BLVERSION_MAJOR) -DBLVERSIONMN=$(BLVERSION_MINOR)
|
LDFLAGS += -mthumb
|
||||||
CUSTOMDEFINES += -DMENU_LOGO_ENABLE #-DDEBUG
|
CFLAGS += -DBLVERSIONMJ=$(BLVERSION_MAJOR) -DBLVERSIONMN=$(BLVERSION_MINOR)
|
||||||
CFLAGS = $(ARCH) -O2 -nostdlib -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-inline -std=gnu11 -Wall $(CUSTOMDEFINES)
|
CFLAGS += -DMENU_LOGO_ENABLE
|
||||||
LDFLAGS = $(ARCH) -nostartfiles -lgcc -Wl,--nmagic,--gc-sections
|
#CFLAGS += -DDEBUG
|
||||||
|
|
||||||
MODULEDIRS := $(wildcard modules/*)
|
MODULEDIRS := $(wildcard modules/*)
|
||||||
|
|
||||||
|
|
|
@ -752,7 +752,7 @@ const char* pkg2_patch_kips(link_t *info, char* patchNames)
|
||||||
if (!se_calc_sha256(shaBuf, ki->kip1, ki->size))
|
if (!se_calc_sha256(shaBuf, ki->kip1, ki->size))
|
||||||
memset(shaBuf, 0, sizeof(shaBuf));
|
memset(shaBuf, 0, sizeof(shaBuf));
|
||||||
|
|
||||||
DPRINTF("%dms %s KIP1 size %d hash %08X\n", (postDecompTime-preDecompTime)/1000, ki->kip1->name, (int)ki->size, __builtin_bswap32(shaBuf[0]));
|
DPRINTF("%dms %s KIP1 size %d hash %08X\n", (postDecompTime-preDecompTime)/1000, ki->kip1->name, (int)ki->size, byte_swap_32(shaBuf[0]));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
currPatchset = _kip_ids[currKipIdx].patchset;
|
currPatchset = _kip_ids[currKipIdx].patchset;
|
||||||
|
@ -852,6 +852,7 @@ DPRINTF("sec %d has size %08X\n", i, hdr->sec_size[i]);
|
||||||
void pkg2_build_encrypt(void *dst, void *kernel, u32 kernel_size, link_t *kips_info)
|
void pkg2_build_encrypt(void *dst, void *kernel, u32 kernel_size, link_t *kips_info)
|
||||||
{
|
{
|
||||||
u8 *pdst = (u8 *)dst;
|
u8 *pdst = (u8 *)dst;
|
||||||
|
u32 ctr;
|
||||||
|
|
||||||
// Signature.
|
// Signature.
|
||||||
memset(pdst, 0, 0x100);
|
memset(pdst, 0, 0x100);
|
||||||
|
@ -894,9 +895,10 @@ DPRINTF("adding kip1 '%s' @ %08X (%08X)\n", ki->kip1->name, (u32)ki->kip1, ki->s
|
||||||
DPRINTF("INI1 encrypted\n");
|
DPRINTF("INI1 encrypted\n");
|
||||||
|
|
||||||
//Encrypt header.
|
//Encrypt header.
|
||||||
*(u32 *)hdr->ctr = 0x100 + sizeof(pkg2_hdr_t) + kernel_size + ini1_size;
|
ctr = 0x100 + sizeof(pkg2_hdr_t) + kernel_size + ini1_size;
|
||||||
|
memcpy(hdr->ctr, &ctr, sizeof(ctr));
|
||||||
se_aes_crypt_ctr(8, hdr, sizeof(pkg2_hdr_t), hdr, sizeof(pkg2_hdr_t), hdr);
|
se_aes_crypt_ctr(8, hdr, sizeof(pkg2_hdr_t), hdr, sizeof(pkg2_hdr_t), hdr);
|
||||||
memset(hdr->ctr, 0 , 0x10);
|
memset(hdr->ctr, 0 , 0x10);
|
||||||
*(u32 *)hdr->ctr = 0x100 + sizeof(pkg2_hdr_t) + kernel_size + ini1_size;
|
memcpy(hdr->ctr, &ctr, sizeof(ctr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "../utils/util.h"
|
#include "../utils/util.h"
|
||||||
#include "../storage/sdmmc.h"
|
#include "../storage/sdmmc.h"
|
||||||
|
|
||||||
static const clock_t _clock_uart[] = {
|
static const clk_desc_t _clock_uart[] = {
|
||||||
/* UART A */ { CLK_RST_CONTROLLER_RST_DEVICES_L, CLK_RST_CONTROLLER_CLK_OUT_ENB_L, CLK_RST_CONTROLLER_CLK_SOURCE_UARTA, 6, 0, 0 },
|
/* UART A */ { CLK_RST_CONTROLLER_RST_DEVICES_L, CLK_RST_CONTROLLER_CLK_OUT_ENB_L, CLK_RST_CONTROLLER_CLK_SOURCE_UARTA, 6, 0, 0 },
|
||||||
/* UART B */ { CLK_RST_CONTROLLER_RST_DEVICES_L, CLK_RST_CONTROLLER_CLK_OUT_ENB_L, CLK_RST_CONTROLLER_CLK_SOURCE_UARTB, 7, 0, 0 },
|
/* UART B */ { CLK_RST_CONTROLLER_RST_DEVICES_L, CLK_RST_CONTROLLER_CLK_OUT_ENB_L, CLK_RST_CONTROLLER_CLK_SOURCE_UARTB, 7, 0, 0 },
|
||||||
/* UART C */ { CLK_RST_CONTROLLER_RST_DEVICES_H, CLK_RST_CONTROLLER_CLK_OUT_ENB_H, CLK_RST_CONTROLLER_CLK_SOURCE_UARTC, 0x17, 0, 0 },
|
/* UART C */ { CLK_RST_CONTROLLER_RST_DEVICES_H, CLK_RST_CONTROLLER_CLK_OUT_ENB_H, CLK_RST_CONTROLLER_CLK_SOURCE_UARTC, 0x17, 0, 0 },
|
||||||
|
@ -27,7 +27,7 @@ static const clock_t _clock_uart[] = {
|
||||||
/* UART E */ { 0 }
|
/* UART E */ { 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const clock_t _clock_i2c[] = {
|
static const clk_desc_t _clock_i2c[] = {
|
||||||
/* I2C1 */ { CLK_RST_CONTROLLER_RST_DEVICES_L, CLK_RST_CONTROLLER_CLK_OUT_ENB_L, CLK_RST_CONTROLLER_CLK_SOURCE_I2C1, 0xC, 6, 0 },
|
/* I2C1 */ { CLK_RST_CONTROLLER_RST_DEVICES_L, CLK_RST_CONTROLLER_CLK_OUT_ENB_L, CLK_RST_CONTROLLER_CLK_SOURCE_I2C1, 0xC, 6, 0 },
|
||||||
/* I2C2 */ { 0 },
|
/* I2C2 */ { 0 },
|
||||||
/* I2C3 */ { 0 },
|
/* I2C3 */ { 0 },
|
||||||
|
@ -36,22 +36,22 @@ static const clock_t _clock_i2c[] = {
|
||||||
/* I2C6 */ { 0 }
|
/* I2C6 */ { 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static clock_t _clock_se = { CLK_RST_CONTROLLER_RST_DEVICES_V, CLK_RST_CONTROLLER_CLK_OUT_ENB_V, CLK_RST_CONTROLLER_CLK_SOURCE_SE, 0x1F, 0, 0 };
|
static clk_desc_t _clock_se = { CLK_RST_CONTROLLER_RST_DEVICES_V, CLK_RST_CONTROLLER_CLK_OUT_ENB_V, CLK_RST_CONTROLLER_CLK_SOURCE_SE, 0x1F, 0, 0 };
|
||||||
static clock_t _clock_unk2 = { CLK_RST_CONTROLLER_RST_DEVICES_V, CLK_RST_CONTROLLER_CLK_OUT_ENB_V, CLK_RST_CONTROLLER_RST_SOURCE, 0x1E, 0, 0 };
|
static clk_desc_t _clock_unk2 = { CLK_RST_CONTROLLER_RST_DEVICES_V, CLK_RST_CONTROLLER_CLK_OUT_ENB_V, CLK_RST_CONTROLLER_RST_SOURCE, 0x1E, 0, 0 };
|
||||||
|
|
||||||
static clock_t _clock_host1x = { CLK_RST_CONTROLLER_RST_DEVICES_L, CLK_RST_CONTROLLER_CLK_OUT_ENB_L, CLK_RST_CONTROLLER_CLK_SOURCE_HOST1X, 0x1C, 4, 3 };
|
static clk_desc_t _clock_host1x = { CLK_RST_CONTROLLER_RST_DEVICES_L, CLK_RST_CONTROLLER_CLK_OUT_ENB_L, CLK_RST_CONTROLLER_CLK_SOURCE_HOST1X, 0x1C, 4, 3 };
|
||||||
static clock_t _clock_tsec = { CLK_RST_CONTROLLER_RST_DEVICES_U, CLK_RST_CONTROLLER_CLK_OUT_ENB_U, CLK_RST_CONTROLLER_CLK_SOURCE_TSEC, 0x13, 0, 2 };
|
static clk_desc_t _clk_desc_tsec = { CLK_RST_CONTROLLER_RST_DEVICES_U, CLK_RST_CONTROLLER_CLK_OUT_ENB_U, CLK_RST_CONTROLLER_CLK_SOURCE_TSEC, 0x13, 0, 2 };
|
||||||
static clock_t _clock_sor_safe = { CLK_RST_CONTROLLER_RST_DEVICES_Y, CLK_RST_CONTROLLER_CLK_OUT_ENB_Y, CLK_RST_CONTROLLER_RST_SOURCE, 0x1E, 0, 0 };
|
static clk_desc_t _clock_sor_safe = { CLK_RST_CONTROLLER_RST_DEVICES_Y, CLK_RST_CONTROLLER_CLK_OUT_ENB_Y, CLK_RST_CONTROLLER_RST_SOURCE, 0x1E, 0, 0 };
|
||||||
static clock_t _clock_sor0 = { CLK_RST_CONTROLLER_RST_DEVICES_X, CLK_RST_CONTROLLER_CLK_OUT_ENB_X, CLK_RST_CONTROLLER_RST_SOURCE, 0x16, 0, 0 };
|
static clk_desc_t _clock_sor0 = { CLK_RST_CONTROLLER_RST_DEVICES_X, CLK_RST_CONTROLLER_CLK_OUT_ENB_X, CLK_RST_CONTROLLER_RST_SOURCE, 0x16, 0, 0 };
|
||||||
static clock_t _clock_sor1 = { CLK_RST_CONTROLLER_RST_DEVICES_X, CLK_RST_CONTROLLER_CLK_OUT_ENB_X, CLK_RST_CONTROLLER_CLK_SOURCE_SOR1, 0x17, 0, 2 };
|
static clk_desc_t _clock_sor1 = { CLK_RST_CONTROLLER_RST_DEVICES_X, CLK_RST_CONTROLLER_CLK_OUT_ENB_X, CLK_RST_CONTROLLER_CLK_SOURCE_SOR1, 0x17, 0, 2 };
|
||||||
static clock_t _clock_kfuse = { CLK_RST_CONTROLLER_RST_DEVICES_H, CLK_RST_CONTROLLER_CLK_OUT_ENB_H, CLK_RST_CONTROLLER_RST_SOURCE, 8, 0, 0 };
|
static clk_desc_t _clock_kfuse = { CLK_RST_CONTROLLER_RST_DEVICES_H, CLK_RST_CONTROLLER_CLK_OUT_ENB_H, CLK_RST_CONTROLLER_RST_SOURCE, 8, 0, 0 };
|
||||||
|
|
||||||
static clock_t _clock_cl_dvfs = { CLK_RST_CONTROLLER_RST_DEVICES_W, CLK_RST_CONTROLLER_CLK_OUT_ENB_W, CLK_RST_CONTROLLER_RST_SOURCE, 0x1B, 0, 0 };
|
static clk_desc_t _clock_cl_dvfs = { CLK_RST_CONTROLLER_RST_DEVICES_W, CLK_RST_CONTROLLER_CLK_OUT_ENB_W, CLK_RST_CONTROLLER_RST_SOURCE, 0x1B, 0, 0 };
|
||||||
static clock_t _clock_coresight = { CLK_RST_CONTROLLER_RST_DEVICES_U, CLK_RST_CONTROLLER_CLK_OUT_ENB_U, CLK_RST_CONTROLLER_CLK_SOURCE_CSITE, 9, 0, 4};
|
static clk_desc_t _clock_coresight = { CLK_RST_CONTROLLER_RST_DEVICES_U, CLK_RST_CONTROLLER_CLK_OUT_ENB_U, CLK_RST_CONTROLLER_CLK_SOURCE_CSITE, 9, 0, 4};
|
||||||
|
|
||||||
static clock_t _clock_pwm = { CLK_RST_CONTROLLER_RST_DEVICES_L, CLK_RST_CONTROLLER_CLK_OUT_ENB_L, CLK_RST_CONTROLLER_CLK_SOURCE_PWM, 0x11, 6, 4};
|
static clk_desc_t _clock_pwm = { CLK_RST_CONTROLLER_RST_DEVICES_L, CLK_RST_CONTROLLER_CLK_OUT_ENB_L, CLK_RST_CONTROLLER_CLK_SOURCE_PWM, 0x11, 6, 4};
|
||||||
|
|
||||||
void clock_enable(const clock_t *clk)
|
void clock_enable(const clk_desc_t *clk)
|
||||||
{
|
{
|
||||||
// Put clock into reset.
|
// Put clock into reset.
|
||||||
CLOCK(clk->reset) = (CLOCK(clk->reset) & ~(1 << clk->index)) | (1 << clk->index);
|
CLOCK(clk->reset) = (CLOCK(clk->reset) & ~(1 << clk->index)) | (1 << clk->index);
|
||||||
|
@ -66,7 +66,7 @@ void clock_enable(const clock_t *clk)
|
||||||
CLOCK(clk->reset) &= ~(1 << clk->index);
|
CLOCK(clk->reset) &= ~(1 << clk->index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clock_disable(const clock_t *clk)
|
void clock_disable(const clk_desc_t *clk)
|
||||||
{
|
{
|
||||||
// Put clock into reset.
|
// Put clock into reset.
|
||||||
CLOCK(clk->reset) = (CLOCK(clk->reset) & ~(1 << clk->index)) | (1 << clk->index);
|
CLOCK(clk->reset) = (CLOCK(clk->reset) & ~(1 << clk->index)) | (1 << clk->index);
|
||||||
|
@ -116,12 +116,12 @@ void clock_disable_host1x()
|
||||||
|
|
||||||
void clock_enable_tsec()
|
void clock_enable_tsec()
|
||||||
{
|
{
|
||||||
clock_enable(&_clock_tsec);
|
clock_enable(&_clk_desc_tsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clock_disable_tsec()
|
void clock_disable_tsec()
|
||||||
{
|
{
|
||||||
clock_disable(&_clock_tsec);
|
clock_disable(&_clk_desc_tsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clock_enable_sor_safe()
|
void clock_enable_sor_safe()
|
||||||
|
|
|
@ -117,7 +117,7 @@
|
||||||
#define CLK_RST_CONTROLLER_SE_SUPER_CLK_DIVIDER 0x704
|
#define CLK_RST_CONTROLLER_SE_SUPER_CLK_DIVIDER 0x704
|
||||||
|
|
||||||
/*! Generic clock descriptor. */
|
/*! Generic clock descriptor. */
|
||||||
typedef struct _clock_t
|
typedef struct _clk_desc_t
|
||||||
{
|
{
|
||||||
u32 reset;
|
u32 reset;
|
||||||
u32 enable;
|
u32 enable;
|
||||||
|
@ -125,11 +125,11 @@ typedef struct _clock_t
|
||||||
u8 index;
|
u8 index;
|
||||||
u8 clk_src;
|
u8 clk_src;
|
||||||
u8 clk_div;
|
u8 clk_div;
|
||||||
} clock_t;
|
} clk_desc_t;
|
||||||
|
|
||||||
/*! Generic clock enable/disable. */
|
/*! Generic clock enable/disable. */
|
||||||
void clock_enable(const clock_t *clk);
|
void clock_enable(const clk_desc_t *clk);
|
||||||
void clock_disable(const clock_t *clk);
|
void clock_disable(const clk_desc_t *clk);
|
||||||
|
|
||||||
/*! Clock control for specific hardware portions. */
|
/*! Clock control for specific hardware portions. */
|
||||||
void clock_enable_fuse(bool enable);
|
void clock_enable_fuse(bool enable);
|
||||||
|
|
|
@ -676,8 +676,8 @@ static void _sd_storage_parse_scr(sdmmc_storage_t *storage)
|
||||||
// unstuff_bits can parse only 4 u32
|
// unstuff_bits can parse only 4 u32
|
||||||
u32 resp[4];
|
u32 resp[4];
|
||||||
|
|
||||||
resp[3] = *(u32 *)&storage->raw_scr[4];
|
resp[3] = storage->raw_scr[1];
|
||||||
resp[2] = *(u32 *)&storage->raw_scr[0];
|
resp[2] = storage->raw_scr[0];
|
||||||
|
|
||||||
storage->scr.sda_vsn = unstuff_bits(resp, 56, 4);
|
storage->scr.sda_vsn = unstuff_bits(resp, 56, 4);
|
||||||
storage->scr.bus_widths = unstuff_bits(resp, 48, 4);
|
storage->scr.bus_widths = unstuff_bits(resp, 48, 4);
|
||||||
|
@ -707,15 +707,10 @@ int _sd_storage_get_scr(sdmmc_storage_t *storage, u8 *buf)
|
||||||
u32 tmp = 0;
|
u32 tmp = 0;
|
||||||
sdmmc_get_rsp(storage->sdmmc, &tmp, 4, SDMMC_RSP_TYPE_1);
|
sdmmc_get_rsp(storage->sdmmc, &tmp, 4, SDMMC_RSP_TYPE_1);
|
||||||
//Prepare buffer for unstuff_bits
|
//Prepare buffer for unstuff_bits
|
||||||
for (int i = 0; i < 8; i+=4)
|
for (int i = 0; i < 2; i++)
|
||||||
{
|
storage->raw_scr[i] = byte_swap_32(*(u32 *)&buf[i * sizeof(u32)]);
|
||||||
storage->raw_scr[i + 3] = buf[i];
|
|
||||||
storage->raw_scr[i + 2] = buf[i + 1];
|
|
||||||
storage->raw_scr[i + 1] = buf[i + 2];
|
|
||||||
storage->raw_scr[i] = buf[i + 3];
|
|
||||||
}
|
|
||||||
_sd_storage_parse_scr(storage);
|
_sd_storage_parse_scr(storage);
|
||||||
//gfx_hexdump(&gfx_con, 0, storage->raw_scr, 8);
|
//gfx_hexdump(&gfx_con, 0, storage->raw_scr, sizeof(storage->raw_scr));
|
||||||
|
|
||||||
return _sdmmc_storage_check_result(tmp);
|
return _sdmmc_storage_check_result(tmp);
|
||||||
}
|
}
|
||||||
|
@ -894,15 +889,15 @@ static void _sd_storage_parse_ssr(sdmmc_storage_t *storage)
|
||||||
u32 raw_ssr1[4];
|
u32 raw_ssr1[4];
|
||||||
u32 raw_ssr2[4];
|
u32 raw_ssr2[4];
|
||||||
|
|
||||||
raw_ssr1[3] = *(u32 *)&storage->raw_ssr[12];
|
raw_ssr1[3] = storage->raw_ssr[3];
|
||||||
raw_ssr1[2] = *(u32 *)&storage->raw_ssr[8];
|
raw_ssr1[2] = storage->raw_ssr[2];
|
||||||
raw_ssr1[1] = *(u32 *)&storage->raw_ssr[4];
|
raw_ssr1[1] = storage->raw_ssr[1];
|
||||||
raw_ssr1[0] = *(u32 *)&storage->raw_ssr[0];
|
raw_ssr1[0] = storage->raw_ssr[0];
|
||||||
|
|
||||||
raw_ssr2[3] = *(u32 *)&storage->raw_ssr[28];
|
raw_ssr2[3] = storage->raw_ssr[7];
|
||||||
raw_ssr2[2] = *(u32 *)&storage->raw_ssr[24];
|
raw_ssr2[2] = storage->raw_ssr[6];
|
||||||
raw_ssr2[1] = *(u32 *)&storage->raw_ssr[20];
|
raw_ssr2[1] = storage->raw_ssr[5];
|
||||||
raw_ssr2[0] = *(u32 *)&storage->raw_ssr[16];
|
raw_ssr2[0] = storage->raw_ssr[4];
|
||||||
|
|
||||||
storage->ssr.bus_width = (unstuff_bits(raw_ssr1, 510 - 384, 2) & SD_BUS_WIDTH_4) ? 4 : 1;
|
storage->ssr.bus_width = (unstuff_bits(raw_ssr1, 510 - 384, 2) & SD_BUS_WIDTH_4) ? 4 : 1;
|
||||||
switch(unstuff_bits(raw_ssr1, 440 - 384, 8))
|
switch(unstuff_bits(raw_ssr1, 440 - 384, 8))
|
||||||
|
@ -957,15 +952,10 @@ static int _sd_storage_get_ssr(sdmmc_storage_t *storage, u8 *buf)
|
||||||
u32 tmp = 0;
|
u32 tmp = 0;
|
||||||
sdmmc_get_rsp(storage->sdmmc, &tmp, 4, SDMMC_RSP_TYPE_1);
|
sdmmc_get_rsp(storage->sdmmc, &tmp, 4, SDMMC_RSP_TYPE_1);
|
||||||
//Prepare buffer for unstuff_bits
|
//Prepare buffer for unstuff_bits
|
||||||
for (int i = 0; i < 64; i+=4)
|
for (int i = 0; i < 0x10; i++)
|
||||||
{
|
storage->raw_ssr[i] = byte_swap_32(*(u32 *)&buf[i * sizeof(u32)]);
|
||||||
storage->raw_ssr[i + 3] = buf[i];
|
|
||||||
storage->raw_ssr[i + 2] = buf[i + 1];
|
|
||||||
storage->raw_ssr[i + 1] = buf[i + 2];
|
|
||||||
storage->raw_ssr[i] = buf[i + 3];
|
|
||||||
}
|
|
||||||
_sd_storage_parse_ssr(storage);
|
_sd_storage_parse_ssr(storage);
|
||||||
//gfx_hexdump(&gfx_con, 0, storage->raw_ssr, 64);
|
//gfx_hexdump(&gfx_con, 0, storage->raw_ssr, sizeof(storage->raw_ssr));
|
||||||
|
|
||||||
return _sdmmc_storage_check_result(tmp);
|
return _sdmmc_storage_check_result(tmp);
|
||||||
}
|
}
|
||||||
|
@ -1090,7 +1080,7 @@ int sdmmc_storage_init_sd(sdmmc_storage_t *storage, sdmmc_t *sdmmc, u32 id, u32
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//gfx_hexdump(&gfx_con, 0, storage->raw_scr, 8);
|
//gfx_hexdump(&gfx_con, 0, storage->raw_scr, sizeof(storage->raw_scr));
|
||||||
DPRINTF("[SD] got scr\n");
|
DPRINTF("[SD] got scr\n");
|
||||||
|
|
||||||
// Check if card supports a wider bus and if it's not SD Version 1.X
|
// Check if card supports a wider bus and if it's not SD Version 1.X
|
||||||
|
|
|
@ -93,8 +93,8 @@ typedef struct _sdmmc_storage_t
|
||||||
u32 partition;
|
u32 partition;
|
||||||
u8 raw_cid[0x10];
|
u8 raw_cid[0x10];
|
||||||
u8 raw_csd[0x10];
|
u8 raw_csd[0x10];
|
||||||
u8 raw_scr[8];
|
u32 raw_scr[2];
|
||||||
u8 raw_ssr[0x40];
|
u32 raw_ssr[16];
|
||||||
mmc_cid_t cid;
|
mmc_cid_t cid;
|
||||||
mmc_csd_t csd;
|
mmc_csd_t csd;
|
||||||
mmc_ext_csd_t ext_csd;
|
mmc_ext_csd_t ext_csd;
|
||||||
|
|
|
@ -96,3 +96,34 @@ u32 memcmp32sparse(const u32 *buf1, const u32 *buf2, u32 len)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *itoa(int value, char *str, int base)
|
||||||
|
{
|
||||||
|
char *p = str;
|
||||||
|
const char lut[] = "0123456789abcdef";
|
||||||
|
bool negative = false;
|
||||||
|
|
||||||
|
if (base < 2 || base > 16)
|
||||||
|
{
|
||||||
|
*p = '\0';
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value < 0)
|
||||||
|
{
|
||||||
|
value = -value;
|
||||||
|
negative = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (negative)
|
||||||
|
p++;
|
||||||
|
for (int v = value; v; v /= base)
|
||||||
|
p++;
|
||||||
|
*p-- = '\0';
|
||||||
|
for (int v = value; v; v /= base)
|
||||||
|
*p-- = lut[v % base];
|
||||||
|
if (negative)
|
||||||
|
*p-- = '-';
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
|
@ -20,8 +20,7 @@
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
#define byte_swap_32(num) ((num >> 24) & 0xff) | ((num << 8) & 0xff0000) | \
|
#define byte_swap_32(val) __builtin_bswap32(val)
|
||||||
((num >> 8 )& 0xff00) | ((num << 24) & 0xff000000)
|
|
||||||
|
|
||||||
typedef struct _cfg_op_t
|
typedef struct _cfg_op_t
|
||||||
{
|
{
|
||||||
|
@ -41,4 +40,6 @@ u32 crc32c(const void *buf, u32 len);
|
||||||
/* every 128 Bytes block. Intented only for Backup and Restore */
|
/* every 128 Bytes block. Intented only for Backup and Restore */
|
||||||
u32 memcmp32sparse(const u32 *buf1, const u32 *buf2, u32 len);
|
u32 memcmp32sparse(const u32 *buf1, const u32 *buf2, u32 len);
|
||||||
|
|
||||||
|
char *itoa(int value, char *str, int base);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
include ../../rules/dkarm_compat
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
include $(DEVKITARM)/base_rules
|
|
||||||
|
|
||||||
TARGET := libsys_lp0
|
TARGET := libsys_lp0
|
||||||
BUILD := ../../build/$(TARGET)
|
BUILD := ../../build/$(TARGET)
|
||||||
|
@ -13,19 +9,15 @@ OBJS = $(addprefix $(BUILD)/,\
|
||||||
sys_sdramlp0.o \
|
sys_sdramlp0.o \
|
||||||
)
|
)
|
||||||
|
|
||||||
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb-interwork
|
|
||||||
CFLAGS = $(ARCH) -O2 -nostdlib -fpie -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-inline -std=gnu11 -Wall $(CUSTOMDEFINES)
|
|
||||||
LDFLAGS = $(ARCH) -fpie -pie -nostartfiles -lgcc
|
|
||||||
|
|
||||||
.PHONY: clean all
|
.PHONY: clean all
|
||||||
|
|
||||||
all: $(TARGET).bso
|
all: $(TARGET).bso
|
||||||
$(BUILD)/%.o: ./%.c
|
$(BUILD)/%.o: ./%.c
|
||||||
@mkdir -p "$(BUILD)"
|
@mkdir -p "$(BUILD)"
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(SO_CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
$(TARGET).bso: $(OBJS)
|
$(TARGET).bso: $(OBJS)
|
||||||
$(CC) $(LDFLAGS) -e _modInit $^ -o $(OUTPUT)/$(TARGET).bso
|
$(CC) $(SO_LDFLAGS) -e _modInit $^ -o $(OUTPUT)/$(TARGET).bso
|
||||||
$(STRIP) -g $(OUTPUT)/$(TARGET).bso
|
$(STRIP) -g $(OUTPUT)/$(TARGET).bso
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
include ../../rules/dkarm_compat
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
include $(DEVKITARM)/base_rules
|
|
||||||
|
|
||||||
TARGET := module_sample
|
TARGET := module_sample
|
||||||
BUILD := ../../build/$(TARGET)
|
BUILD := ../../build/$(TARGET)
|
||||||
|
@ -14,19 +10,15 @@ OBJS = $(addprefix $(BUILD)/,\
|
||||||
gfx.o \
|
gfx.o \
|
||||||
)
|
)
|
||||||
|
|
||||||
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb-interwork
|
|
||||||
CFLAGS = $(ARCH) -O2 -nostdlib -fpie -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-inline -std=gnu11 -Wall $(CUSTOMDEFINES)
|
|
||||||
LDFLAGS = $(ARCH) -fpie -pie -nostartfiles -lgcc
|
|
||||||
|
|
||||||
.PHONY: clean all
|
.PHONY: clean all
|
||||||
|
|
||||||
all: $(TARGET).bso
|
all: $(TARGET).bso
|
||||||
$(BUILD)/%.o: ./%.c
|
$(BUILD)/%.o: ./%.c
|
||||||
@mkdir -p "$(BUILD)"
|
@mkdir -p "$(BUILD)"
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(SO_CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
$(TARGET).bso: $(OBJS)
|
$(TARGET).bso: $(OBJS)
|
||||||
$(CC) $(LDFLAGS) -e _modInit $^ -o $(OUTPUT)/$(TARGET).bso
|
$(CC) $(SO_LDFLAGS) -e _modInit $^ -o $(OUTPUT)/$(TARGET).bso
|
||||||
$(STRIP) -g $(OUTPUT)/$(TARGET).bso
|
$(STRIP) -g $(OUTPUT)/$(TARGET).bso
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
24
rules/dkarm_compat
Normal file
24
rules/dkarm_compat
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
ifneq ($(strip $(DEVKITARM)),)
|
||||||
|
|
||||||
|
include $(DEVKITARM)/base_rules
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
PREFIX := arm-none-eabi-
|
||||||
|
export CC := $(PREFIX)gcc
|
||||||
|
export CXX := $(PREFIX)g++
|
||||||
|
export AS := $(PREFIX)as
|
||||||
|
export AR := $(PREFIX)gcc-ar
|
||||||
|
export OBJCOPY := $(PREFIX)objcopy
|
||||||
|
export STRIP := $(PREFIX)strip
|
||||||
|
export NM := $(PREFIX)gcc-nm
|
||||||
|
export RANLIB := $(PREFIX)gcc-ranlib
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb-interwork
|
||||||
|
CFLAGS = $(ARCH) -Os -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-inline -std=gnu11 -Wall
|
||||||
|
LDFLAGS = $(ARCH) -nostartfiles -Wl,--nmagic,--gc-sections
|
||||||
|
|
||||||
|
SO_CFLAGS = $(CFLAGS) -fpie -marm
|
||||||
|
SO_LDFLAGS = $(LDFLAGS) -fpie -pie -marm
|
Loading…
Reference in a new issue