#include #define NAND_PAGE_SIZE 0x200 #define BOOT2_PAGE_OFFSET 0x20 static const unsigned read_nand_addrs[] = {0x101b5fa0, 0x101b7ad0}; // OS 1.3 #define read_nand SYSCALL_CUSTOM(read_nand_addrs,int, unsigned int, void * ) void errormsg(char *mesg){ char title[20]; char msg[150]; ascii2utf16(title, "Ndless", sizeof(title)); ascii2utf16(msg, mesg, sizeof(msg)); show_dialog_box2(0, title, msg); } int main(void) { char title[20]; char msg[150]; FILE *ifile; ifile = fopen("/documents/ndless/boot2.raw.tns", "rb"); if (!ifile) { errormsg("Can't open input file"); return 1; } if (fread((void *)0x11800000 , 1, 0x1A9B58, ifile) == 0) { fclose(ifile); errormsg("Can't read boot2 from input file"); return 1; } fclose(ifile); printf("Launching boot2\n"); unsigned intmask = TCT_Local_Control_Interrupts(0); asm( ".arm \n" "ldr pc, =0x11800000 @ jump to boot2\n" ); // ----- should not get here ---- ascii2utf16(title, "Ndless", sizeof(title)); ascii2utf16(msg, "Problem executing boot2", sizeof(msg)); show_dialog_box2(0, title, msg); return 0; }