Date:2012-01-14 18:17:23 (12 years 2 months ago)
Author:Bas Wijnen
Commit:538b9b936197857fa48d76d9e6c03015491e9f65
Message:update things to work with new compiler and sdram chip

Files: init.config (2 diffs)
mips/nanonote/Makefile.arch (2 diffs)
mips/nanonote/jz4740.hhp (3 diffs)
mips/nanonote/nand-boot.ccp (1 diff)
mips/nanonote/sdram-setup.ccp (2 diffs)
mips/nanonote/server/Makefile.am (1 diff)
mips/nanonote/server/usb-server.ccp (2 diffs)
source/init.ccp (1 diff)
source/nand.ccp (1 diff)

Change Details

init.config
1313    receive driver_gpio / Event = sdmmc_gpio
1414    sysreq sysreq
1515
16    driver driver_nand = "nand.elf"
17    receive driver_nand / WBlock = nand
16    #driver driver_nand = "nand.elf"
17    #receive driver_nand / WBlock = nand
1818
19    driver driver_ums = "usb-mass-storage.elf"
20    give driver_ums / WBlock = nand
19    #driver driver_ums = "usb-mass-storage.elf"
20    #give driver_ums / WBlock = nand
2121
2222    #driver driver_boot = "boot.elf"
2323    #receive driver_boot / Boot = boot
...... 
2727    #give booter / String = kernel
2828    #give booter / Boot = boot
2929
30    #driver driver_lcd = "lcd.elf"
31    #receive driver_lcd / Display = display
32    #receive driver_lcd / Setting = display_bright
30    driver driver_lcd = "lcd.elf"
31    receive driver_lcd / Display = display
32    receive driver_lcd / Setting = display_bright
3333
34    #driver driver_buzzer = "buzzer.elf"
35    #receive driver_buzzer / Buzzer = buzzer
34    driver driver_buzzer = "buzzer.elf"
35    receive driver_buzzer / Buzzer = buzzer
3636
37    #program alarm = "alarm.elf"
38    #receive alarm / UI = ui
37    program alarm = "alarm.elf"
38    receive alarm / UI = ui
3939
40    #program gui = "gui.elf"
41    #give gui / UI = ui
42    #give gui / Display = display
43    #give gui / Setting = display_bright
44    #give gui / Buzzer = buzzer
45    #give gui / Keyboard = keyboard
40    program gui = "gui.elf"
41    give gui / UI = ui
42    give gui / Display = display
43    give gui / Setting = display_bright
44    give gui / Buzzer = buzzer
45    give gui / Keyboard = keyboard
4646
4747    #driver sdmmc = "sd+mmc.elf"
4848    #receive sdmmc / WString = sdmmc
mips/nanonote/Makefile.arch
1717
1818start_load = 0x80400000
1919load = 0x80000000
20# Uncomment one of these to select the boot method for the image.
21#UDC_BOOT = yes
20# Uncomment exactly one of these to select the boot method for the image.
21UDC_BOOT = yes
2222#SD_BOOT = yes
23UNBRICK = yes
23#UNBRICK = yes
2424
2525arch_iris_sources = mips/interrupts.cc mips/arch.cc
2626boot_sources = mips/init.cc mips/nanonote/board.cc
...... 
9595    gzip < $< > $@
9696
9797nanonote-boot: mips/nanonote/nanonote-boot.cc mips/nanonote/sdram-setup.raw
98    g++ `pkg-config --cflags --libs shevek` $< -o $@ -D'STAGE1="$<"' -lusb
98    g++ `pkg-config --cflags --libs shevek` $< -o $@ -lusb
9999
100100mips/nanonote/sdram-setup.elf: mips/nanonote/sdram-setup.ld
101101mips/nanonote/sdram-setup.elf: LDFLAGS = --omagic -T mips/nanonote/sdram-setup.ld
102102mips/nanonote/threadlist.o: $(addprefix fs/,$(addsuffix .elf,$(boot_threads)))
103103mips/boot.o: TARGET_FLAGS = -DMEMORY_SIZE="32 << 20"
104mips/init.o: TARGET_FLAGS = -I/usr/include
105source/bootinit.o: TARGET_FLAGS = -I/usr/include
106source/elfrun.o: TARGET_FLAGS = -I/usr/include
104mips/init.o: TARGET_FLAGS = -I/usr/mipsel-linux-gnu/include
105source/bootinit.o: TARGET_FLAGS = -I/usr/mipsel-linux-gnu/include
106source/elfrun.o: TARGET_FLAGS = -I/usr/mipsel-linux-gnu/include
107107source/gpio.ccp: source/nanonote-gpio.ccp
108108    ln -s $(subst source/,,$<) $@
109109$(addprefix fs/,$(addsuffix .elf,$(boot_threads))): TARGET_FLAGS = -I.
mips/nanonote/jz4740.hhp
35813581    // SDRAM BANK Number: 1, 2
35823582    unsigned CONFIG_NR_DRAM_BANKS = 1
35833583    // CAS latency: 2 or 3
3584    unsigned SDRAM_CASL = 3
3584    unsigned SDRAM_CASL = 2
35853585    // SDRAM Timings, unit: ns
35863586    // RAS# Active Time
35873587    unsigned SDRAM_TRAS = 45
...... 
35923592    // Write Latency Time
35933593    unsigned SDRAM_TRWL = 7
35943594    // Refresh period: 4096 refresh cycles/64ms
3595    unsigned SDRAM_TREF = 15625
3595    unsigned SDRAM_TREF = 7812
35963596    unsigned dmcr0, dmcr, sdmode, tmp, cpu_clk, mem_clk, ns
35973597    unsigned cas_latency_sdmr[2] = { EMC_SDMR_CAS_2, EMC_SDMR_CAS_3 }
35983598    unsigned cas_latency_dmcr[2] = { 1 << EMC_DMCR_TCL_BIT, 2 << EMC_DMCR_TCL_BIT }
...... 
36023602    gpio_as_sdram_16bit ()
36033603    unsigned SDRAM_BW16 = 0
36043604    unsigned SDRAM_BANK4 = 1
3605    unsigned SDRAM_ROW = 13
3606    unsigned SDRAM_COL = 9
3605    unsigned SDRAM_ROW = 12
3606    unsigned SDRAM_COL = 8
36073607
36083608    mem_clk = cpu_clk * div[cpm_get_cdiv()] / div[cpm_get_mdiv()]
36093609    EMC_BCR = 0
mips/nanonote/nand-boot.ccp
127127
128128#include "nand.hh"
129129
130static void setup_uart ():
131    cpm_start_uart0 ()
132    gpio_as_uart0 ()
133    UART0_IER = 0
134    UART0_FCR = 0
135    UART0_MCR = 0
136    UART0_SIRCR = 0
137    UART0_UACR = 0
138    UART0_UMR = 16
139    UART0_LCR = UARTLCR_WLEN_8 | UARTLCR_STOP1 | UARTLCR_DLAB
140    unsigned const baud = 57600
141    unsigned uart_div = 12000000 / 16 / baud
142    UART0_DLHR = (uart_div >> 8) & 0xff
143    UART0_DLLR = uart_div & 0xff
144    UART0_LCR = UARTLCR_WLEN_8 | UARTLCR_STOP1
145    UART0_FCR = UARTFCR_UUE | UARTFCR_FE | UARTFCR_RFLS | UARTFCR_TFLS
146    debug ("\n\nNand-boot: serial port initialized\n")
147
148130extern "C":
149131    void nandboot_start ():
150132        unsigned base = 0x18000000 + 0xa0000000
mips/nanonote/sdram-setup.ccp
2222#define dbg_log(x) do {} while (0)
2323#define dbg_log_num(...) do {} while (0)
2424
25#include "jz4740.hh"
26
27void kdebug (unsigned ch):
28    while !(UART0_LSR & UARTLSR_TDRQ):
29    UART0_TDR = ch
30    while !(UART0_LSR & UARTLSR_TEMT):
31
25// Set up gp and sp, jump to start_cpp().
26// This must be the first code in the file,
27// so also before include jz4740.hh,
28// because that defines some static functions which may not be inlined.
3229asm volatile (".set noreorder\n"
33        "\t.globl __start\n"
34        "\t.text\n"
30        ".globl __start\n"
31        ".text\n"
3532        "__start:\n"
3633        "\tnop\n"
3734        "__hack_label:\n"
38        "\tmove $a0, $ra\n"
35        "\tmove $k0, $ra\n"
3936        "\tbal 1f\n"
4037        "\tnop\n"
4138        "\t.word _gp\n"
...... 
4340        "\tlw $gp, 0($ra)\n"
4441        "\tla $sp, stack + 0x100\n"
4542        "\tla $t9, start_cpp\n"
46        "\tmove $ra, $a0\n"
43        "\tmove $ra, $k0\n"
4744        "\tjr $t9\n"
4845        "\tnop\n"
4946        ".set reorder")
5047
48#include "jz4740.hh"
49
50void kdebug (unsigned ch):
51    while !(UART0_LSR & UARTLSR_TDRQ):
52    UART0_TDR = ch
53    while !(UART0_LSR & UARTLSR_TEMT):
54
5155extern "C":
5256    void start_cpp ()
5357    char stack[0x100]
5458
5559void start_cpp ():
56    //setup_uart ()
57    //kdebug ('.')
58    //setup_sdram ()
59    //kdebug ('!')
60    setup_uart ()
61    kdebug ('.')
62    setup_sdram ()
63    kdebug ('!')
6064    // everything is ok now: return to boot loader to load stage 2.
mips/nanonote/server/Makefile.am
2020bin_PROGRAMS = usb-server
2121
2222usb_server_SOURCES = usb-server.cc
23usb_server_CPPFLAGS = $(SHEVEK_CFLAGS) -DSTAGE1_FILE=\"mips/nanonote/sdram-setup.raw\" -DSTAGE2_FILE=\"mips/start.raw\" -I../../..
23usb_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\"
2424usb_server_LDFLAGS = $(SHEVEK_LIBS) -lusb
2525
2626PYPP = /usr/bin/pypp
mips/nanonote/server/usb-server.ccp
210210    void pickup (bool is_stdio):
211211        keep = is_stdio
212212    void read (std::string const &line):
213        shevek::istring l (line)
213        shevek::ristring l (line)
214214        unsigned load, entry
215215        std::string filename
216        if l ("reboot %x %x %r%", load, entry, filename):
216        if l ("reboot %x %x %a%", load, entry, filename):
217217            get_server ()->data ()->boot (filename, load, entry)
218218        else if l ("shutdown%"):
219219            std::cerr << "shutting down\n"
...... 
332332    shevek::args::option opts[] = {
333333        shevek::args::option ('p', "port", "port to listen for commands", true, port)
334334     }
335    shevek::args args (argc, argv, opts, 0, 0, "device server for testing Iris on NanoNote", "2009")
335    shevek::args args (argc, argv, opts, 0, 0, "device server for testing Iris on NanoNote")
336336    data d (port)
337337    dump_devices ()
338338    shevek::loop ()
source/init.ccp
582582                            if (*d)->type == type && (*d)->index == index:
583583                                break
584584                        if !d:
585                            Iris::panic (0, "unregistered device provided")
585                            Iris::debug ("caller: %s\n", caller->name)
586                            Iris::panic (type, "unregistered device provided")
586587                        (*d)->cap = Iris::get_arg ()
587588                        Iris::recv.reply.invoke ()
588589                        if (*d)->client:
source/nand.ccp
9090    Iris::my_memory.map (tmp, (unsigned)tmp_addr)
9191
9292    Iris::Cap cap = Iris::my_receiver.create_capability (0)
93    Iris::my_parent.provide_capability <Iris::WString> (cap.copy ())
93    Iris::my_parent.provide_capability <Iris::WBlock> (cap.copy ())
9494    Iris::free_cap (cap)
9595
9696    Iris::my_parent.init_done ()

Archive Download the corresponding diff file

Branches:
master



interactive