[OpenWrt-Devel,1/4] toolchain: add support of nds32 architecture
diff mbox series

Message ID 20190611103042.31736-2-nylon7@andestech.com
State New
Headers show
Series
  • Add nds32 toolchain and ae3xx board support
Related show

Commit Message

Nylon Chen June 11, 2019, 10:30 a.m. UTC
This commit provides basic support for the
Andes 32-bit (nds32) architecture.

Signed-off-by: Che-Wei Chuang <cnoize@andestech.com>
Signed-off-by: Nylon Chen <nylon7@andestech.com>
---
 include/kernel.mk   |  2 ++
 include/site/nds32  | 33 +++++++++++++++++++++++++++++++++
 include/target.mk   |  4 ++++
 target/Config.in    |  5 +++++
 toolchain/Config.in |  9 ++++++---
 5 files changed, 50 insertions(+), 3 deletions(-)
 create mode 100644 include/site/nds32

Patch
diff mbox series

diff --git a/include/kernel.mk b/include/kernel.mk
index 3195090a0a..d0b5b779b9 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -85,6 +85,8 @@  ifneq (,$(findstring uml,$(BOARD)))
   LINUX_KARCH=um
 else ifneq (,$(findstring $(ARCH) , aarch64 aarch64_be ))
   LINUX_KARCH := arm64
+else ifneq (,$(findstring $(ARCH) , nds32 ))
+  LINUX_KARCH := nds32
 else ifneq (,$(findstring $(ARCH) , arceb ))
   LINUX_KARCH := arc
 else ifneq (,$(findstring $(ARCH) , armeb ))
diff --git a/include/site/nds32 b/include/site/nds32
new file mode 100644
index 0000000000..b0a0977671
--- /dev/null
+++ b/include/site/nds32
@@ -0,0 +1,33 @@ 
+ac_cv_c_littleendian=${ac_cv_c_littleendian=yes}
+ac_cv_c_bigendian=${ac_cv_c_bigendian=no}
+
+ac_cv_sizeof___int64=${ac_cv_sizeof___int64=0}
+ac_cv_sizeof_bool=${ac_cv_sizeof_bool=1}
+ac_cv_sizeof_char=${ac_cv_sizeof_char=1}
+ac_cv_sizeof_char_p=${ac_cv_sizeof_int_p=4}
+ac_cv_sizeof_double=${ac_cv_sizeof_double=8}
+ac_cv_sizeof_float=${ac_cv_sizeof_float=4}
+ac_cv_sizeof_int=${ac_cv_sizeof_int=4}
+ac_cv_sizeof_int_p=${ac_cv_sizeof_int_p=4}
+ac_cv_sizeof_long=${ac_cv_sizeof_long=4}
+ac_cv_sizeof_long_double=${ac_cv_sizeof_long_double=8}
+ac_cv_sizeof_long_int=${ac_cv_sizeof_long_int=4}
+ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long=8}
+ac_cv_sizeof_long_p=${ac_cv_sizeof_long_p=4}
+ac_cv_sizeof_off_t=${ac_cv_sizeof_off_t=4}
+ac_cv_sizeof_ptrdiff_t=${glib_cv_sizeof_ptrdiff_t=4}
+ac_cv_sizeof_short=${ac_cv_sizeof_short=2}
+ac_cv_sizeof_short_int=${ac_cv_sizeof_short_int=2}
+ac_cv_sizeof_signed_char=${ac_cv_sizeof_signed_char=1}
+ac_cv_sizeof_size_t=${ac_cv_sizeof_size_t=4}
+ac_cv_sizeof_unsigned_char=${ac_cv_sizeof_unsigned_char=1}
+ac_cv_sizeof_unsigned_short=${ac_cv_sizeof_unsigned_short=2}
+ac_cv_sizeof_unsigned=${ac_cv_sizeof_unsigned=4}
+ac_cv_sizeof_unsigned_int=${ac_cv_sizeof_unsigned_int=4}
+ac_cv_sizeof_unsigned_long=${ac_cv_sizeof_unsigned_long=4}
+ac_cv_sizeof_unsigned_long_long=${ac_cv_sizeof_unsigned_long_long=8}
+ac_cv_sizeof_void_p=${ac_cv_sizeof_void_p=4}
+ac_cv_sizeof_wchar_t=${ac_cv_sizeof_wchar_t=1}
+
+ac_cv_func_realloc_0_nonnull=yes
+ac_cv_func_malloc_0_nonnull=yes
diff --git a/include/target.mk b/include/target.mk
index 4f3bd43e6c..75e23f328f 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -176,6 +176,10 @@  ifeq ($(DUMP),1)
     CPU_CFLAGS_74kc = -mips32r2 -mtune=74kc
     CPU_CFLAGS_octeonplus = -march=octeon+ -mabi=64
   endif
