mirror of
git://projects.qi-hardware.com/iris.git
synced 2025-04-21 12:27:27 +03:00
split off nanonote code, try to make it boot
This commit is contained in:
61
mips/trendtac/Makefile.arch
Normal file
61
mips/trendtac/Makefile.arch
Normal file
@@ -0,0 +1,61 @@
|
||||
# Iris: micro-kernel for a capability-based operating system.
|
||||
# mips/trendtac/Makefile.arch: board-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
|
||||
|
||||
ARCH_CXXFLAGS = -DNUM_THREADS=3
|
||||
ARCH_CPPFLAGS = -Imips -Wa,-mips32
|
||||
CROSS = mipsel-linux-gnu-
|
||||
OBJDUMP = $(CROSS)objdump
|
||||
junk = mdebug.abi32 reginfo comment pdr
|
||||
OBJCOPYFLAGS = $(addprefix --remove-section=.,$(junk))
|
||||
|
||||
arch_iris_sources = mips/interrupts.cc mips/arch.cc
|
||||
boot_sources = mips/init.cc
|
||||
arch_headers = mips/arch.hh mips/jz4730.hh
|
||||
boot_threads = init gpio lcd
|
||||
|
||||
uimage:
|
||||
|
||||
mips/boot.o: TARGET_FLAGS = -DMEMORY_SIZE = "128 << 20"
|
||||
mips/threadlist.o: $(boot_threads)
|
||||
mips/init.o: TARGET_FLAGS = -I/usr/include
|
||||
$(boot_threads): TARGET_FLAGS = -I.
|
||||
$(addprefix boot-programs/,$(addsuffix .cc,$(boot_threads))): boot-programs/devices.hh boot-programs/init.hh
|
||||
lcd: boot-programs/charset.data
|
||||
|
||||
boot-programs/charset.data: boot-programs/charset
|
||||
$< > $@
|
||||
|
||||
# Transform ':' into ';' so vim doesn't think there are errors.
|
||||
uimage: iris.raw.gz Makefile mips/Makefile.arch
|
||||
mkimage -A MIPS -O Linux -C gzip -a $(load) -e 0xa$(shell /bin/sh -c '$(OBJDUMP) -t iris | grep __start$$ | cut -b2-8') -n "Iris" -d $< $@ | sed -e 's/:/;/g'
|
||||
|
||||
%.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: mips/entry.o $(subst .cc,.o,$(iris_sources)) mips/trendtac/threadlist.o mips/boot.o $(subst .cc,.o,$(boot_sources))
|
||||
$(LD) --omagic -Ttext $(load) $^ -o $@
|
||||
|
||||
%.raw: %
|
||||
$(OBJCOPY) -S $(OBJCOPYFLAGS) -Obinary $< $@
|
||||
|
||||
%.gz: %
|
||||
gzip < $< > $@
|
||||
|
||||
ARCH_CLEAN_FILES = uimage $(boot_threads) mips/*.o boot-programs/charset.data iris iris.raw iris.raw.gz
|
||||
57
mips/trendtac/board.ccp
Normal file
57
mips/trendtac/board.ccp
Normal file
@@ -0,0 +1,57 @@
|
||||
#pypp 0
|
||||
// Iris: micro-kernel for a capability-based operating system.
|
||||
// mips/trendtac/board.ccp: trendtac-specific functions.
|
||||
// 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/>.
|
||||
|
||||
void board_init ():
|
||||
// Disable all gpio interrupts and alternate functions initially.
|
||||
for unsigned i = 0; i < 4; ++i:
|
||||
GPIO_GPIER (i) = 0
|
||||
GPIO_GPALR (i) = 0
|
||||
GPIO_GPAUR (i) = 0
|
||||
// Set up the rest of the hardware (copied from Linux).
|
||||
cpm_idle_mode ()
|
||||
cpm_enable_cko1 ()
|
||||
cpm_start_all ()
|
||||
harb_set_priority (0x08)
|
||||
dmac_enable_all_channels ()
|
||||
harb_usb0_uhc ()
|
||||
gpio_as_emc ()
|
||||
gpio_as_uart0 ()
|
||||
gpio_as_dma ()
|
||||
gpio_as_eth ()
|
||||
gpio_as_usb ()
|
||||
gpio_as_lcd_master ()
|
||||
gpio_as_ssi()
|
||||
gpio_as_msc ()
|
||||
|
||||
gpio_as_gpio (GPIO_CAPS_PORT, GPIO_CAPS)
|
||||
gpio_as_gpio (GPIO_SCROLL_PORT, GPIO_SCROLL)
|
||||
gpio_as_gpio (GPIO_NUM_PORT, GPIO_NUM)
|
||||
gpio_as_gpio (GPIO_TP_LEFT_PORT, GPIO_TP_LEFT)
|
||||
gpio_as_gpio (GPIO_TP_RIGHT_PORT, GPIO_TP_RIGHT)
|
||||
|
||||
// Start the operating system timer, and set it to give an interrupt immediately.
|
||||
// This is better, because the kernel starts with jumping into the idle task and
|
||||
// waiting for the first interrupt.
|
||||
unsigned latch = (JZ_EXTAL + (HZ >> 1)) / HZ
|
||||
ost_disable_all ()
|
||||
ost_set_mode (0, OST_TCSR_UIE | OST_TCSR_CKS_EXTAL)
|
||||
ost_set_reload (0, latch)
|
||||
ost_set_count (0, 1)
|
||||
ost_set_mode (0, OST_TCSR_UIE | OST_TCSR_CKS_EXTAL)
|
||||
ost_enable_channel (0)
|
||||
intc_unmask_irq (IRQ_OST0)
|
||||
4202
mips/trendtac/jz4730.hhp
Normal file
4202
mips/trendtac/jz4730.hhp
Normal file
File diff suppressed because it is too large
Load Diff
43
mips/trendtac/threadlist.S
Normal file
43
mips/trendtac/threadlist.S
Normal file
@@ -0,0 +1,43 @@
|
||||
// Iris: micro-kernel for a capability-based operating system.
|
||||
// mips/trendtac/threadlist.S: Kernel entry point, called by the boot loader.
|
||||
// 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/>.
|
||||
|
||||
.globl init_start
|
||||
.globl thread_start
|
||||
.set noreorder
|
||||
|
||||
.balign 0x1000
|
||||
thread0:
|
||||
.incbin "init"
|
||||
|
||||
.balign 0x1000
|
||||
thread1:
|
||||
.incbin "lcd"
|
||||
|
||||
.balign 0x1000
|
||||
thread2:
|
||||
.incbin "gpio"
|
||||
|
||||
thread3:
|
||||
|
||||
// Everything from here may be freed after kernel initialization.
|
||||
init_start:
|
||||
|
||||
thread_start:
|
||||
.word thread0
|
||||
.word thread1
|
||||
.word thread2
|
||||
.word thread3
|
||||
Reference in New Issue
Block a user