It's not quite working yet. For some reason, screeninit causes a complete lockup.
That said, it does boot if:
* No background images are present
* Autoboot is on
* Silent mode is on
I'm aware this is currently broken. REPEAT. I am aware.
/external/Makefile
/include/Makefile
/boot/corbenik
+/boot/corbenik.firm
/bootstub/bootstub
/m4
/include/config.h
mkdir -p out@sysconfdir@
mkdir -p out@localstatedir@
cp boot/corbenik.bin out/arm9loaderhax.bin
+ cp boot/corbenik.firm out/boot.firm
cp boot/corbenik.bin out@libexecdir@/
cp boot/corbenik out/corbenik.elf
cp loader/loader.cxi out@libdir@/module/native/loader.cxi
corbenik.bin: corbenik
$(OBJCOPY) $(OCFLAGS) -O binary $< $@
+# XXX - Firmtool seems to incorrectly copy the elf's sections to the output, so we have to do this for now
corbenik.firm: corbenik.bin
- firmtool build $@ -n 0x23F00000 -e 0 -D $^ -A 0x23F00000 -C NDMA
+ firmtool build $@ -i -n 0x23F00000 -e 0 -D $^ -A 0x23F00000 -C NDMA
corbenikdir = $(top_srcdir)/source
struct framebuffers *framebuffers;
-volatile uint32_t *arm11Entry = (volatile uint32_t *)0x1FFFFFF8;
+volatile uint32_t *arm11Entry = (volatile uint32_t *)0x1FFFFFFC;
static const uint32_t brightness[4] = {0x26, 0x39, 0x4C, 0x5F};
-void __attribute__((naked)) arm11Stub(void)
-{
- //Disable interrupts
- __asm(".word 0xF10C01C0");
-
- //Wait for the entry to be set
- while(*arm11Entry == ARM11_STUB_ADDRESS);
-
- //Jump to it
- ((void (*)())*arm11Entry)();
-}
-
-void installArm11Stub(void) {
- static int hasCopiedStub = false;
- if(!hasCopiedStub)
- {
- memcpy((void *)ARM11_STUB_ADDRESS, arm11Stub, 0x30);
- ctr_cache_clean_and_flush_all();
- hasCopiedStub = true;
- }
-
- if (is_firmlaunch())
- arm11Entry = (volatile uint32_t*)0x1FFFFFFC;
-}
-
void invokeArm11Function(void (*func)())
{
installArm11Stub();
install_interrupts(); // Get some free debug info.
- installArm11Stub();
-
if (is_firmlaunch()) {
shut_up();
clear_disp(TOP_SCREEN);
clear_disp(BOTTOM_SCREEN);
}
+
menu_handler();
}
argv: .int 0
init:
+ // Disable IRQ
+ mrs r2, cpsr
+ orr r2, r2, #0x1C0
+ msr cpsr_c, r2
+
+ // Save argc, argv
ldr r2, =argc
str r0, [r2]
ldr r2, =argv
str r1, [r2]
- // Disable IRQ
- mrs r0, cpsr
- orr r0, r0, #0x80
- msr cpsr_c, r0
-
// Flush caches, make sure to sync memory with what's on the cache before
// turning off the MPU
adr r0, flush_all_caches_offset
// Enable caches, MPU, and itcm
mrc p15, 0, r0, c1, c0, 0 // read control register
orr r0, r0, #(1<<18) // - itcm enable
+ orr r0, r0, #(1<<13) // - alt exception vector enable
orr r0, r0, #(1<<12) // - instruction cache enable
orr r0, r0, #(1<<2) // - data cache enable
orr r0, r0, #(1<<0) // - mpu enable