From a2d28c8318ab3ed40b3674aeee8b9487a3129f15 Mon Sep 17 00:00:00 2001 From: Megan Wachs Date: Wed, 20 Jul 2016 16:52:44 -0700 Subject: Initial Tool Flow --- .gitmodules | 12 +++++++++ Makefile | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++ openocd | 1 + riscv-binutils-gdb | 1 + riscv-gnu-toolchain | 1 + riscv-tests | 1 + 6 files changed, 86 insertions(+) create mode 100644 .gitmodules create mode 100644 Makefile create mode 160000 openocd create mode 160000 riscv-binutils-gdb create mode 160000 riscv-gnu-toolchain create mode 160000 riscv-tests 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 index 0000000..47ef2c1 --- /dev/null +++ b/openocd @@ -0,0 +1 @@ +Subproject commit 47ef2c144b298d820c6daf5d38e5d4c110cf9f3e diff --git a/riscv-binutils-gdb b/riscv-binutils-gdb new file mode 160000 index 0000000..23e74ae --- /dev/null +++ b/riscv-binutils-gdb @@ -0,0 +1 @@ +Subproject commit 23e74aee45e4b9330310c4d18fe68e7f87ba1cbb diff --git a/riscv-gnu-toolchain b/riscv-gnu-toolchain new file mode 160000 index 0000000..11fb8bb --- /dev/null +++ b/riscv-gnu-toolchain @@ -0,0 +1 @@ +Subproject commit 11fb8bbdb07e80a5b02c9e8753482fb739152bef diff --git a/riscv-tests b/riscv-tests new file mode 160000 index 0000000..c3b7d47 --- /dev/null +++ b/riscv-tests @@ -0,0 +1 @@ +Subproject commit c3b7d479afd8e5c2bcb7e0632f03b80386196f17 -- cgit v1.2.3