1
0
mirror of git://projects.qi-hardware.com/iris.git synced 2024-07-01 00:07:37 +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 receive driver_gpio / Event = sdmmc_gpio
sysreq sysreq sysreq sysreq
driver driver_nand = "nand.elf" #driver driver_nand = "nand.elf"
receive driver_nand / WBlock = nand #receive driver_nand / WBlock = nand
driver driver_ums = "usb-mass-storage.elf" #driver driver_ums = "usb-mass-storage.elf"
give driver_ums / WBlock = nand #give driver_ums / WBlock = nand
#driver driver_boot = "boot.elf" #driver driver_boot = "boot.elf"
#receive driver_boot / Boot = boot #receive driver_boot / Boot = boot
@ -27,22 +27,22 @@
#give booter / String = kernel #give booter / String = kernel
#give booter / Boot = boot #give booter / Boot = boot
#driver driver_lcd = "lcd.elf" driver driver_lcd = "lcd.elf"
#receive driver_lcd / Display = display receive driver_lcd / Display = display
#receive driver_lcd / Setting = display_bright receive driver_lcd / Setting = display_bright
#driver driver_buzzer = "buzzer.elf" driver driver_buzzer = "buzzer.elf"
#receive driver_buzzer / Buzzer = buzzer receive driver_buzzer / Buzzer = buzzer
#program alarm = "alarm.elf" program alarm = "alarm.elf"
#receive alarm / UI = ui receive alarm / UI = ui
#program gui = "gui.elf" program gui = "gui.elf"
#give gui / UI = ui give gui / UI = ui
#give gui / Display = display give gui / Display = display
#give gui / Setting = display_bright give gui / Setting = display_bright
#give gui / Buzzer = buzzer give gui / Buzzer = buzzer
#give gui / Keyboard = keyboard give gui / Keyboard = keyboard
#driver sdmmc = "sd+mmc.elf" #driver sdmmc = "sd+mmc.elf"
#receive sdmmc / WString = sdmmc #receive sdmmc / WString = sdmmc

View File

@ -17,10 +17,10 @@
start_load = 0x80400000 start_load = 0x80400000
load = 0x80000000 load = 0x80000000
# Uncomment one of these to select the boot method for the image. # Uncomment exactly one of these to select the boot method for the image.
#UDC_BOOT = yes UDC_BOOT = yes
#SD_BOOT = yes #SD_BOOT = yes
UNBRICK = yes #UNBRICK = yes
arch_iris_sources = mips/interrupts.cc mips/arch.cc arch_iris_sources = mips/interrupts.cc mips/arch.cc
boot_sources = mips/init.cc mips/nanonote/board.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 < $< > $@ gzip < $< > $@
nanonote-boot: mips/nanonote/nanonote-boot.cc mips/nanonote/sdram-setup.raw 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: mips/nanonote/sdram-setup.ld
mips/nanonote/sdram-setup.elf: LDFLAGS = --omagic -T 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/nanonote/threadlist.o: $(addprefix fs/,$(addsuffix .elf,$(boot_threads)))
mips/boot.o: TARGET_FLAGS = -DMEMORY_SIZE="32 << 20" mips/boot.o: TARGET_FLAGS = -DMEMORY_SIZE="32 << 20"
mips/init.o: TARGET_FLAGS = -I/usr/include mips/init.o: TARGET_FLAGS = -I/usr/mipsel-linux-gnu/include
source/bootinit.o: TARGET_FLAGS = -I/usr/include source/bootinit.o: TARGET_FLAGS = -I/usr/mipsel-linux-gnu/include
source/elfrun.o: TARGET_FLAGS = -I/usr/include source/elfrun.o: TARGET_FLAGS = -I/usr/mipsel-linux-gnu/include
source/gpio.ccp: source/nanonote-gpio.ccp source/gpio.ccp: source/nanonote-gpio.ccp
ln -s $(subst source/,,$<) $@ ln -s $(subst source/,,$<) $@
$(addprefix fs/,$(addsuffix .elf,$(boot_threads))): TARGET_FLAGS = -I. $(addprefix fs/,$(addsuffix .elf,$(boot_threads))): TARGET_FLAGS = -I.

View File

