mirror of
git://projects.qi-hardware.com/iris.git
synced 2025-04-21 12:27:27 +03:00
lists and bugfixes
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
start_load = 0x80600000
|
||||
start_load = 0x80400000
|
||||
load = 0x80000000
|
||||
# Uncomment one of these to select the boot method for the image.
|
||||
#UDC_BOOT = yes
|
||||
@@ -27,10 +27,11 @@ boot_sources = mips/init.cc mips/nanonote/board.cc
|
||||
arch_headers = mips/arch.hh mips/nanonote/jz4740.hh mips/nanonote/board.hh mips/nand.hh
|
||||
udc_boot_programs = udc
|
||||
sd_boot_programs = sd+mmc partition fat
|
||||
unbrick_boot_programs = nand usb-mass-storage
|
||||
unbrick_boot_programs = nand sd+mmc usb-mass-storage
|
||||
standard_boot_programs = bootinit
|
||||
|
||||
programs = init gpio lcd bsquare ball buzzer metronome elfrun alarm rtc gui test boot booter $(udc_boot_programs) $(sd_boot_programs) $(unbrick_boot_programs) $(standard_boot_programs)
|
||||
# use sort to remove duplicates.
|
||||
programs = $(sort init gpio lcd bsquare ball buzzer metronome elfrun alarm rtc gui test boot booter $(udc_boot_programs) $(sd_boot_programs) $(unbrick_boot_programs) $(standard_boot_programs))
|
||||
|
||||
ARCH_CPPFLAGS = -I. -Imips -Imips/nanonote -Wa,-mips32 -DNANONOTE -DUSE_SERIAL
|
||||
CROSS = mipsel-linux-gnu-
|
||||
@@ -56,7 +57,7 @@ iris-sd.tar: $(addprefix fs/,$(addsuffix .elf,$(programs))) mips/start.raw.gz fs
|
||||
cd fs && tar cvf ../$@ uimage init.config $(addsuffix .elf,$(programs)) --dereference
|
||||
else
|
||||
ifneq ($(UNBRICK),)
|
||||
boot_threads = $(standard_boot_programs) $(unbrick_boot_programs)
|
||||
boot_threads = $(standard_boot_programs) $(unbrick_boot_programs) sd+mmc
|
||||
ARCH_CXXFLAGS = -DNUM_THREADS=3
|
||||
BOOT_CPPFLAGS = -DUNBRICK
|
||||
all: mips/start.raw
|
||||
|
||||
@@ -23,10 +23,6 @@
|
||||
void board_init ():
|
||||
pll_init ()
|
||||
cpm_stop_all ()
|
||||
#ifndef NDEBUG
|
||||
cpm_start_uart0 ()
|
||||
gpio_as_uart0 ()
|
||||
#endif
|
||||
// Timer interrupts and buzzer.
|
||||
cpm_start_tcu ()
|
||||
// sdram memory.
|
||||
@@ -42,7 +38,7 @@ void board_init ():
|
||||
// buzzer.
|
||||
gpio_as_pwm4 ()
|
||||
// Set up memory.
|
||||
setup_sdram ()
|
||||
//setup_sdram ()
|
||||
// Use some gpio pins for lcd.
|
||||
gpio_as_gpio (2, (1 << 21) | (1 << 22) | (1 << 23))
|
||||
gpio_as_output (2, (1 << 21) | (1 << 22) | (1 << 23))
|
||||
@@ -66,20 +62,7 @@ void board_init ():
|
||||
tcu_unmask_full_match_irq (0)
|
||||
tcu_start_counter (0)
|
||||
#ifndef NDEBUG
|
||||
// Set up uart.
|
||||
UART0_IER = 0
|
||||
UART0_FCR = 0
|
||||
UART0_MCR = 0
|
||||
UART0_SIRCR = 0
|
||||
UART0_UACR = 0
|
||||
UART0_UMR = 16
|
||||
UART0_LCR = UARTLCR_WLEN_8 | UARTLCR_STOP1 | UARTLCR_DLAB
|
||||
unsigned const baud = 57600
|
||||
unsigned uart_div = 12000000 / 16 / baud
|
||||
UART0_DLHR = (uart_div >> 8) & 0xff
|
||||
UART0_DLLR = uart_div & 0xff
|
||||
UART0_LCR = UARTLCR_WLEN_8 | UARTLCR_STOP1
|
||||
UART0_FCR = UARTFCR_UUE | UARTFCR_FE | UARTFCR_RFLS | UARTFCR_TFLS
|
||||
setup_uart ()
|
||||
kdebug ("\n\nSerial port initialized\n")
|
||||
#endif
|
||||
|
||||
|
||||
@@ -3701,6 +3701,26 @@ static void setup_sdram ():
|
||||
dbg_log_num (EMC_RTCOR, 8)
|
||||
dbg_log ("\n")
|
||||
#endif
|
||||
|
||||
static void setup_uart ():
|
||||
#ifndef NDEBUG
|
||||
// Set up uart.
|
||||
cpm_start_uart0 ()
|
||||
gpio_as_uart0 ()
|
||||
UART0_IER = 0
|
||||
UART0_FCR = 0
|
||||
UART0_MCR = 0
|
||||
UART0_SIRCR = 0
|
||||
UART0_UACR = 0
|
||||
UART0_UMR = 16
|
||||
UART0_LCR = UARTLCR_WLEN_8 | UARTLCR_STOP1 | UARTLCR_DLAB
|
||||
unsigned const baud = 57600
|
||||
unsigned uart_div = 12000000 / 16 / baud
|
||||
UART0_DLHR = (uart_div >> 8) & 0xff
|
||||
UART0_DLLR = uart_div & 0xff
|
||||
UART0_LCR = UARTLCR_WLEN_8 | UARTLCR_STOP1
|
||||
UART0_FCR = UARTFCR_UUE | UARTFCR_FE | UARTFCR_RFLS | UARTFCR_TFLS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,16 +18,22 @@
|
||||
|
||||
// This runs like the kernel. In particular, it doesn't want userspace declarations.
|
||||
#define __KERNEL__
|
||||
#define dbg_log(x) do {} while (0)
|
||||
#define dbg_log_char(x) do {} while (0)
|
||||
#define dbg_log(x) do {} while (0)
|
||||
#define dbg_log_num(...) do {} while (0)
|
||||
|
||||
#include "jz4740.hh"
|
||||
|
||||
void kdebug (unsigned ch):
|
||||
while !(UART0_LSR & UARTLSR_TDRQ):
|
||||
UART0_TDR = ch
|
||||
while !(UART0_LSR & UARTLSR_TEMT):
|
||||
|
||||
asm volatile (".set noreorder\n"
|
||||
"\t.globl __start\n"
|
||||
"\t.text\n"
|
||||
"__start:\n"
|
||||
"\tla $sp, 0x80004000\n"
|
||||
"\tnop\n"
|
||||
"__hack_label:\n"
|
||||
"\tmove $a0, $ra\n"
|
||||
"\tbal 1f\n"
|
||||
@@ -35,6 +41,7 @@ asm volatile (".set noreorder\n"
|
||||
"\t.word _gp\n"
|
||||
"1:\n"
|
||||
"\tlw $gp, 0($ra)\n"
|
||||
"\tla $sp, stack + 0x100\n"
|
||||
"\tla $t9, start_cpp\n"
|
||||
"\tmove $ra, $a0\n"
|
||||
"\tjr $t9\n"
|
||||
@@ -43,7 +50,11 @@ asm volatile (".set noreorder\n"
|
||||
|
||||
extern "C":
|
||||
void start_cpp ()
|
||||
char stack[0x100]
|
||||
|
||||
void start_cpp ():
|
||||
setup_sdram ()
|
||||
//setup_uart ()
|
||||
//kdebug ('.')
|
||||
//setup_sdram ()
|
||||
//kdebug ('!')
|
||||
// everything is ok now: return to boot loader to load stage 2.
|
||||
|
||||
@@ -2,7 +2,7 @@ OUTPUT_ARCH(mips)
|
||||
ENTRY(__start)
|
||||
MEMORY
|
||||
{
|
||||
ram : ORIGIN = 0x80002000 , LENGTH = 0x100000
|
||||
ram : ORIGIN = 0x80002000 , LENGTH = 0x2000
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
|
||||
@@ -225,6 +225,7 @@ struct client : public shevek::server <client, data *>::connection:
|
||||
disconnect ()
|
||||
|
||||
void data::request (requests r, unsigned data):
|
||||
std::cerr << shevek::ostring ("requesting %08x with data %08x\n", r, data)
|
||||
if usb_control_msg (handle, USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, r, (data >> 16) & 0xffff, data & 0xffff, NULL, 0, timeout) < 0:
|
||||
std::cerr << "unable to send control message to NanoNote: " << usb_strerror () << ".\n"
|
||||
usb_release_interface (handle, 0)
|
||||
@@ -232,6 +233,7 @@ void data::request (requests r, unsigned data):
|
||||
handle = NULL
|
||||
|
||||
void data::send_file (unsigned address, unsigned size, char const *data):
|
||||
std::cerr << shevek::ostring ("setting data address to 0x%08x\n", address)
|
||||
request (VR_SET_DATA_ADDRESS, address)
|
||||
char const *ptr = data
|
||||
while ptr - data < size:
|
||||
@@ -292,7 +294,6 @@ void data::boot (std::string const &filename, unsigned load, unsigned entry):
|
||||
request (VR_PROGRAM_START1, STAGE1_ENTRY)
|
||||
usleep (100)
|
||||
std::ostringstream stage2
|
||||
usb_release_interface (handle, 0)
|
||||
file.close ()
|
||||
file.open (filename.c_str ())
|
||||
stage2 << file.rdbuf ()
|
||||
|
||||
@@ -74,7 +74,7 @@ thread0:
|
||||
|
||||
.balign 0x1000
|
||||
thread1:
|
||||
.incbin "fs/nand.elf"
|
||||
.incbin "fs/sd+mmc.elf"
|
||||
|
||||
.balign 0x1000
|
||||
thread2:
|
||||
|
||||
Reference in New Issue
Block a user