2009-09-27 11:23:33 +03:00
|
|
|
# Iris: micro-kernel for a capability-based operating system.
|
|
|
|
# mips/nanonote/Makefile.arch: nanonote-specific parts of the build rules
|
|
|
|
# Copyright 2009 Bas Wijnen <wijnen@debian.org>
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
load = 0x80000000
|
|
|
|
|
2010-01-14 19:14:37 +02:00
|
|
|
ARCH_CXXFLAGS = -DNUM_THREADS=2
|
2009-12-27 01:12:35 +02:00
|
|
|
ARCH_CPPFLAGS = -I. -Imips -Imips/nanonote -Wa,-mips32 -DNANONOTE -DUSE_SERIAL
|
2009-09-27 11:23:33 +03:00
|
|
|
CROSS = mipsel-linux-gnu-
|
|
|
|
OBJDUMP = $(CROSS)objdump
|
|
|
|
junk = mdebug.abi32 reginfo comment pdr
|
|
|
|
OBJCOPYFLAGS = $(addprefix --remove-section=.,$(junk))
|
|
|
|
LDFLAGS = --omagic -Ttext $(load)
|
|
|
|
|
|
|
|
arch_iris_sources = mips/interrupts.cc mips/arch.cc
|
|
|
|
boot_sources = mips/init.cc mips/nanonote/board.cc
|
|
|
|
arch_headers = mips/arch.hh mips/nanonote/jz4740.hh mips/nanonote/board.hh
|
2010-01-14 19:14:37 +02:00
|
|
|
boot_threads = init udc
|
2010-01-30 10:21:56 +02:00
|
|
|
programs = \#nanonote-gpio \#buzzer \#lcd metronome ball display-emu
|
2010-01-14 19:14:37 +02:00
|
|
|
|
2010-01-16 17:13:54 +02:00
|
|
|
all: test
|
2009-09-27 11:23:33 +03:00
|
|
|
|
2010-01-16 17:13:54 +02:00
|
|
|
test: iris.raw mips/nanonote/server/usb-server mips/nanonote/sdram-setup.raw $(addsuffix .elf,$(addprefix fs/,$(programs)))
|
2009-12-18 23:27:26 +02:00
|
|
|
echo "reboot 0xa$(shell /bin/sh -c '$(OBJDUMP) -t iris.elf | grep __start$$ | cut -b2-8')" | nc localhost 5050
|
2009-09-27 11:23:33 +03:00
|
|
|
|
2010-01-18 07:45:52 +02:00
|
|
|
mips/nanonote/server/usb-server: mips/nanonote/server/usb-server.ccp mips/nanonote/server/Makefile.am mips/nanonote/server/configure.ac devices.hh
|
2009-12-18 23:27:26 +02:00
|
|
|
$(MAKE) -C mips/nanonote/server
|
2009-12-26 15:17:06 +02:00
|
|
|
echo "shutdown" | nc localhost 5050
|
|
|
|
sleep 1
|
2009-12-18 23:27:26 +02:00
|
|
|
|
2009-09-27 11:23:33 +03:00
|
|
|
%.elf: %.o
|
|
|
|
$(LD) $(LDFLAGS) -o $@ $<
|
|
|
|
|
|
|
|
%.raw: %.elf
|
|
|
|
$(OBJCOPY) -S $(OBJCOPYFLAGS) -Obinary $< $@
|
|
|
|
|
|
|
|
nanonote-boot: mips/nanonote/nanonote-boot.cc mips/nanonote/sdram-setup.raw
|
|
|
|
g++ `pkg-config --cflags --libs shevek` $< -o $@ -D'STAGE1="$<"' -lusb
|
|
|
|
|
|
|
|
mips/nanonote/sdram-setup.elf: mips/nanonote/sdram-setup.ld
|
|
|
|
mips/nanonote/sdram-setup.elf: LDFLAGS = --omagic -T mips/nanonote/sdram-setup.ld
|
2009-12-11 10:43:42 +02:00
|
|
|
mips/nanonote/threadlist.o: $(addsuffix .elf,$(boot_threads))
|
2009-09-27 11:23:33 +03:00
|
|
|
mips/boot.o: TARGET_FLAGS = -DMEMORY_SIZE="32 << 20"
|
|
|
|
mips/init.o: TARGET_FLAGS = -I/usr/include
|
2010-01-14 19:14:37 +02:00
|
|
|
boot-programs/init.o: TARGET_FLAGS = -I/usr/include
|
2009-10-31 10:32:23 +02:00
|
|
|
$(addsuffix .elf,$(boot_threads)): TARGET_FLAGS = -I.
|
|
|
|
$(addsuffix .elf,$(boot_threads)): LDFLAGS = -EL
|
2010-01-16 17:13:54 +02:00
|
|
|
$(addprefix fs/,$(addsuffix .elf,$(programs))): LDFLAGS = -EL
|
2009-10-10 02:31:10 +03:00
|
|
|
$(addprefix boot-programs/,$(addsuffix .cc,$(boot_threads))): devices.hh keys.hh
|
2010-01-18 07:45:52 +02:00
|
|
|
source/\#lcd.o: source/charset.data
|
2009-09-27 11:23:33 +03:00
|
|
|
|
2010-01-16 17:13:54 +02:00
|
|
|
source/charset.data: source/charset
|
2009-09-27 11:23:33 +03:00
|
|
|
$< > $@
|
|
|
|
|
|
|
|
%.o:%.S Makefile Makefile.arch mips/arch.hh
|
|
|
|
$(CC) $(CPPFLAGS) $(TARGET_FLAGS) -DKERNEL_STACK_SIZE=0x2000 -c $< -o $@
|
|
|
|
|
|
|
|
# entry.o must be the first file. threadlist.o must be the first of the init objects (which can be freed after loading).
|
|
|
|
iris.elf: mips/entry.o $(subst .cc,.o,$(iris_sources)) mips/nanonote/threadlist.o mips/boot.o $(subst .cc,.o,$(boot_sources))
|
|
|
|
$(LD) $(LDFLAGS) $^ -o $@
|
|
|
|
|
2009-12-26 15:17:06 +02:00
|
|
|
server:
|
|
|
|
while mips/nanonote/server/usb-server ; do : ; done
|
|
|
|
|
2009-12-31 12:22:25 +02:00
|
|
|
servers:
|
|
|
|
while : ; do $(MAKE) server ; done
|
|
|
|
|
2010-01-16 17:13:54 +02:00
|
|
|
setup:
|
2010-01-30 10:21:56 +02:00
|
|
|
x-terminal-emulator -e make debug
|
2010-01-16 17:13:54 +02:00
|
|
|
x-terminal-emulator -e make servers
|
|
|
|
|
|
|
|
ARCH_CLEAN_FILES = $(boot_sources) $(addsuffix .elf,$(boot_threads)) $(arch_headers) devices.hh keys.hh mips/*.o mips/nanonote/*.o source/charset.data iris.elf iris.raw mips/nanonote/sdram-setup.elf mips/nanonote/sdram-setup.raw
|
2009-12-11 10:43:42 +02:00
|
|
|
|
|
|
|
.PRECIOUS: mips/arch.hh mips/nanonote/jz4740.hh mips/nanonote/board.hh
|
2010-01-16 17:13:54 +02:00
|
|
|
.PHONY: test all monitor server servers setup
|