diff --git a/runtime/mains/dev/Makefile b/runtime/mains/dev/Makefile index 0b2a1b99..8b8cbb66 100644 --- a/runtime/mains/dev/Makefile +++ b/runtime/mains/dev/Makefile @@ -1,14 +1,12 @@ -# To set a custom TOOLPATH, call make like this: -# TOOLPATH=../../../../riscv-gnu-toolchain/drops/bin make ... -TOOLPATH ?= ~/dev/riscv-gnu-toolchain/drops/bin +RISCV_TOOL_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops) -COMP = $(TOOLPATH)/riscv32-unknown-elf-gcc +COMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-gcc # CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,linker.ld -ffreestanding -nostdlib CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,../vortex_link.ld -ffreestanding -nostartfiles -DMP = $(TOOLPATH)/riscv32-unknown-elf-objdump -CPY = $(TOOLPATH)/riscv32-unknown-elf-objcopy +DMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objdump +CPY = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objcopy VX_STR = ../../startup/vx_start.s diff --git a/runtime/mains/hello/Makefile b/runtime/mains/hello/Makefile index fcba1361..8f080e1e 100644 --- a/runtime/mains/hello/Makefile +++ b/runtime/mains/hello/Makefile @@ -1,20 +1,22 @@ -COMP = ../../../../riscv-gnu-toolchain/drops/bin/riscv32-unknown-elf-gcc +RISCV_TOOL_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops) + +COMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-gcc # CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,linker.ld -ffreestanding -nostdlib CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,../vortex_link.ld -DMP = ../../../../riscv-gnu-toolchain/drops/bin/riscv32-unknown-elf-objdump -CPY = ../../../../riscv-gnu-toolchain/drops/bin/riscv32-unknown-elf-objcopy +DMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objdump +CPY = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objcopy -NEWLIB = ../../newlib/newlib.c ../../newlib/newlib_notimp.c ../../newlib/newlib.s +NEWLIB = ../../newlib/newlib.c VX_STR = VX_INT = ../../intrinsics/vx_intrinsics.s -VX_IO = +VX_IO = ../../io/vx_io.s ../../io/vx_io.c VX_API = VX_TEST = VX_FIO = -LIBS = ../../../../riscv-gnu-toolchain/drops/riscv32-unknown-elf/lib/libc.a ../../../../riscv-gnu-toolchain/drops/riscv32-unknown-elf/lib/libstdc++.a -static-libgcc -lgcc +LIBS = $(RISCV_TOOL_PATH)/riscv32-unknown-elf/lib/libc.a $(RISCV_TOOL_PATH)/riscv32-unknown-elf/lib/libstdc++.a -static-libgcc -lgcc VX_MAIN = hello diff --git a/runtime/mains/nativevecadd/Makefile b/runtime/mains/nativevecadd/Makefile index 763eefa4..1347106e 100644 --- a/runtime/mains/nativevecadd/Makefile +++ b/runtime/mains/nativevecadd/Makefile @@ -1,11 +1,13 @@ -COMP = ../../../../riscv-gnu-toolchain/drops/bin/riscv32-unknown-elf-g++ +RISCV_TOOL_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops) + +COMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-g++ # CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,linker.ld -ffreestanding -nostdlib # CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,linker.ld -ffreestanding -nostartfiles CC_FLAGS = -ffreestanding -O0 -Wl,--gc-sections -nostartfiles -nostdlib -nostartfiles -nodefaultlibs -Wl,-Bstatic,-T,../vortex_link.ld -march=rv32im -mabi=ilp32 -DMP = ../../../../riscv-gnu-toolchain/drops/bin/riscv32-unknown-elf-objdump -CPY = ../../../../riscv-gnu-toolchain/drops/bin/riscv32-unknown-elf-objcopy +DMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objdump +CPY = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objcopy # VX_STR = ../../startup/vx_start.s @@ -18,7 +20,7 @@ VX_IO = ../../io/vx_io.s ../../io/vx_io.c VX_API = ../../vx_api/vx_api.c VX_TEST = ../../tests/tests.c VX_FIO = ../../fileio/fileio.s -LIBS = -Wl,--whole-archive ./libs/libvecadd.a -Wl,--no-whole-archive ./libs/libOpenCL.a ../../../../riscv-gnu-toolchain/drops/riscv32-unknown-elf/lib/libc.a ../../../../riscv-gnu-toolchain/drops/riscv32-unknown-elf/lib/libstdc++.a -static-libgcc -lgcc +LIBS = -Wl,--whole-archive ./libs/libvecadd.a -Wl,--no-whole-archive ./libs/libOpenCL.a $(RISCV_TOOL_PATH)/riscv32-unknown-elf/lib/libc.a $(RISCV_TOOL_PATH)/riscv32-unknown-elf/lib/libstdc++.a -static-libgcc -lgcc VX_MAIN = vx_pocl_main diff --git a/runtime/mains/nlTest/Makefile b/runtime/mains/nlTest/Makefile index e3f66d80..c7cd3fe6 100644 --- a/runtime/mains/nlTest/Makefile +++ b/runtime/mains/nlTest/Makefile @@ -1,13 +1,15 @@ -COMP = /opt/riscv/bin/riscv32-unknown-elf-gcc +RISCV_TOOL_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops) + +COMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-gcc # CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,linker.ld -ffreestanding -nostdlib CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,../vortex_link.ld -ffreestanding -nostartfiles -nostdlib -DMP = /opt/riscv/bin/riscv32-unknown-elf-objdump -CPY = /opt/riscv/bin/riscv32-unknown-elf-objcopy +DMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objdump +CPY = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objcopy -NEWLIB = ../../newlib/newlib.c ../../newlib/newlib_notimp.c ../../newlib/newlib.s +NEWLIB = ../../newlib/newlib.c VX_STR = ../../startup/vx_start.s VX_INT = ../../intrinsics/vx_intrinsics.s VX_IO = ../../io/vx_io.s ../../io/vx_io.c @@ -26,7 +28,7 @@ HEX: ELF $(CPY) -O ihex vx_nl_main.elf vx_nl_main.hex ELF: - $(COMP) $(CC_FLAGS) $(VX_STR) $(VX_FIO) $(NEWLIB) $(VX_INT) $(VX_IO) $(VX_API) $(VX_TEST) $(VX_MAIN) /opt/riscv/riscv32-unknown-elf/lib/libc.a /opt/riscv/riscv32-unknown-elf/lib/libstdc++.a -static-libgcc -lgcc -o vx_nl_main.elf + $(COMP) $(CC_FLAGS) $(VX_STR) $(VX_FIO) $(NEWLIB) $(VX_INT) $(VX_IO) $(VX_API) $(VX_TEST) $(VX_MAIN) $(RISCV_TOOL_PATH)/riscv32-unknown-elf/lib/libc.a $(RISCV_TOOL_PATH)/riscv32-unknown-elf/lib/libstdc++.a -static-libgcc -lgcc -o vx_nl_main.elf clean: rm -rf *.o *.elf *.dump *.hex *.qemu *.log *.debug diff --git a/runtime/mains/simple/Makefile b/runtime/mains/simple/Makefile index 5e534fa7..c77a4675 100644 --- a/runtime/mains/simple/Makefile +++ b/runtime/mains/simple/Makefile @@ -1,9 +1,11 @@ -COMP = riscv32-unknown-elf-gcc +RISCV_TOOL_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops) + +COMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-gcc CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,../vortex_link.ld -ffreestanding -nostdlib -DMP = riscv32-unknown-elf-objdump -CPY = riscv32-unknown-elf-objcopy +DMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objdump +CPY = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objcopy NEWLIB = ../../newlib/newlib.c @@ -13,7 +15,7 @@ VX_IO = ../../io/vx_io.s ../../io/vx_io.c VX_API = ../../vx_api/vx_api.c VX_TEST = ../../tests/tests.c VX_FIO = ../../fileio/fileio.s -LIBS = ../../../../riscv-gnu-toolchain/drops/riscv32-unknown-elf/lib/libc.a ../../../../riscv-gnu-toolchain/drops/riscv32-unknown-elf/lib/libstdc++.a -static-libgcc -lgcc +LIBS = $(RISCV_TOOL_PATH)/riscv32-unknown-elf/lib/libc.a $(RISCV_TOOL_PATH)/riscv32-unknown-elf/lib/libstdc++.a -static-libgcc -lgcc VX_MAIN = vx_simple_main diff --git a/runtime/mains/vecadd/Makefile b/runtime/mains/vecadd/Makefile index 763eefa4..1347106e 100644 --- a/runtime/mains/vecadd/Makefile +++ b/runtime/mains/vecadd/Makefile @@ -1,11 +1,13 @@ -COMP = ../../../../riscv-gnu-toolchain/drops/bin/riscv32-unknown-elf-g++ +RISCV_TOOL_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops) + +COMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-g++ # CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,linker.ld -ffreestanding -nostdlib # CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,linker.ld -ffreestanding -nostartfiles CC_FLAGS = -ffreestanding -O0 -Wl,--gc-sections -nostartfiles -nostdlib -nostartfiles -nodefaultlibs -Wl,-Bstatic,-T,../vortex_link.ld -march=rv32im -mabi=ilp32 -DMP = ../../../../riscv-gnu-toolchain/drops/bin/riscv32-unknown-elf-objdump -CPY = ../../../../riscv-gnu-toolchain/drops/bin/riscv32-unknown-elf-objcopy +DMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objdump +CPY = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objcopy # VX_STR = ../../startup/vx_start.s @@ -18,7 +20,7 @@ VX_IO = ../../io/vx_io.s ../../io/vx_io.c VX_API = ../../vx_api/vx_api.c VX_TEST = ../../tests/tests.c VX_FIO = ../../fileio/fileio.s -LIBS = -Wl,--whole-archive ./libs/libvecadd.a -Wl,--no-whole-archive ./libs/libOpenCL.a ../../../../riscv-gnu-toolchain/drops/riscv32-unknown-elf/lib/libc.a ../../../../riscv-gnu-toolchain/drops/riscv32-unknown-elf/lib/libstdc++.a -static-libgcc -lgcc +LIBS = -Wl,--whole-archive ./libs/libvecadd.a -Wl,--no-whole-archive ./libs/libOpenCL.a $(RISCV_TOOL_PATH)/riscv32-unknown-elf/lib/libc.a $(RISCV_TOOL_PATH)/riscv32-unknown-elf/lib/libstdc++.a -static-libgcc -lgcc VX_MAIN = vx_pocl_main diff --git a/runtime/mains/vector_test/Makefile b/runtime/mains/vector_test/Makefile index f8bc6161..698718e8 100644 --- a/runtime/mains/vector_test/Makefile +++ b/runtime/mains/vector_test/Makefile @@ -1,12 +1,12 @@ -COMP = /home/priya/dev/riscv_vec/riscv-gnu/bin/riscv32-unknown-elf-gcc +RISCV_TOOL_PATH ?= $(wildcard ../../../../riscv-gnu-toolchain/drops) + +COMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-gcc CC_FLAGS = -ffreestanding -O0 -Wl,--gc-sections -nostartfiles -nostdlib -nostartfiles -nodefaultlibs -Wl,-Bstatic,-T,../vortex_link.ld -march=rv32imv -mabi=ilp32 -#DMP = /home/fares/dev/riscv-gnu-toolchain-vector/drops/bin/riscv32-unknown-elf-objdump -#CPY = /home/fares/dev/riscv-gnu-toolchain-vector/drops/bin/riscv32-unknown-elf-objcopy -DMP = /home/priya/dev/riscv_vec/riscv-gnu/bin/riscv32-unknown-elf-objdump -CPY = /home/priya/dev/riscv_vec/riscv-gnu/bin/riscv32-unknown-elf-objcopy +DMP = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objdump +CPY = $(RISCV_TOOL_PATH)/bin/riscv32-unknown-elf-objcopy # VX_STR = ../../startup/vx_start.s @@ -21,8 +21,7 @@ VX_API = ../../vx_api/vx_api.c VX_TEST = ../../tests/tests.c VX_FIO = ../../fileio/fileio.s VX_VEC = vx_vec.s -#LIBS = /home/fares/dev/riscv-gnu-toolchain-vector/drops/riscv32-unknown-elf/lib/libc.a /home/fares/dev/riscv-gnu-toolchain-vector/drops/riscv32-unknown-elf/lib/libstdc++.a -static-libgcc -lgcc -LIBS = /home/priya/dev/riscv_vec/riscv-gnu/riscv32-unknown-elf/lib/libc.a /home/priya/dev/riscv_vec/riscv-gnu/riscv32-unknown-elf/lib/libstdc++.a -static-libgcc -lgcc +LIBS = $(RISCV_TOOL_PATH)/riscv32-unknown-elf/lib/libc.a $(RISCV_TOOL_PATH)/riscv32-unknown-elf/lib/libstdc++.a -static-libgcc -lgcc VX_MAIN = vx_vector_main