Date:2015-11-19 07:06:57 (8 years 4 months ago)
Author:Bas Wijnen
Commit:10ea4a0725ccfb32a167b1e09d12f04be1e427cb
Message:make things work again

Files: Makefile.am (4 diffs)
configure.ac (1 diff)
include/devices.hhp (2 diffs)
include/iris.hhp (2 diffs)
mips/nanonote/nanonote-boot.ccp (1 diff)
mips/nanonote/sdram-setup.ccp (1 diff)
mips/nanonote/sdram-setup.ld (1 diff)
mips/nanonote/stage1.ccp (1 diff)
mips/nanonote/stage1.ld (1 diff)
native/Makefile.am (1 diff)

Change Details

Makefile.am
2626
2727start_load = 0x80100000
2828
29noinst_DATA = iris.raw mips/start.raw mips/start-hack.S mips/board/sdram-setup.raw
30noinst_PROGRAMS = iris.elf mips/start.elf mips/board/sdram-setup.elf
29noinst_DATA = iris.raw mips/start.raw mips/start-hack.S mips/board/stage1.raw
30noinst_PROGRAMS = iris.elf mips/start.elf mips/board/stage1.elf
3131
3232%.raw: %.elf
3333    $(OBJCOPY) $(objcopyflags) -Obinary $< $@
...... 
6161mips/start-hack.S: mips/start.S iris.raw
6262    cp $< $@
6363
64mips_board_sdram_setup_elf_DEPENDENCIES = mips/board/sdram-setup.ld
65mips_board_sdram_setup_elf_CPPFLAGS = -fno-inline -Iinclude -Imips -Imips/board -mips32
66mips_board_sdram_setup_elf_CXXFLAGS = -O5 -Wno-unused-parameter -fno-strict-aliasing -fno-builtin -ggdb3 -fno-exceptions -fno-common
67mips_board_sdram_setup_elf_LDFLAGS = -Wl,--omagic -Wl,-T -Wl,mips/board/sdram-setup.ld -nostdlib
68mips_board_sdram_setup_elf_SOURCES = mips/board/sdram-setup.cc
64mips_board_stage1_elf_DEPENDENCIES = mips/board/stage1.ld
65mips_board_stage1_elf_CPPFLAGS = -fno-inline -Iinclude -Imips -Imips/board -mips32
66mips_board_stage1_elf_CXXFLAGS = -O5 -Wno-unused-parameter -fno-strict-aliasing -fno-builtin -ggdb3 -fno-exceptions -fno-common
67mips_board_stage1_elf_LDFLAGS = -Wl,--omagic -Wl,-T -Wl,mips/board/stage1.ld -nostdlib
68mips_board_stage1_elf_SOURCES = mips/board/stage1.cc
6969
7070program_targets = \
7171    userspace/bootinit.elf \
...... 
175175    $(MAKE) -C native
176176
177177# This target is meaningless for SD boot mode.
178test: mips/start.raw mips/start.elf server mips/board/sdram-setup.raw fs/init.config fs/font.dat
178test: mips/start.raw mips/start.elf server mips/board/stage1.raw fs/init.config fs/font.dat
179179    echo shutdown | nc localhost 5050 || true
180180    native/usb-server
181181    echo 'reboot $(start_load) 0x$(shell /bin/sh -c '$(OBJDUMP) -t mips/start.elf | grep __start$$ | cut -b1-8') mips/start.raw' | nc localhost 5050
...... 
217217    cat $(SERIAL)
218218
219219autoclean: maintainer-clean
220    $(MAKE) -C native autoclean
221    rm -rf aclocal.m4 configure depcomp fs install-sh iris.raw iris-sd.tar Makefile.in missing $(iris_sources) $(boot_sources) $(sources) $(headers) mips/start-hack.S mips/start.raw mips/start.raw.gz userspace/data/charset.data iris.tar.gz mips/board/sdram-setup.cc mips/board/sdram-setup.raw mips/board/sdram-setup.elf userspace/boot/crt0.cc
220    test ! -f native/Makefile || $(MAKE) -C native autoclean
221    rm -rf aclocal.m4 configure compile depcomp fs install-sh iris.raw iris-sd.tar Makefile.in missing $(iris_sources) $(boot_sources) $(sources) $(headers) mips/start-hack.S mips/start.raw mips/start.raw.gz userspace/data/charset.data iris.tar.gz mips/board/stage1.cc mips/board/stage1.elf mips/board/stage1.raw mips/board/stage1.elf userspace/boot/crt0.cc
configure.ac
11AC_INIT([iris], [0.2], [wijnen@debian.org])
2AM_INIT_AUTOMAKE()
2AM_INIT_AUTOMAKE
33AC_PROG_CXX
44AM_PROG_AS
55
include/devices.hhp
359359                write (encode[d])
360360                num -= d * power
361361                power /= base
362        #ifndef __NATIVE__
362363        void printf (char const *f, ...):
363364            unsigned *last = (unsigned *)&f
364365            while *f:
...... 
393394                else:
394395                    write (*f)
395396                ++f
397        #endif
396398
397399    // Numerical setting, such as a display backlight.
398400    struct Setting : public Device:
include/iris.hhp
611611Iris::Num start ()
612612
613613#ifndef __KERNEL__
614#ifndef __NATIVE__
614615#if 1
615616// Use a define instead of an inline function, because this is better visible in disassembly, even when not optimizing.
616617#define kdebug_char(_c) do { unsigned _d = (_c); __asm__ volatile ("move $a0, $zero\nlw $a1, %0\nbreak" :: "m"(_d) : "a0", "a1", "memory"); } while (0)
...... 
684685            else:
685686                kdebug_char (*f)
686687            ++f
687
688#endif
688#else
689namespace Iris:
690    inline void panic(unsigned code, char const *message = NULL):
691    inline void debug_num (unsigned num, unsigned base):
692    inline void debug (const char *f, ...):
693#endif // !defined(__NATIVE__)
694#endif // !defined(__KERNEL__)
689695#endif
mips/nanonote/nanonote-boot.ccp
2727    ".globl stage1\n"
2828    ".globl stage1_end\n"
2929    "stage1:\n"
30    ".incbin \"mips/nanonote/sdram-setup.raw\"\n"
30    ".incbin \"mips/nanonote/stage1.raw\"\n"
3131    "stage1_end:\n"
3232    ".section .text")
3333extern char stage1[1]
mips/nanonote/sdram-setup.ccp
1#pypp 0
2// Iris: micro-kernel for a capability-based operating system.
3// mips/nanonote/sdram-setup.ccp: bootstrapping over usb.
4// Copyright 2009 Bas Wijnen <wijnen@debian.org>
5//
6// This program is free software: you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation, either version 3 of the License, or
9// (at your option) any later version.
10//
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15//
16// You should have received a copy of the GNU General Public License
17// along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19// This runs like the kernel. In particular, it doesn't want userspace declarations.
20#define __KERNEL__
21#define dbg_log_char(x) do {} while (0)
22#define dbg_log(x) do {} while (0)
23#define dbg_log_num(...) do {} while (0)
24
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.
29asm volatile (".set noreorder\n"
30        ".globl __start\n"
31        ".text\n"
32        "__start:\n"
33        "\tmove $t0, $ra\n" // 0
34        "\tnop\n" // 4
35        "\tbal 1f\n" // 8
36        "\tnop\n" // 12
37        "\t.word _gp\n" // 16
38        "\t.word 0\n" // 20: This is overwritten in software usbboot mode.
39        "1:\n"
40        "\tlw $gp, 0($ra)\n"
41        "\tlb $a0, 4($ra)\n"
42        "\tla $sp, stack + 0x40\n"
43        "\tla $t9, start_cpp\n"
44        "\tmove $ra, $t0\n"
45        "\tjr $t9\n"
46        "\tnop\n"
47        ".set reorder")
48
49#include "jz4740.hh"
50
51void kdebug (unsigned ch):
52    while !(UART0_LSR & UARTLSR_TDRQ):
53    UART0_TDR = ch
54    while !(UART0_LSR & UARTLSR_TEMT):
55
56extern "C":
57    void start_cpp (int skip_memsetup)
58    char stack[0x40]
59
60void start_cpp (int skip_memsetup):
61    setup_uart ()
62    kdebug ('.')
63    if !skip_memsetup:
64        setup_sdram ()
65    kdebug ('!')
66    // everything is ok now: return to boot loader to load stage 2.
mips/nanonote/sdram-setup.ld
1OUTPUT_ARCH(mips)
2ENTRY(__start)
3MEMORY
4{
5    ram : ORIGIN = 0x80003000 , LENGTH = 0x800
6}
7
8SECTIONS
9{
10    . = ALIGN(4);
11    .text : { *(.text*) } > ram
12
13    . = ALIGN(4);
14    .rodata : { *(.rodata*) *(.note*) } > ram
15
16    . = ALIGN(4);
17    .sdata : { *(.sdata*) } > ram
18
19    . = ALIGN(4);
20    .data : { *(.data*) *(.scommon*) *(.reginfo*) } > ram
21
22    _gp = ABSOLUTE(.); /* Base of small data */
23
24    .got : { *(.got*) } > ram
25
26    . = ALIGN(4);
27    .sbss : { *(.sbss*) } > ram
28    .bss : { *(.bss*) } > ram
29    . = ALIGN (4);
30}
mips/nanonote/stage1.ccp
1#pypp 0
2// Iris: micro-kernel for a capability-based operating system.
3// mips/nanonote/sdram-setup.ccp: bootstrapping over usb.
4// Copyright 2009 Bas Wijnen <wijnen@debian.org>
5//
6// This program is free software: you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation, either version 3 of the License, or
9// (at your option) any later version.
10//
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15//
16// You should have received a copy of the GNU General Public License
17// along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19// This runs like the kernel. In particular, it doesn't want userspace declarations.
20#define __KERNEL__
21#define dbg_log_char(x) do {} while (0)
22#define dbg_log(x) do {} while (0)
23#define dbg_log_num(...) do {} while (0)
24
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.
29asm volatile (".set noreorder\n"
30        ".globl __start\n"
31        ".text\n"
32        "__start:\n"
33        "\tmove $t0, $ra\n" // 0
34        "\tnop\n" // 4
35        "\tbal 1f\n" // 8
36        "\tnop\n" // 12
37        "\t.word _gp\n" // 16
38        "\t.word 0\n" // 20: This is overwritten in software usbboot mode.
39        "1:\n"
40        "\tlw $gp, 0($ra)\n"
41        "\tlb $a0, 4($ra)\n"
42        "\tla $sp, stack + 0x40\n"
43        "\tla $t9, start_cpp\n"
44        "\tmove $ra, $t0\n"
45        "\tjr $t9\n"
46        "\tnop\n"
47        ".set reorder")
48
49#include "jz4740.hh"
50
51void kdebug (unsigned ch):
52    while !(UART0_LSR & UARTLSR_TDRQ):
53    UART0_TDR = ch
54    while !(UART0_LSR & UARTLSR_TEMT):
55
56extern "C":
57    void start_cpp (int skip_memsetup)
58    char stack[0x40]
59
60void start_cpp (int skip_memsetup):
61    setup_uart ()
62    kdebug ('.')
63    if !skip_memsetup:
64        setup_sdram ()
65    kdebug ('!')
66    // everything is ok now: return to boot loader to load stage 2.
mips/nanonote/stage1.ld
1OUTPUT_ARCH(mips)
2ENTRY(__start)
3MEMORY
4{
5    ram : ORIGIN = 0x80003000 , LENGTH = 0x800
6}
7
8SECTIONS
9{
10    /* Start with the part containing the interrupt and exception code. */
11    .text : { mips/board/mips_board_stage1_elf-stage1.o(.text*) } > ram
12    .text : { *(.text*) } > ram
13
14    .rodata : { *(.rodata*) *(.note*) } > ram
15    .sdata : { *(.sdata*) } > ram
16    .data : { *(.data*) *(.scommon*) *(.reginfo*) } > ram
17
18    _gp = ABSOLUTE(.);
19
20    .got : { *(.got*) } > ram
21    .sbss : { *(.sbss*) } > ram
22    .bss : { *(.bss*) } > ram
23}
native/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\" -I../include -DCOPYRIGHT_YEARS=\"2009-2012\" -DCOPYRIGHT_AUTHOR=\"Bas\ Wijnen\" -DCOPYRIGHT_EMAIL=\"wijnen@debian.org\"
23usb_server_CPPFLAGS = $(SHEVEK_CFLAGS) -DSTAGE1_FILE=\"mips/nanonote/stage1.raw\" -I../include -DCOPYRIGHT_YEARS=\"2009-2012\" -DCOPYRIGHT_AUTHOR=\"Bas\ Wijnen\" -DCOPYRIGHT_EMAIL=\"wijnen@debian.org\" -D__NATIVE__
2424usb_server_LDFLAGS = $(SHEVEK_LIBS) -lusb
2525
2626PYPP = /usr/bin/pypp

Archive Download the corresponding diff file

Branches:
master



interactive