@ -3581,7 +3581,7 @@ static void setup_sdram ():
// SDRAM BANK Number: 1, 2 // SDRAM BANK Number: 1, 2
unsigned CONFIG_NR_DRAM_BANKS = 1 unsigned CONFIG_NR_DRAM_BANKS = 1
// CAS latency: 2 or 3 // CAS latency: 2 or 3
unsigned SDRAM_CASL = 3 unsigned SDRAM_CASL = 2
// SDRAM Timings, unit: ns // SDRAM Timings, unit: ns
// RAS# Active Time // RAS# Active Time
unsigned SDRAM_TRAS = 45 unsigned SDRAM_TRAS = 45
@ -3592,7 +3592,7 @@ static void setup_sdram ():
// Write Latency Time // Write Latency Time
unsigned SDRAM_TRWL = 7 unsigned SDRAM_TRWL = 7
// Refresh period: 4096 refresh cycles/64ms // 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 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_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 } 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 () gpio_as_sdram_16bit ()
unsigned SDRAM_BW16 = 0 unsigned SDRAM_BW16 = 0
unsigned SDRAM_BANK4 = 1 unsigned SDRAM_BANK4 = 1
unsigned SDRAM_ROW = 13 unsigned SDRAM_ROW = 12
unsigned SDRAM_COL = 9 unsigned SDRAM_COL = 8
mem_clk = cpu_clk * div[cpm_get_cdiv()] / div[cpm_get_mdiv()] mem_clk = cpu_clk * div[cpm_get_cdiv()] / div[cpm_get_mdiv()]
EMC_BCR = 0 EMC_BCR = 0

View File

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

View File

@ -22,20 +22,17 @@
#define dbg_log(x) do {} while (0) #define dbg_log(x) do {} while (0)
#define dbg_log_num(...) do {} while (0) #define dbg_log_num(...) do {} while (0)
#include "jz4740.hh" // Set up gp and sp, jump to start_cpp().
// This must be the first code in the file,
void kdebug (unsigned ch): // so also before include jz4740.hh,
while !(UART0_LSR & UARTLSR_TDRQ): // because that defines some static functions which may not be inlined.
UART0_TDR = ch
while !(UART0_LSR & UARTLSR_TEMT):
asm volatile (".set noreorder\n" asm volatile (".set noreorder\n"
"\t.globl __start\n" ".globl __start\n"
"\t.text\n" ".text\n"
"__start:\n" "__start:\n"
"\tnop\n" "\tnop\n"
"__hack_label:\n" "__hack_label:\n"
"\tmove $a0, $ra\n" "\tmove $k0, $ra\n"
"\tbal 1f\n" "\tbal 1f\n"
"\tnop\n" "\tnop\n"
"\t.word _gp\n" "\t.word _gp\n"
@ -43,18 +40,25 @@ asm volatile (".set noreorder\n"
"\tlw $gp, 0($ra)\n" "\tlw $gp, 0($ra)\n"
"\tla $sp, stack + 0x100\n" "\tla $sp, stack + 0x100\n"
"\tla $t9, start_cpp\n" "\tla $t9, start_cpp\n"
"\tmove $ra, $a0\n" "\tmove $ra, $k0\n"
"\tjr $t9\n" "\tjr $t9\n"
"\tnop\n" "\tnop\n"
".set reorder") ".set reorder")
#include "jz4740.hh"
void kdebug (unsigned ch):
while !(UART0_LSR & UARTLSR_TDRQ):
UART0_TDR = ch
while !(UART0_LSR & UARTLSR_TEMT):
extern "C": extern "C":
void start_cpp () void start_cpp ()
char stack[0x100] char stack[0x100]
void start_cpp (): void start_cpp ():
//setup_uart () setup_uart ()
//kdebug ('.') kdebug ('.')
//setup_sdram () setup_sdram ()
//kdebug ('!') kdebug ('!')
// everything is ok now: return to boot loader to load stage 2. // 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 bin_PROGRAMS = usb-server
usb_server_SOURCES = usb-server.cc 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 usb_server_LDFLAGS = $(SHEVEK_LIBS) -lusb
PYPP = /usr/bin/pypp PYPP = /usr/bin/pypp

View File

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

View File

@ -582,7 +582,8 @@ Iris::Num start ():
if (*d)->type == type && (*d)->index == index: if (*d)->type == type && (*d)->index == index:
break break
if !d: 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 () (*d)->cap = Iris::get_arg ()
Iris::recv.reply.invoke () Iris::recv.reply.invoke ()
if (*d)->client: if (*d)->client:

View File

@ -90,7 +90,7 @@ Iris::Num start ():
Iris::my_memory.map (tmp, (unsigned)tmp_addr) Iris::my_memory.map (tmp, (unsigned)tmp_addr)
Iris::Cap cap = Iris::my_receiver.create_capability (0) 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::free_cap (cap)
Iris::my_parent.init_done () Iris::my_parent.init_done ()