#pypp 0 // Iris: micro-kernel for a capability-based operating system. // mips/nanonote/sdram-setup.ccp: bootstrapping over usb. // Copyright 2009 Bas Wijnen // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . // This runs like the kernel. In particular, it doesn't want userspace declarations. #define __KERNEL__ #define dbg_log_char(x) do {} while (0) #define dbg_log(x) do {} while (0) #define dbg_log_num(...) do {} while (0) // Set up gp and sp, jump to start_cpp(). // This must be the first code in the file, // so also before include jz4740.hh, // because that defines some static functions which may not be inlined. asm volatile (".set noreorder\n" ".globl __start\n" ".text\n" "__start:\n" "\tnop\n" "__hack_label:\n" "\tmove $k0, $ra\n" "\tbal 1f\n" "\tnop\n" "\t.word _gp\n" "1:\n" "\tlw $gp, 0($ra)\n" "\tla $sp, stack + 0x100\n" "\tla $t9, start_cpp\n" "\tmove $ra, $k0\n" "\tjr $t9\n" "\tnop\n" ".set reorder") #include "jz4740.hh" void kdebug (unsigned ch): while !(UART0_LSR & UARTLSR_TDRQ): UART0_TDR = ch while !(UART0_LSR & UARTLSR_TEMT): extern "C": void start_cpp () char stack[0x100] void start_cpp (): setup_uart () kdebug ('.') setup_sdram () kdebug ('!') // everything is ok now: return to boot loader to load stage 2.