Permalink
Browse files

Initial working system

This is a minimal "Hello, World!" system for the target platform.
  • Loading branch information...
0 parents commit 78dde600c3673839317905ef2c4ccf467a889f89 @singpolyma committed Jan 19, 2012
Showing with 64 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. +13 −0 COPYING
  3. +20 −0 Makefile
  4. +11 −0 README
  5. +7 −0 bootstrap.s
  6. +10 −0 kernel.c
@@ -0,0 +1,3 @@
+*.o
+*.elf
+*.bin
13 COPYING
@@ -0,0 +1,13 @@
+Copyright © 2012, Stephen Paul Weber <singpolyma.net>
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,20 @@
+CC=arm-linux-gnueabi-gcc
+LD=arm-linux-gnueabi-ld
+
+CFLAGS=-ansi -pedantic -Wall -Wextra -march=armv6 -msoft-float -fPIC -mapcs-frame
+LDFLAGS=-N -Ttext=0x10000
+
+kernel.elf: bootstrap.o kernel.o
+
+.PHONY: clean
+
+clean:
+ $(RM) *.elf *.o
+
+.SUFFIXES: .s .o .elf
+
+.s.o:
+ $(CC) $(CFLAGS) -o $@ -c $^
+
+.o.elf:
+ $(LD) $(LDFLAGS) -o $@ $^
11 README
@@ -0,0 +1,11 @@
+This repository contains code for a very simple microkernel system.
+
+Any platform-specific stuff in this code is for QEMU's "versatilepb" emulation, which emulates this board: <http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0224i/Chdbeibh.html>.
+
+Any CPU-specific stuff is for the ARM1176 processor. Currently compiling for little-endian, but I would like to change this.
+
+You can run the system with:
+
+qemu-system-arm -M versatilepb -cpu arm1176 -nographic -kernel kernel.elf
+
+Once it is running, you can shut down with ^a-x
@@ -0,0 +1,7 @@
+/* We need to set up the stack pointer before C code can run
+ This memory address is the end of the on-board 128MB of
+ RAM for QEMU versatilepb */
+.global _start
+_start:
+ ldr sp, =0x07FFFFFF
+ bl main
@@ -0,0 +1,10 @@
+int main(void) {
+ char *string = "Hello, World!\n";
+ while(*string) {
+ *(volatile char *)0x101f1000 = *string;
+ string++;
+ }
+
+ while(1); /* We can't exit, there's nowhere to go */
+ return 0;
+}

0 comments on commit 78dde60

Please sign in to comment.