Add start file
authorMichael Spang <mspang@csclub.uwaterloo.ca>
Wed, 10 Nov 2010 13:02:12 +0000 (08:02 -0500)
committerMichael Spang <mspang@csclub.uwaterloo.ca>
Mon, 14 Mar 2011 04:02:46 +0000 (00:02 -0400)
Makefile
ts7800.S [new file with mode: 0644]
ts7800.ld

index dadc38c..56f5c0d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -37,7 +37,7 @@ endif
 
 all: bin/iotest
 
-bin/iotest: obj/bwio.o obj/iotest.o
+bin/iotest: obj/bwio.o obj/iotest.o obj/ts7800.o
 
 bin/% :
        @mkdir -p $(shell dirname $@)
@@ -60,6 +60,6 @@ obj/%.s : obj/%.c
        $(CC) -c $(CFLAGS) -o $@ $^
 
 clean:
-       rm -rf obj lib bin/*
+       rm -rf obj lib bin
 
 .PRECIOUS: obj/%.s obj/%.c
diff --git a/ts7800.S b/ts7800.S
new file mode 100644 (file)
index 0000000..1b9efa6
--- /dev/null
+++ b/ts7800.S
@@ -0,0 +1,19 @@
+.global ts7800_start
+ts7800_start:
+  bl zero_bss
+  bl main
+  b reboot
+
+zero_bss:
+  mov r3, #0
+  ldr r1, =__bss_start__
+  ldr r2, =__bss_end__
+
+zero_bss_loop:
+  cmp r1, r2
+  bxhs lr
+  strb r3, [r1], #1
+  b zero_bss_loop
+
+reboot:
+  b .
index 434e5b4..989713c 100644 (file)
--- a/ts7800.ld
+++ b/ts7800.ld
@@ -1,4 +1,4 @@
-ENTRY(_start)
+ENTRY(ts7800_start)
 
 SECTIONS
 {