Initial commit.
This commit is contained in:
commit
89e4166520
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
build/
|
50
Makefile
Normal file
50
Makefile
Normal file
@ -0,0 +1,50 @@
|
||||
PORT := 1234
|
||||
CHECK := diff -q
|
||||
MKDIR_P := mkdir -p
|
||||
|
||||
CC := lcc
|
||||
CFLAGS := -nostdlib
|
||||
|
||||
QEMU := qemu-e2k
|
||||
QEMU_ARGS :=
|
||||
|
||||
GDB := e2k-linux-gdb
|
||||
GDB_ARGS := -q --batch --nx --nw -ix gdbinit
|
||||
GDB_BPS := -ex 'b _start' -ex 'b _stop'
|
||||
|
||||
ifndef EMU
|
||||
GDB_SERVER := gdbserver
|
||||
GDB_SERVER_ARGS := :$(PORT)
|
||||
else
|
||||
GDB_SERVER := $(QEMU)
|
||||
GDB_SERVER_ARGS := -g $(PORT) $(QEMU_ARGS)
|
||||
endif
|
||||
|
||||
tests := $(subst .s,,$(notdir $(wildcard src/*.s)))
|
||||
executables := $(addprefix build/,$(tests))
|
||||
logs := $(addprefix build/,$(addsuffix .log,$(tests)))
|
||||
checks := $(addprefix check-,$(tests))
|
||||
|
||||
.PHONY: all test mkdirs clean $(checks)
|
||||
|
||||
all: mkdirs $(logs)
|
||||
|
||||
test: mkdirs $(checks)
|
||||
|
||||
mkdirs:
|
||||
$(MKDIR_P) build
|
||||
|
||||
clean:
|
||||
$(RM) $(executables)
|
||||
$(RM) $(logs)
|
||||
|
||||
$(executables): build/%: src/%.s
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
$(logs): build/%.log: build/% src/%.gdb
|
||||
$(GDB_SERVER) $(GDB_SERVER_ARGS) $< &
|
||||
$(GDB) $(GDB_ARGS) -ex 'file $<' $(GDB_BPS) \
|
||||
-ex 'target remote :$(PORT)' -x src/$*.gdb > $@
|
||||
|
||||
$(checks): check-%: build/%.log src/%.log
|
||||
$(CHECK) $^
|
2
src/addd.gdb
Normal file
2
src/addd.gdb
Normal file
@ -0,0 +1,2 @@
|
||||
c
|
||||
info registers r0
|
6
src/addd.log
Normal file
6
src/addd.log
Normal file
@ -0,0 +1,6 @@
|
||||
Breakpoint 1 at 0x10078
|
||||
Breakpoint 2 at 0x10080
|
||||
0x0000000000010078 in _start ()
|
||||
|
||||
Breakpoint 2, 0x0000000000010080 in _stop ()
|
||||
r0 <00> 0x4 4
|
7
src/addd.s
Normal file
7
src/addd.s
Normal file
@ -0,0 +1,7 @@
|
||||
.global _start
|
||||
.global _stop
|
||||
|
||||
_start:
|
||||
addd 2, 2, %r0
|
||||
_stop:
|
||||
udivs 0, 0, %empty
|
2
src/subd.gdb
Normal file
2
src/subd.gdb
Normal file
@ -0,0 +1,2 @@
|
||||
c
|
||||
info registers r0
|
6
src/subd.log
Normal file
6
src/subd.log
Normal file
@ -0,0 +1,6 @@
|
||||
Breakpoint 1 at 0x10078
|
||||
Breakpoint 2 at 0x10080
|
||||
0x0000000000010078 in _start ()
|
||||
|
||||
Breakpoint 2, 0x0000000000010080 in _stop ()
|
||||
r0 <00> 0x0 0
|
7
src/subd.s
Normal file
7
src/subd.s
Normal file
@ -0,0 +1,7 @@
|
||||
.global _start
|
||||
.global _stop
|
||||
|
||||
_start:
|
||||
subd 2, 2, %r0
|
||||
_stop:
|
||||
udivs 0, 0, %empty
|
Loading…
Reference in New Issue
Block a user