Added actual loading. code does not execute

This commit is contained in:
Morten Delenk 2016-07-16 20:21:48 +02:00
parent 95e15ef4fd
commit 63df2d3303
8 changed files with 32 additions and 4 deletions

BIN
arm9loaderhax.bin Executable file

Binary file not shown.

BIN
arm9loaderhax.elf Executable file

Binary file not shown.

BIN
example.bin Executable file

Binary file not shown.

6
example.c Normal file
View file

@ -0,0 +1,6 @@
void init() {
unsigned char *lfb=(unsigned char*)0x18300000;
for(int i=500;i<1000;i++)
lfb[i]=0xFF; //Output simple message
for(;;);
}

BIN
example.elf Executable file

Binary file not shown.

11
example.ld Normal file
View file

@ -0,0 +1,11 @@
ENTRY(_start)
SECTIONS
{
. = 0x8000000 ;
.text.start : { *(.text.start)}
.text : {*(.text)}
.data : {*(.data)}
.bss : {*(.bss COMMON)}
.rodata : {*(.rodata)}
. = ALIGN(4);
}

BIN
firm.bin Normal file

Binary file not shown.

View file

@ -45,10 +45,21 @@ void main() {
struct FIRM_header firm;
sdmmc_sdcard_readsectors(drive.partition[3].start,1, (u8*)&firm);
char* magic="FIRM";
for(int i=0;i<4;i++)
if(magic[i]!=firm.magic[i])
return; //Check magic
for(;;); //Deadlock if checksum's right. for debugging
for(int i=0;i<4;i++) {
if(magic[i]!=firm.magic[i]) {
return; //Check magic
}
}
//Load segments into memory
int i;
for(i=0;i<4;i++) {
u32 startsector=firm.sections[i].offset/512;
u32 length=firm.sections[i].size/512+1;
u8* buf=(u8*)firm.sections[i].physical;
sdmmc_sdcard_readsectors(startsector,length,buf);
}
*((u32*)0x1FFFFFF8)=firm.arm11Entry;
((void(*)())firm.arm9Entry)(); //Kill me
}
}
void init() {