Add qemu test directory
authorMichael Nolan <mtnolan2640@gmail.com>
Wed, 25 Mar 2020 17:23:16 +0000 (13:23 -0400)
committerMichael Nolan <mtnolan2640@gmail.com>
Wed, 25 Mar 2020 17:23:26 +0000 (13:23 -0400)
src/soc/simulator/qemu_test/.gitignore [new file with mode: 0644]
src/soc/simulator/qemu_test/Makefile [new file with mode: 0644]
src/soc/simulator/qemu_test/gdbscript [new file with mode: 0644]
src/soc/simulator/qemu_test/memmap [new file with mode: 0644]
src/soc/simulator/qemu_test/test.s [new file with mode: 0644]

diff --git a/src/soc/simulator/qemu_test/.gitignore b/src/soc/simulator/qemu_test/.gitignore
new file mode 100644 (file)
index 0000000..416ab3a
--- /dev/null
@@ -0,0 +1,4 @@
+*.bin
+*.elf
+*.o
+*~
diff --git a/src/soc/simulator/qemu_test/Makefile b/src/soc/simulator/qemu_test/Makefile
new file mode 100644 (file)
index 0000000..8c258b6
--- /dev/null
@@ -0,0 +1,15 @@
+TOOLCHAIN=powerpc64-linux-gnu
+CC=$(TOOLCHAIN)-gcc
+AS=$(TOOLCHAIN)-as
+AFLAGS=-mpwr9
+
+all: kernel.bin
+
+kernel.elf: test.o
+       $(TOOLCHAIN)-ld $^ -o $@ -T memmap
+
+kernel.bin: kernel.elf
+       $(TOOLCHAIN)-objcopy $< -O binary $@
+
+%.o: %.s
+       $(AS) $(AFLAGS) -c $< -o $@
diff --git a/src/soc/simulator/qemu_test/gdbscript b/src/soc/simulator/qemu_test/gdbscript
new file mode 100644 (file)
index 0000000..1337e6a
--- /dev/null
@@ -0,0 +1,4 @@
+target remote localhost:1234
+layout asm
+b *0x20000000
+c
diff --git a/src/soc/simulator/qemu_test/memmap b/src/soc/simulator/qemu_test/memmap
new file mode 100644 (file)
index 0000000..8cc1a16
--- /dev/null
@@ -0,0 +1,11 @@
+
+MEMORY
+{
+    ram  : ORIGIN = 0x20000000, LENGTH = 128M
+}
+
+SECTIONS
+{
+   .text : { *(.text*) } > ram
+   .bss  : { *(.text*) } > ram
+}
diff --git a/src/soc/simulator/qemu_test/test.s b/src/soc/simulator/qemu_test/test.s
new file mode 100644 (file)
index 0000000..fb2ec15
--- /dev/null
@@ -0,0 +1,6 @@
+       lis 1, 0xdead
+       ori 1, 1, 0xbeef
+       lis 2, 0x2000
+       ori 2, 2, 0x0100
+       std 1, 0(2)
+       lhz 1, 4(2)