diff --git a/Makefile.am b/Makefile.am index a40c256..37c53bb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,8 +26,8 @@ objcopyflags = -S $(addprefix --remove-section=.,$(junk)) start_load = 0x80100000 -noinst_DATA = iris.raw mips/start.raw mips/start-hack.S mips/board/sdram-setup.raw -noinst_PROGRAMS = iris.elf mips/start.elf mips/board/sdram-setup.elf +noinst_DATA = iris.raw mips/start.raw mips/start-hack.S mips/board/stage1.raw +noinst_PROGRAMS = iris.elf mips/start.elf mips/board/stage1.elf %.raw: %.elf $(OBJCOPY) $(objcopyflags) -Obinary $< $@ @@ -61,11 +61,11 @@ mips_start_elf_SOURCES = mips/start-hack.S iris.raw mips/start-hack.S: mips/start.S iris.raw cp $< $@ -mips_board_sdram_setup_elf_DEPENDENCIES = mips/board/sdram-setup.ld -mips_board_sdram_setup_elf_CPPFLAGS = -fno-inline -Iinclude -Imips -Imips/board -mips32 -mips_board_sdram_setup_elf_CXXFLAGS = -O5 -Wno-unused-parameter -fno-strict-aliasing -fno-builtin -ggdb3 -fno-exceptions -fno-common -mips_board_sdram_setup_elf_LDFLAGS = -Wl,--omagic -Wl,-T -Wl,mips/board/sdram-setup.ld -nostdlib -mips_board_sdram_setup_elf_SOURCES = mips/board/sdram-setup.cc +mips_board_stage1_elf_DEPENDENCIES = mips/board/stage1.ld +mips_board_stage1_elf_CPPFLAGS = -fno-inline -Iinclude -Imips -Imips/board -mips32 +mips_board_stage1_elf_CXXFLAGS = -O5 -Wno-unused-parameter -fno-strict-aliasing -fno-builtin -ggdb3 -fno-exceptions -fno-common +mips_board_stage1_elf_LDFLAGS = -Wl,--omagic -Wl,-T -Wl,mips/board/stage1.ld -nostdlib +mips_board_stage1_elf_SOURCES = mips/board/stage1.cc program_targets = \ userspace/bootinit.elf \ @@ -175,7 +175,7 @@ server: $(MAKE) -C native # This target is meaningless for SD boot mode. -test: mips/start.raw mips/start.elf server mips/board/sdram-setup.raw fs/init.config fs/font.dat +test: mips/start.raw mips/start.elf server mips/board/stage1.raw fs/init.config fs/font.dat echo shutdown | nc localhost 5050 || true native/usb-server 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 @@ -217,5 +217,5 @@ debug: cat $(SERIAL) autoclean: maintainer-clean - $(MAKE) -C native autoclean - 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 + test ! -f native/Makefile || $(MAKE) -C native autoclean + 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 diff --git a/configure.ac b/configure.ac index df6860f..95065c5 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([iris], [0.2], [wijnen@debian.org]) -AM_INIT_AUTOMAKE() +AM_INIT_AUTOMAKE AC_PROG_CXX AM_PROG_AS diff --git a/include/devices.hhp b/include/devices.hhp index 7529a4c..caf0c7f 100644 --- a/include/devices.hhp +++ b/include/devices.hhp @@ -359,6 +359,7 @@ namespace Iris: write (encode[d]) num -= d * power power /= base + #ifndef __NATIVE__ void printf (char const *f, ...): unsigned *last = (unsigned *)&f while *f: @@ -393,6 +394,7 @@ namespace Iris: else: write (*f) ++f + #endif // Numerical setting, such as a display backlight. struct Setting : public Device: diff --git a/include/iris.hhp b/include/iris.hhp index aaf86e8..976ada7 100644 --- a/include/iris.hhp +++ b/include/iris.hhp @@ -611,6 +611,7 @@ namespace Iris: Iris::Num start () #ifndef __KERNEL__ +#ifndef __NATIVE__ #if 1 // Use a define instead of an inline function, because this is better visible in disassembly, even when not optimizing. #define kdebug_char(_c) do { unsigned _d = (_c); __asm__ volatile ("move $a0, $zero\nlw $a1, %0\nbreak" :: "m"(_d) : "a0", "a1", "memory"); } while (0) @@ -684,6 +685,11 @@ namespace Iris: else: kdebug_char (*f) ++f - -#endif +#else +namespace Iris: + inline void panic(unsigned code, char const *message = NULL): + inline void debug_num (unsigned num, unsigned base): + inline void debug (const char *f, ...): +#endif // !defined(__NATIVE__) +#endif // !defined(__KERNEL__) #endif diff --git a/mips/nanonote/nanonote-boot.ccp b/mips/nanonote/nanonote-boot.ccp index 2b01ed1..adc77de 100644 --- a/mips/nanonote/nanonote-boot.ccp +++ b/mips/nanonote/nanonote-boot.ccp @@ -27,7 +27,7 @@ asm volatile (".section .rodata\n" ".globl stage1\n" ".globl stage1_end\n" "stage1:\n" - ".incbin \"mips/nanonote/sdram-setup.raw\"\n" + ".incbin \"mips/nanonote/stage1.raw\"\n" "stage1_end:\n" ".section .text") extern char stage1[1] diff --git a/mips/nanonote/sdram-setup.ccp b/mips/nanonote/stage1.ccp similarity index 100% rename from mips/nanonote/sdram-setup.ccp rename to mips/nanonote/stage1.ccp diff --git a/mips/nanonote/sdram-setup.ld b/mips/nanonote/stage1.ld similarity index 68% rename from mips/nanonote/sdram-setup.ld rename to mips/nanonote/stage1.ld index 0a8c6c0..8f56356 100644 --- a/mips/nanonote/sdram-setup.ld +++ b/mips/nanonote/stage1.ld @@ -7,24 +7,17 @@ MEMORY SECTIONS { - . = ALIGN(4); + /* Start with the part containing the interrupt and exception code. */ + .text : { mips/board/mips_board_stage1_elf-stage1.o(.text*) } > ram .text : { *(.text*) } > ram - . = ALIGN(4); .rodata : { *(.rodata*) *(.note*) } > ram - - . = ALIGN(4); .sdata : { *(.sdata*) } > ram - - . = ALIGN(4); .data : { *(.data*) *(.scommon*) *(.reginfo*) } > ram - _gp = ABSOLUTE(.); /* Base of small data */ + _gp = ABSOLUTE(.); .got : { *(.got*) } > ram - - . = ALIGN(4); .sbss : { *(.sbss*) } > ram .bss : { *(.bss*) } > ram - . = ALIGN (4); } diff --git a/native/Makefile.am b/native/Makefile.am index 7965d9e..60ad9ef 100644 --- a/native/Makefile.am +++ b/native/Makefile.am @@ -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\" -I../include -DCOPYRIGHT_YEARS=\"2009-2012\" -DCOPYRIGHT_AUTHOR=\"Bas\ Wijnen\" -DCOPYRIGHT_EMAIL=\"wijnen@debian.org\" +usb_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__ usb_server_LDFLAGS = $(SHEVEK_LIBS) -lusb PYPP = /usr/bin/pypp