From 40b0e9c937b3098fce9e570d2ce4f3a057456bd0 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Tue, 16 Feb 2016 09:02:05 +0100 Subject: add nds32 bare-metal toolchain support --- target/arch.lst | 1 + target/config/Config.in.cpu | 7 +++++ target/config/Config.in.endian | 1 + target/config/Config.in.libc | 3 ++ target/nds32/Makefile | 56 ++++++++++++++++++++++++++++++++++++ target/nds32/systems/toolchain-nds32 | 8 ++++++ toolchain/Makefile | 2 +- 7 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 target/nds32/Makefile create mode 100644 target/nds32/systems/toolchain-nds32 diff --git a/target/arch.lst b/target/arch.lst index 2220ac21f..4c4cfa33d 100644 --- a/target/arch.lst +++ b/target/arch.lst @@ -16,6 +16,7 @@ metag microblaze mips mips64 +nds32 nios2 or1k ppc diff --git a/target/config/Config.in.cpu b/target/config/Config.in.cpu index 7ca935f74..89f5a68ab 100644 --- a/target/config/Config.in.cpu +++ b/target/config/Config.in.cpu @@ -844,6 +844,11 @@ config ADK_CPU_MICROBLAZE select ADK_TARGET_WITH_MMU if !ADK_LINUX_UCLINUX select ADK_TARGET_WITH_NPTL if ADK_TARGET_LIB_GLIBC || ADK_TARGET_LIB_MUSL +config ADK_CPU_NDS32 + bool + select ADK_TARGET_WITH_NPTL + select ADK_TARGET_WITH_MMU + config ADK_CPU_NIOS2 bool select ADK_TARGET_WITH_LT if ADK_TARGET_LIB_UCLIBC_NG @@ -1377,6 +1382,8 @@ config ADK_TARGET_CPU_ARCH default "mips64el" if ADK_TARGET_ARCH_MIPS64 && ADK_TARGET_LITTLE_ENDIAN default "mips" if ADK_TARGET_ARCH_MIPS && ADK_TARGET_BIG_ENDIAN default "mipsel" if ADK_TARGET_ARCH_MIPS && ADK_TARGET_LITTLE_ENDIAN + default "nds32le" if ADK_TARGET_ARCH_NDS32 && ADK_TARGET_LITTLE_ENDIAN + default "nds32be" if ADK_TARGET_ARCH_NDS32 && ADK_TARGET_BIG_ENDIAN default "nios2" if ADK_TARGET_ARCH_NIOS2 default "or1k" if ADK_TARGET_ARCH_OR1K default "ppc" if ADK_TARGET_ARCH_PPC diff --git a/target/config/Config.in.endian b/target/config/Config.in.endian index 599f878f9..cd1151a4e 100644 --- a/target/config/Config.in.endian +++ b/target/config/Config.in.endian @@ -10,6 +10,7 @@ depends on ADK_TARGET_ARCH_ARC \ || ADK_TARGET_ARCH_MICROBLAZE \ || ADK_TARGET_ARCH_MIPS \ || ADK_TARGET_ARCH_MIPS64 \ + || ADK_TARGET_ARCH_NDS32 \ || ADK_TARGET_ARCH_PPC64 \ || ADK_TARGET_ARCH_SH \ || ADK_TARGET_ARCH_XTENSA diff --git a/target/config/Config.in.libc b/target/config/Config.in.libc index d1fb33f7f..9c68fdbec 100644 --- a/target/config/Config.in.libc +++ b/target/config/Config.in.libc @@ -8,6 +8,7 @@ config ADK_TARGET_LIB_UCLIBC_NG bool "uClibc-ng embedded C library" depends on \ !ADK_TARGET_ARCH_AARCH64 && \ + !ADK_TARGET_ARCH_NDS32 && \ !ADK_TARGET_ARCH_S390 && \ !ADK_TARGET_ARCH_SPARC64 && \ !ADK_TARGET_ARCH_PPC64 && \ @@ -39,6 +40,7 @@ config ADK_TARGET_LIB_GLIBC depends on !ADK_TARGET_ARCH_BFIN depends on !ADK_TARGET_ARCH_CRIS depends on !ADK_TARGET_ARCH_H8300 + depends on !ADK_TARGET_ARCH_NDS32 depends on !ADK_TARGET_ARCH_XTENSA depends on !ADK_TARGET_UCLINUX depends on !ADK_TARGET_WITHOUT_MMU @@ -57,6 +59,7 @@ config ADK_TARGET_LIB_NEWLIB ADK_TARGET_ARCH_LM32 || \ ADK_TARGET_ARCH_MICROBLAZE || \ ADK_TARGET_ARCH_MIPS || \ + ADK_TARGET_ARCH_NDS32 || \ ADK_TARGET_ARCH_OR1K || \ ADK_TARGET_ARCH_PPC || \ ADK_TARGET_ARCH_SPARC || \ diff --git a/target/nds32/Makefile b/target/nds32/Makefile new file mode 100644 index 000000000..3d8f8d42b --- /dev/null +++ b/target/nds32/Makefile @@ -0,0 +1,56 @@ +# 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)/$(ADK_TARGET_KERNEL) + +# target helper text +ifeq ($(ADK_TARGET_FS),archive) +targethelp: + @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSTARBALL)" +endif +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 +ifeq ($(ADK_TARGET_FS),nfsroot) +targethelp: + @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}' + @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)" +endif + +kernel-strip: + @cp $(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),archive) +imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp +endif +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 +ifeq ($(ADK_TARGET_FS),nfsroot) +imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp +endif diff --git a/target/nds32/systems/toolchain-nds32 b/target/nds32/systems/toolchain-nds32 new file mode 100644 index 000000000..268f5289c --- /dev/null +++ b/target/nds32/systems/toolchain-nds32 @@ -0,0 +1,8 @@ +config ADK_TARGET_SYSTEM_TOOLCHAIN_NDS32 + bool "Toolchain only" + select ADK_CPU_NDS32 + select ADK_TARGET_TOOLCHAIN + select ADK_TARGET_PACKAGE_TXZ + help + NDS32 toolchain. + diff --git a/toolchain/Makefile b/toolchain/Makefile index b1aaac653..c85839fe8 100644 --- a/toolchain/Makefile +++ b/toolchain/Makefile @@ -37,7 +37,7 @@ ELF2FLT:=elf2flt-install endif # disable gdb for some architectures -ifeq ($(ADK_TARGET_ARCH_ARC)$(ADK_TARGET_ARCH_METAG)$(ADK_TARGET_ARCH_OR1K),) +ifeq ($(ADK_TARGET_ARCH_ARC)$(ADK_TARGET_ARCH_NDS32)$(ADK_TARGET_ARCH_METAG)$(ADK_TARGET_ARCH_OR1K),) TARGETS+=gdb GDB:=gdb-install endif -- cgit v1.2.3