1
0
mirror of git://projects.qi-hardware.com/iris.git synced 2024-06-28 17:45:07 +03:00

update things to work with new compiler and sdram chip

This commit is contained in:
Bas Wijnen 2012-01-14 18:17:23 +01:00
parent f4cac9b3a5
commit 538b9b9361
9 changed files with 54 additions and 67 deletions

View File

@ -13,11 +13,11 @@
receive driver_gpio / Event = sdmmc_gpio
sysreq sysreq
driver driver_nand = "nand.elf"
receive driver_nand / WBlock = nand
#driver driver_nand = "nand.elf"
#receive driver_nand / WBlock = nand
driver driver_ums = "usb-mass-storage.elf"
give driver_ums / WBlock = nand
#driver driver_ums = "usb-mass-storage.elf"
#give driver_ums / WBlock = nand
#driver driver_boot = "boot.elf"
#receive driver_boot / Boot = boot
@ -27,22 +27,22 @@
#give booter / String = kernel
#give booter / Boot = boot
#driver driver_lcd = "lcd.elf"
#receive driver_lcd / Display = display
#receive driver_lcd / Setting = display_bright
driver driver_lcd = "lcd.elf"
receive driver_lcd / Display = display
receive driver_lcd / Setting = display_bright
#driver driver_buzzer = "buzzer.elf"
#receive driver_buzzer / Buzzer = buzzer
driver driver_buzzer = "buzzer.elf"
receive driver_buzzer / Buzzer = buzzer
#program alarm = "alarm.elf"
#receive alarm / UI = ui
program alarm = "alarm.elf"
receive alarm / UI = ui
#program gui = "gui.elf"
#give gui / UI = ui
#give gui / Display = display
#give gui / Setting = display_bright
#give gui / Buzzer = buzzer
#give gui / Keyboard = keyboard
program gui = "gui.elf"
give gui / UI = ui
give gui / Display = display
give gui / Setting = display_bright
give gui / Buzzer = buzzer
give gui / Keyboard = keyboard
#driver sdmmc = "sd+mmc.elf"
#receive sdmmc / WString = sdmmc

View File

@ -17,10 +17,10 @@
start_load = 0x80400000
load = 0x80000000
# Uncomment one of these to select the boot method for the image.
#UDC_BOOT = yes
# Uncomment exactly one of these to select the boot method for the image.
UDC_BOOT = yes
#SD_BOOT = yes
UNBRICK = yes
#UNBRICK = yes
arch_iris_sources = mips/interrupts.cc mips/arch.cc
boot_sources = mips/init.cc mips/nanonote/board.cc
@ -95,15 +95,15 @@ mips/nanonote/server/usb-server: mips/nanonote/server/usb-server.ccp mips/nanono
gzip < $< > $@
nanonote-boot: mips/nanonote/nanonote-boot.cc mips/nanonote/sdram-setup.raw
g++ `pkg-config --cflags --libs shevek` $< -o $@ -D'STAGE1="$<"' -lusb
g++ `pkg-config --cflags --libs shevek` $< -o $@ -lusb
mips/nanonote/sdram-setup.elf: mips/nanonote/sdram-setup.ld
mips/nanonote/sdram-setup.elf: LDFLAGS = --omagic -T mips/nanonote/sdram-setup.ld
mips/nanonote/threadlist.o: $(addprefix fs/,$(addsuffix .elf,$(boot_threads)))
mips/boot.o: TARGET_FLAGS = -DMEMORY_SIZE="32 << 20"
mips/init.o: TARGET_FLAGS = -I/usr/include
source/bootinit.o: TARGET_FLAGS = -I/usr/include
source/elfrun.o: TARGET_FLAGS = -I/usr/include
mips/init.o: TARGET_FLAGS = -I/usr/mipsel-linux-gnu/include
source/bootinit.o: TARGET_FLAGS = -I/usr/mipsel-linux-gnu/include
source/elfrun.o: TARGET_FLAGS = -I/usr/mipsel-linux-gnu/include
source/gpio.ccp: source/nanonote-gpio.ccp
ln -s $(subst source/,,$<) $@
$(addprefix fs/,$(addsuffix .elf,$(boot_threads))): TARGET_FLAGS = -I.

View File

