summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--target/arch.lst1
-rw-r--r--target/config/Config.in.binutils3
-rw-r--r--target/config/Config.in.compiler3
-rw-r--r--target/config/Config.in.cpu7
-rw-r--r--target/config/Config.in.libc10
-rw-r--r--target/riscv/Makefile43
-rw-r--r--toolchain/newlib/Makefile.inc7
-rw-r--r--toolchain/newlib/patches/riscv-newlib-2.4.0/fix-tooldir.patch12
8 files changed, 84 insertions, 2 deletions
diff --git a/target/arch.lst b/target/arch.lst
index 03f3f26e1..abd8c25d7 100644
--- a/target/arch.lst
+++ b/target/arch.lst
@@ -27,6 +27,7 @@ nios2
or1k
ppc
ppc64
+riscv
rx
s390
sparc
diff --git a/target/config/Config.in.binutils b/target/config/Config.in.binutils
index 41686ed31..9a4eef086 100644
--- a/target/config/Config.in.binutils
+++ b/target/config/Config.in.binutils
@@ -28,6 +28,7 @@ config ADK_TOOLCHAIN_BINUTILS_2_27
depends on !ADK_TARGET_ARCH_ARC
depends on !ADK_TARGET_ARCH_AVR32
depends on !ADK_TARGET_ARCH_NDS32
+ depends on !ADK_TARGET_ARCH_RISCV
depends on !ADK_TARGET_CPU_CRIS_CRISV10
config ADK_TOOLCHAIN_BINUTILS_2_26_1
@@ -37,6 +38,7 @@ config ADK_TOOLCHAIN_BINUTILS_2_26_1
depends on !ADK_TARGET_ARCH_FRV
depends on !ADK_TARGET_ARCH_H8300
depends on !ADK_TARGET_ARCH_NDS32
+ depends on !ADK_TARGET_ARCH_RISCV
depends on !ADK_TARGET_SYSTEM_NUMATO_MIMASV2
config ADK_TOOLCHAIN_BINUTILS_2_25_1
@@ -48,6 +50,7 @@ config ADK_TOOLCHAIN_BINUTILS_2_25_1
depends on !ADK_TARGET_ARCH_H8300
depends on !ADK_TARGET_ARCH_MOXIE
depends on !ADK_TARGET_ARCH_NDS32
+ depends on !ADK_TARGET_ARCH_RISCV
depends on !ADK_TARGET_CPU_CRIS_CRISV10
depends on !ADK_TARGET_SYSTEM_NUMATO_MIMASV2
diff --git a/target/config/Config.in.compiler b/target/config/Config.in.compiler
index a465cb66c..0543b6300 100644
--- a/target/config/Config.in.compiler
+++ b/target/config/Config.in.compiler
@@ -54,6 +54,7 @@ config ADK_TOOLCHAIN_GCC_6
depends on !ADK_TARGET_ARCH_METAG
depends on !ADK_TARGET_ARCH_NDS32
depends on !ADK_TARGET_ARCH_OR1K
+ depends on !ADK_TARGET_ARCH_RISCV
select ADK_DISABLE_HONOUR_CFLAGS
config ADK_TOOLCHAIN_GCC_5
@@ -71,6 +72,7 @@ config ADK_TOOLCHAIN_GCC_5
depends on !ADK_TARGET_ARCH_NIOS2
depends on !ADK_TARGET_ARCH_OR1K
depends on !ADK_TARGET_ARCH_LM32
+ depends on !ADK_TARGET_ARCH_RISCV
depends on !ADK_TARGET_SYSTEM_KINETIS_K70
depends on !(ADK_TARGET_LIB_GLIBC && ADK_TARGET_ARCH_SH)
depends on !ADK_TARGET_CPU_MIPS_MIPS32R6
@@ -90,6 +92,7 @@ config ADK_TOOLCHAIN_GCC_4_9
depends on !ADK_TARGET_ARCH_NIOS2
depends on !ADK_TARGET_ARCH_OR1K
depends on !ADK_TARGET_ARCH_TILE
+ depends on !ADK_TARGET_ARCH_RISCV
depends on !ADK_TARGET_CPU_MIPS_MIPS32R6
depends on !ADK_TARGET_CPU_MIPS64_MIPS64R6
depends on !ADK_TARGET_SYSTEM_NUMATO_MIMASV2
diff --git a/target/config/Config.in.cpu b/target/config/Config.in.cpu
index dc0b6275f..d7132e1ef 100644
--- a/target/config/Config.in.cpu
+++ b/target/config/Config.in.cpu
@@ -1009,6 +1009,12 @@ config ADK_TARGET_CPU_PPC64_POWER8
select ADK_TARGET_WITH_MMU
depends on ADK_TARGET_ARCH_PPC64
+# riscv
+config ADK_TARGET_CPU_RISCV
+ bool "riscv"
+ select ADK_TARGET_WITH_MMU
+ depends on ADK_TARGET_ARCH_RISCV
+
# rx
config ADK_TARGET_CPU_RX
bool "rx"
@@ -2049,6 +2055,7 @@ config ADK_TARGET_CPU_ARCH
default "ppc" if ADK_TARGET_ARCH_PPC
default "ppc64le" if ADK_TARGET_ARCH_PPC64 && ADK_TARGET_LITTLE_ENDIAN
default "ppc64" if ADK_TARGET_ARCH_PPC64 && ADK_TARGET_BIG_ENDIAN
+ default "riscv32" if ADK_TARGET_ARCH_RISCV
default "rx" if ADK_TARGET_ARCH_RX
default "s390x" if ADK_TARGET_ARCH_S390
default "sh" if ADK_TARGET_CPU_SH_SH && ADK_TARGET_LITTLE_ENDIAN
diff --git a/target/config/Config.in.libc b/target/config/Config.in.libc
index d649df303..83439d76b 100644
--- a/target/config/Config.in.libc
+++ b/target/config/Config.in.libc
@@ -110,6 +110,7 @@ config ADK_TARGET_LIB_NEWLIB
ADK_TARGET_ARCH_NDS32 || \
ADK_TARGET_ARCH_OR1K || \
ADK_TARGET_ARCH_PPC || \
+ ADK_TARGET_ARCH_RISCV || \
ADK_TARGET_ARCH_RX || \
ADK_TARGET_ARCH_SH || \
ADK_TARGET_ARCH_SPARC || \
@@ -152,11 +153,15 @@ config ADK_TARGET_LIB_MUSL_GIT
config ADK_TARGET_LIB_NEWLIB_2_5_0
bool "2.5.0"
- depends on ADK_TARGET_LIB_NEWLIB
+ depends on ADK_TARGET_LIB_NEWLIB && !ADK_TARGET_ARCH_RISCV
+
+config ADK_TARGET_LIB_NEWLIB_RISCV
+ bool "2.4.0-riscv"
+ depends on ADK_TARGET_LIB_NEWLIB && ADK_TARGET_ARCH_RISCV
config ADK_TARGET_LIB_NEWLIB_GIT
bool "git"
- depends on ADK_TARGET_LIB_NEWLIB
+ depends on ADK_TARGET_LIB_NEWLIB && !ADK_TARGET_ARCH_RISCV
endchoice
@@ -205,6 +210,7 @@ config ADK_LIBC_VERSION
default "1.1.16" if ADK_TARGET_LIB_MUSL_1_1_16
default "2.25" if ADK_TARGET_LIB_GLIBC_2_25
default "2.4.0" if ADK_TARGET_LIB_NEWLIB_2_4_0
+ default "2.4.0-riscv" if ADK_TARGET_LIB_NEWLIB_RISCV
default "git" if ADK_TARGET_LIB_UCLIBC_NG_GIT || \
ADK_TARGET_LIB_MUSL_GIT || \
ADK_TARGET_LIB_GLIBC_GIT || \
diff --git a/target/riscv/Makefile b/target/riscv/Makefile
new file mode 100644
index 000000000..30099fb55
--- /dev/null
+++ b/target/riscv/Makefile
@@ -0,0 +1,43 @@
+# This file is part of the OpenADK project. OpenADK is copyrighted
+# material, please see the LICENCE file in the top-level directory.
+
+include $(ADK_TOPDIR)/rules.mk
+include $(ADK_TOPDIR)/mk/kernel-build.mk
+include $(ADK_TOPDIR)/mk/image.mk
+
+KERNEL:=$(LINUX_DIR)/vmlinux
+OSTRIP:=-R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id
+QEMU_ARGS:=-nographic
+
+# target helper text
+ifeq ($(ADK_TARGET_FS),initramfs)
+targethelp:
+ @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
+ @echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
+endif
+ifeq ($(ADK_TARGET_FS),initramfsarchive)
+targethelp:
+ @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
+ @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
+endif
+ifeq ($(ADK_TARGET_FS),initramfspiggyback)
+targethelp:
+ @echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
+endif
+
+kernel-strip:
+ $(TARGET_CROSS)objcopy $(OSTRIP) -S $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
+
+kernel-install: kernel-strip
+ @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
+
+# filesystem specific targets
+ifeq ($(ADK_TARGET_FS),initramfs)
+imageinstall: kernel-install $(FW_DIR)/$(INITRAMFS) targethelp
+endif
+ifeq ($(ADK_TARGET_FS),initramfsarchive)
+imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
+endif
+ifeq ($(ADK_TARGET_FS),initramfspiggyback)
+imageinstall: createinitramfs targethelp
+endif
diff --git a/toolchain/newlib/Makefile.inc b/toolchain/newlib/Makefile.inc
index af2850d10..c006f553b 100644
--- a/toolchain/newlib/Makefile.inc
+++ b/toolchain/newlib/Makefile.inc
@@ -15,3 +15,10 @@ PKG_HASH:= 5b76a9b97c9464209772ed25ce55181a7bb144a66e5669aaec945aa64da3189b
PKG_SITES:= ftp://sourceware.org/pub/newlib/
DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz
endif
+ifeq ($(ADK_TARGET_LIB_NEWLIB_RISCV),y)
+PKG_VERSION:= riscv-newlib-2.4.0
+PKG_GIT:= branch
+PKG_RELEASE:= 1
+PKG_SITES:= https://github.com/riscv/riscv-newlib.git
+DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.xz
+endif
diff --git a/toolchain/newlib/patches/riscv-newlib-2.4.0/fix-tooldir.patch b/toolchain/newlib/patches/riscv-newlib-2.4.0/fix-tooldir.patch
new file mode 100644
index 000000000..652f7494b
--- /dev/null
+++ b/toolchain/newlib/patches/riscv-newlib-2.4.0/fix-tooldir.patch
@@ -0,0 +1,12 @@
+diff -Nur newlib-2.2.0-1.orig/configure newlib-2.2.0-1/configure
+--- newlib-2.2.0-1.orig/configure 2014-07-05 23:09:07.000000000 +0200
++++ newlib-2.2.0-1/configure 2015-11-25 06:33:11.461178398 +0100
+@@ -6985,7 +6985,7 @@
+
+ # Some systems (e.g., one of the i386-aix systems the gas testers are
+ # using) don't handle "\$" correctly, so don't use it here.
+-tooldir='${exec_prefix}'/${target_noncanonical}
++tooldir='${exec_prefix}'
+ build_tooldir=${tooldir}
+
+ # Create a .gdbinit file which runs the one in srcdir