From f139fafceb3d6f6fc9211146b2bdea4af4508dac Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sat, 4 Mar 2017 01:56:00 +0100 Subject: riscv: start experimenting with riscv32 / newlib toolchain --- target/arch.lst | 1 + target/config/Config.in.binutils | 3 +++ target/config/Config.in.compiler | 3 +++ target/config/Config.in.cpu | 7 +++++++ target/config/Config.in.libc | 10 ++++++++-- target/riscv/Makefile | 43 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 target/riscv/Makefile (limited to 'target') 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 -- cgit v1.2.3