diff options
-rw-r--r-- | .gitmodules | 12 | ||||
-rw-r--r-- | Makefile | 70 | ||||
m--------- | openocd | 0 | ||||
m--------- | riscv-binutils-gdb | 0 | ||||
m--------- | riscv-gnu-toolchain | 0 | ||||
m--------- | riscv-tests | 0 |
6 files changed, 82 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..9527506 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,12 @@ +[submodule "openocd"] + path = openocd + url = http://github.com/sifive/openocd.git +[submodule "riscv-gnu-toolchain"] + path = riscv-gnu-toolchain + url = http://github.com/riscv/riscv-gnu-toolchain.git +[submodule "riscv-binutils-gdb"] + path = riscv-binutils-gdb + url = http://github.com/sifive/riscv-binutils-gdb.git +[submodule "riscv-tests"] + path = riscv-tests + url = http://github.com/timsifive/riscv-tests diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9d81d77 --- /dev/null +++ b/Makefile @@ -0,0 +1,70 @@ +RISCV ?= $(CURDIR)/toolchain +PATH := $(RISCV)/bin:$(PATH) + +srcdir := $(dir $(realpath $(lastword $(MAKEFILE_LIST)))) +srcdir := $(srcdir:/=) +wrkdir := $(CURDIR)/work + +toolchain_srcdir := $(srcdir)/riscv-gnu-toolchain +toolchain32_wrkdir := $(wrkdir)/riscv32-gnu-toolchain +toolchain64_wrkdir := $(wrkdir)/riscv64-gnu-toolchain +toolchain_dest := $(CURDIR)/toolchain + +gdb_srcdir := $(srcdir)/riscv-binutils-gdb +gdb_wrkdir := $(wrkdir)/riscv-binutils-gdb +gdb_dest := $(CURDIR)/toolchain + +openocd_srcdir := $(srcdir)/openocd +openocd_wrkdir := $(wrkdir)/openocd +openocd_dest := $(CURDIR)/toolchain + +target64 := riscv64-unknown-linux-gnu +target32 := riscv32-unknown-linux-gnu + + +.PHONY: all +all: $(hex) + @echo All done. + +tools: tools64 tools32 openocd gdb + +tools64: $(toolchain_dest)/bin/$(target64)-gcc +tools32: $(toolchain_dest)/bin/$(target32)-gcc +openocd: $(openocd_dest)/bin/openocd +gdb: $(gdb_dest)/bin/$(target64)-gdb + +$(toolchain_dest)/bin/$(target64)-gcc: $(toolchain_srcdir) + mkdir -p $(toolchain64_wrkdir) + cd $(toolchain64_wrkdir); $(toolchain_srcdir)/configure --prefix=$(toolchain_dest) + $(MAKE) -C $(toolchain64_wrkdir) + +$(toolchain_dest)/bin/$(target32)-gcc: $(toolchain_srcdir) + mkdir -p $(toolchain32_wrkdir) + cd $(toolchain32_wrkdir); $(toolchain_srcdir)/configure --prefix=$(toolchain_dest) --with-arch=RV32IMA + $(MAKE) -C $(toolchain32_wrkdir) + + +$(openocd_dest)/bin/openocd: $(openocd_srcdir) + mkdir -p $(openocd_wrkdir) + cd $(openocd_srcdir); \ + $(openocd_srcdir)/bootstrap + cd $(openocd_wrkdir); \ + $(openocd_srcdir)/configure --prefix=$(openocd_dest) + $(MAKE) -C $(openocd_wrkdir) + $(MAKE) -C $(openocd_wrkdir) install + +$(gdb_dest)/bin/$(target64)-gdb : $(gdb_srcdir) + mkdir -p $(gdb_wrkdir) + cd $(gdb_wrkdir); $(gdb_srcdir)/configure --prefix=$(gdb_dest) --target=riscv64-unknown-elf + $(MAKE) -C $(gdb_wrkdir) + $(MAKE) -C $(gdb_wrkdir) install + + +.PHONY: clean +clean: + rm -rf -- $(wrkdir) + + +.PHONY: superclean +superclean: + rm -rf -- $(toolchain_dest) diff --git a/openocd b/openocd new file mode 160000 +Subproject 47ef2c144b298d820c6daf5d38e5d4c110cf9f3 diff --git a/riscv-binutils-gdb b/riscv-binutils-gdb new file mode 160000 +Subproject 23e74aee45e4b9330310c4d18fe68e7f87ba1cb diff --git a/riscv-gnu-toolchain b/riscv-gnu-toolchain new file mode 160000 +Subproject 11fb8bbdb07e80a5b02c9e8753482fb739152be diff --git a/riscv-tests b/riscv-tests new file mode 160000 +Subproject c3b7d479afd8e5c2bcb7e0632f03b80386196f1 |