@ -3581,7 +3581,7 @@ static void setup_sdram ():
// SDRAM BANK Number: 1, 2
unsigned CONFIG_NR_DRAM_BANKS = 1
// CAS latency: 2 or 3
unsigned SDRAM_CASL = 3
unsigned SDRAM_CASL = 2
// SDRAM Timings, unit: ns
// RAS# Active Time
unsigned SDRAM_TRAS = 45
@ -3592,7 +3592,7 @@ static void setup_sdram ():
// Write Latency Time
unsigned SDRAM_TRWL = 7
// Refresh period: 4096 refresh cycles/64ms
unsigned SDRAM_TREF = 15625
unsigned SDRAM_TREF = 7812
unsigned dmcr0, dmcr, sdmode, tmp, cpu_clk, mem_clk, ns
unsigned cas_latency_sdmr[2] = { EMC_SDMR_CAS_2, EMC_SDMR_CAS_3 }
unsigned cas_latency_dmcr[2] = { 1 << EMC_DMCR_TCL_BIT, 2 << EMC_DMCR_TCL_BIT }
@ -3602,8 +3602,8 @@ static void setup_sdram ():
gpio_as_sdram_16bit ()
unsigned SDRAM_BW16 = 0
unsigned SDRAM_BANK4 = 1
unsigned SDRAM_ROW = 13
unsigned SDRAM_COL = 9
unsigned SDRAM_ROW = 12
unsigned SDRAM_COL = 8
mem_clk = cpu_clk * div[cpm_get_cdiv()] / div[cpm_get_mdiv()]
EMC_BCR = 0

View File

@ -127,24 +127,6 @@ static void debug (char const *f, ...):
#include "nand.hh"
static void setup_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
debug ("\n\nNand-boot: serial port initialized\n")
extern "C":
void nandboot_start ():
unsigned base = 0x18000000 + 0xa0000000

View File

@ -22,20 +22,17 @@
#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):
// 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"
"\t.globl __start\n"
"\t.text\n"
".globl __start\n"
".text\n"
"__start:\n"
"\tnop\n"
"__hack_label:\n"
"\tmove $a0, $ra\n"
"\tmove $k0, $ra\n"
"\tbal 1f\n"
"\tnop\n"
"\t.word _gp\n"
@ -43,18 +40,25 @@ asm volatile (".set noreorder\n"
"\tlw $gp, 0($ra)\n"
"\tla $sp, stack + 0x100\n"
"\tla $t9, start_cpp\n"
"\tmove $ra, $a0\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 ('!')
setup_uart ()
kdebug ('.')
setup_sdram ()
kdebug ('!')
// everything is ok now: return to boot loader to load stage 2.

View File

@ -20,7 +20,7 @@ AUTOMAKE_OPTIONS = foreign
bin_PROGRAMS = usb-server
usb_server_SOURCES = usb-server.cc
usb_server_CPPFLAGS = $(SHEVEK_CFLAGS) -DSTAGE1_FILE=\"mips/nanonote/sdram-setup.raw\" -DSTAGE2_FILE=\"mips/start.raw\" -I../../..
usb_server_CPPFLAGS = $(SHEVEK_CFLAGS) -DSTAGE1_FILE=\"mips/nanonote/sdram-setup.raw\" -I../../.. -DCOPYRIGHT_YEARS=\"2009-2012\" -DCOPYRIGHT_AUTHOR=\"Bas\ Wijnen\" -DCOPYRIGHT_EMAIL=\"wijnen@debian.org\"
usb_server_LDFLAGS = $(SHEVEK_LIBS) -lusb
PYPP = /usr/bin/pypp

View File

@ -210,10 +210,10 @@ struct client : public shevek::server <client, data *>::connection:
void pickup (bool is_stdio):
keep = is_stdio
void read (std::string const &line):
shevek::istring l (line)
shevek::ristring l (line)
unsigned load, entry
std::string filename
if l ("reboot %x %x %r%", load, entry, filename):
if l ("reboot %x %x %a%", load, entry, filename):
get_server ()->data ()->boot (filename, load, entry)
else if l ("shutdown%"):
std::cerr << "shutting down\n"
@ -332,7 +332,7 @@ int main (int argc, char **argv):
shevek::args::option opts[] = {
shevek::args::option ('p', "port", "port to listen for commands", true, port)
}
shevek::args args (argc, argv, opts, 0, 0, "device server for testing Iris on NanoNote", "2009")
shevek::args args (argc, argv, opts, 0, 0, "device server for testing Iris on NanoNote")
data d (port)
dump_devices ()
shevek::loop ()

View File

@ -582,7 +582,8 @@ Iris::Num start ():
if (*d)->type == type && (*d)->index == index:
break
if !d:
Iris::panic (0, "unregistered device provided")
Iris::debug ("caller: %s\n", caller->name)
Iris::panic (type, "unregistered device provided")
(*d)->cap = Iris::get_arg ()
Iris::recv.reply.invoke ()
if (*d)->client:

View File

@ -90,7 +90,7 @@ Iris::Num start ():
Iris::my_memory.map (tmp, (unsigned)tmp_addr)
Iris::Cap cap = Iris::my_receiver.create_capability (0)
Iris::my_parent.provide_capability <Iris::WString> (cap.copy ())
Iris::my_parent.provide_capability <Iris::WBlock> (cap.copy ())
Iris::free_cap (cap)
Iris::my_parent.init_done ()