+  ifeq ($(ARCH),nds32)
+    CPU_TYPE ?= nds32
+    CPU_CFLAGS += -march=v3
+  endif
   ifeq ($(ARCH),i386)
     CPU_TYPE ?= pentium
     CPU_CFLAGS_pentium = -march=pentium-mmx
diff --git a/target/Config.in b/target/Config.in
index 3ee23ebf7f..8d6aa8769c 100644
--- a/target/Config.in
+++ b/target/Config.in
@@ -192,6 +192,10 @@  config x86_64
 	select ARCH_64BIT
 	bool
 
+config nds32
+	select LITTLE_ENDIAN
+	bool
+
 config ARCH
 	string
 	default "aarch64"   if aarch64
@@ -215,4 +219,5 @@  config ARCH
 	default "sh4eb"     if sh4eb
 	default "sparc"     if sparc
 	default "x86_64"    if x86_64
+	default "nds32"	    if nds32
 
diff --git a/toolchain/Config.in b/toolchain/Config.in
index 82dddbc209..7cb65e803e 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -67,6 +67,7 @@  menuconfig EXTERNAL_TOOLCHAIN
 		default "mipsel-unknown-linux-gnu"   if mipsel
 		default "powerpc-unknown-linux-gnu"  if powerpc
 		default "x86_64-unknown-linux-gnu"   if x86_64
+		default "nds32le-linux"              if nds32
 
 	config TOOLCHAIN_PREFIX
 		string
@@ -81,6 +82,7 @@  menuconfig EXTERNAL_TOOLCHAIN
 		default "mipsel-unknown-linux-gnu-"   if mipsel
 		default "powerpc-unknown-linux-gnu-"  if powerpc
 		default "x86_64-unknown-linux-gnu-"   if x86_64
+		default "nds32le-linux-"              if nds32
 
 	config TOOLCHAIN_ROOT
 		string
@@ -113,11 +115,12 @@  menuconfig EXTERNAL_TOOLCHAIN
 		config EXTERNAL_TOOLCHAIN_LIBC_USE_UCLIBC
 			bool "uClibc"
 			select USE_UCLIBC
-			depends on !(aarch64 || aarch64_be)
+			depends on !(aarch64 || aarch64_be || nds32)
 
 		config EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL
 			bool "musl"
 			select USE_MUSL
+			depends on !nds32
 
 	endchoice
 
@@ -251,13 +254,13 @@  choice
 	config LIBC_USE_UCLIBC
 		select USE_UCLIBC
 		bool "Use uClibc"
-		depends on !(aarch64 || aarch64_be || powerpc64)
+		depends on !(aarch64 || aarch64_be || powerpc64 || nds32)
 		depends on BROKEN || !(arm || armeb || i386 || x86_64 || mips || mipsel || mips64 || mips64el || powerpc)
 
 	config LIBC_USE_MUSL
 		select USE_MUSL
 		bool "Use musl"
-		depends on !(arc || powerpc64)
+		depends on !(arc || powerpc64 || nds32)
 
 endchoice