summaryrefslogtreecommitdiff
path: root/src/grapes
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2010-02-05 20:49:34 +0100
committerAlexis211 <alexis211@gmail.com>2010-02-05 20:49:34 +0100
commit893244c8b5272df86da5d333332eec26ae8f15f2 (patch)
tree066a20bc1cca70f1aa97df616b2b4fc31d698b40 /src/grapes
parentf9fd53ccbb1bb38ed21360179f44b27e2a729701 (diff)
downloadTCE-893244c8b5272df86da5d333332eec26ae8f15f2.tar.gz
TCE-893244c8b5272df86da5d333332eec26ae8f15f2.zip
More work, does not work
Diffstat (limited to 'src/grapes')
-rw-r--r--src/grapes/link.ld26
-rw-r--r--src/grapes/test/Makefile30
-rw-r--r--src/grapes/test/main.c8
3 files changed, 64 insertions, 0 deletions
diff --git a/src/grapes/link.ld b/src/grapes/link.ld
new file mode 100644
index 0000000..7527b80
--- /dev/null
+++ b/src/grapes/link.ld
@@ -0,0 +1,26 @@
+ENTRY (start)
+
+SECTIONS{
+ . = 0x10000000;
+
+ .text : {
+ *(.text)
+ }
+
+ .rodata ALIGN (0x1000) :{
+ *(.rodata)
+ }
+
+ .data ALIGN (0x1000) : {
+ *(.data)
+ }
+
+ .bss : {
+ sbss = .;
+ *(COMMON)
+ *(.bss)
+ ebss = .;
+ }
+
+ end = .; _end = .; __end = .;
+}
diff --git a/src/grapes/test/Makefile b/src/grapes/test/Makefile
new file mode 100644
index 0000000..ddcc36f
--- /dev/null
+++ b/src/grapes/test/Makefile
@@ -0,0 +1,30 @@
+.PHONY: clean, mrproper
+
+CC = gcc
+CFLAGS = -nostdlib -nostartfiles -nodefaultlibs -fno-builtin -fno-stack-protector -Wall -Wextra
+
+LD = ld
+LDFLAGS = -T ../link.ld
+
+Objects = main.o
+Outfile = test
+
+all: $(Outfile)
+ echo "* Done with $(Outfile)"
+
+rebuild: mrproper all
+
+$(Outfile): $(Objects)
+ echo "* Linking $@..."
+ $(LD) $(LDFLAGS) -o $@ $^
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c $< -o $@
+
+clean:
+ echo "* Removing objects..."
+ rm $(Objects)
+
+mrproper: clean
+ rm $(Outfile)
+
diff --git a/src/grapes/test/main.c b/src/grapes/test/main.c
new file mode 100644
index 0000000..d10ad35
--- /dev/null
+++ b/src/grapes/test/main.c
@@ -0,0 +1,8 @@
+void printk(char *s) {
+ asm volatile("int $64" : : "a"(4), "b"(s));
+}
+
+void start() {
+ printk("Hi world !");
+ asm volatile("int $64" : : "a"(0));
+}