Browse Source

add basic infrastructure for superh toolchains with sh2/sh3/sh4a cpus

Waldemar Brodkorb 9 years ago
parent
commit
b92dc96d7f

+ 26 - 2
target/config/Config.in.cpu

@@ -499,11 +499,25 @@ config ADK_CPU_PPC64
 	select ADK_TARGET_WITH_NPTL
 	select ADK_TARGET_WITH_MMU
 
+config ADK_CPU_SH2
+	bool
+
+config ADK_CPU_SH2A
+	bool
+
+config ADK_CPU_SH3
+	bool
+
 config ADK_CPU_SH4
 	bool
 	select ADK_TARGET_WITH_NPTL
 	select ADK_TARGET_WITH_MMU
 
+config ADK_CPU_SH4A
+	bool
+	select ADK_TARGET_WITH_NPTL
+	select ADK_TARGET_WITH_MMU
+
 config ADK_CPU_SPARC_V8
 	bool
 	select ADK_TARGET_WITH_NPTL
@@ -676,6 +690,11 @@ config ADK_TARGET_CPU_FLAGS
 	default "-mcpu=v10" if ADK_CPU_CRIS_V10
 	default "-mcpu=v32" if ADK_CPU_CRIS_V32
 	default "-mcpu=v7.10.d" if ADK_CPU_MICROBLAZE
+	default "-m2" if ADK_CPU_SH2
+	default "-m2a" if ADK_CPU_SH2A
+	default "-m3" if ADK_CPU_SH3
+	default "-m4" if ADK_CPU_SH4
+	default "-m4a" if ADK_CPU_SH4A
 
 config ADK_TARGET_CPU_TYPE
 	string
@@ -784,8 +803,13 @@ config ADK_TARGET_CPU_ARCH
 	default "ppc" if ADK_CPU_PPC
 	default "ppc" if ADK_CPU_PPC_440
 	default "ppc64" if ADK_CPU_PPC64
-	default "sh4" if ADK_TARGET_ARCH_SH && ADK_TARGET_LITTLE_ENDIAN
-	default "sh4eb" if ADK_TARGET_ARCH_SH && ADK_TARGET_BIG_ENDIAN
+	default "sh2" if ADK_CPU_SH2
+	default "sh2a" if ADK_CPU_SH2A
+	default "sh3" if ADK_CPU_SH3
+	default "sh4" if ADK_CPU_SH4 && ADK_TARGET_LITTLE_ENDIAN
+	default "sh4eb" if ADK_CPU_SH4 && ADK_TARGET_BIG_ENDIAN
+	default "sh4a" if ADK_CPU_SH4A && ADK_TARGET_LITTLE_ENDIAN
+	default "sh4aeb" if ADK_CPU_SH4A && ADK_TARGET_BIG_ENDIAN
 	default "sparc" if ADK_TARGET_ARCH_SPARC
 	default "sparc64" if ADK_TARGET_ARCH_SPARC64
 	default "tilegx" if ADK_CPU_TILE

+ 26 - 0
target/config/Config.in.tc

@@ -10,6 +10,7 @@ depends on ADK_TARGET_TOOLCHAIN && \
 	|| ADK_TARGET_ARCH_ARM \
 	|| ADK_TARGET_ARCH_BFIN \
 	|| ADK_TARGET_ARCH_M68K \
+	|| ADK_TARGET_ARCH_SH \
 	|| ADK_TARGET_ARCH_X86 )
 
 config ADK_TARGET_CPU_ARC_ARC700
@@ -408,6 +409,31 @@ config ADK_TARGET_CPU_M68K_68060
 	select ADK_CPU_68060
 	depends on ADK_TARGET_ARCH_M68K
 
+config ADK_TARGET_CPU_SH_SH2
+	bool "sh2"
+	select ADK_CPU_SH2
+	depends on ADK_TARGET_ARCH_SH
+
+config ADK_TARGET_CPU_SH_SH2A
+	bool "sh2a"
+	select ADK_CPU_SH2A
+	depends on ADK_TARGET_ARCH_SH
+
+config ADK_TARGET_CPU_SH_SH3
+	bool "sh3"
+	select ADK_CPU_SH3
+	depends on ADK_TARGET_ARCH_SH
+
+config ADK_TARGET_CPU_SH_SH4
+	bool "sh4"
+	select ADK_CPU_SH4
+	depends on ADK_TARGET_ARCH_SH
+
+config ADK_TARGET_CPU_SH_SH4A
+	bool "sh4a"
+	select ADK_CPU_SH4A
+	depends on ADK_TARGET_ARCH_SH
+
 config ADK_TARGET_CPU_X86_I486
 	bool "i486"
 	select ADK_CPU_I486

+ 0 - 1
target/sh/systems/toolchain-sh

@@ -1,6 +1,5 @@
 config ADK_TARGET_SYSTEM_TOOLCHAIN_SH
 	bool "Toolchain only"
-	select ADK_CPU_SH4
 	select ADK_TARGET_TOOLCHAIN
 	select ADK_TARGET_PACKAGE_TXZ
 	help

+ 14 - 0
toolchain/gcc/Makefile

@@ -123,8 +123,22 @@ GCC_CONFOPTS+=		--with-endian=little
 else
 GCC_CONFOPTS+=          --with-endian=big
 endif
+ifeq ($(ADK_CPU_SH2),y)
+GCC_FINAL_CONFOPTS+=	--with-multilib-list=m2
+endif
+ifeq ($(ADK_CPU_SH2A),y)
+GCC_FINAL_CONFOPTS+=	--with-multilib-list=m2a
+endif
+ifeq ($(ADK_CPU_SH3),y)
+GCC_FINAL_CONFOPTS+=	--with-multilib-list=m3
+endif
+ifeq ($(ADK_CPU_SH4),y)
 GCC_FINAL_CONFOPTS+=	--with-multilib-list=m4,m4-nofpu
 endif
+ifeq ($(ADK_CPU_SH4A),y)
+GCC_FINAL_CONFOPTS+=	--with-multilib-list=m4a,m4a-nofpu
+endif
+endif
 
 ifeq ($(ADK_TARGET_ARCH_X86),y)
 ifeq ($(ADK_TARGET_KERNEL_64),y)

+ 29 - 0
toolchain/uclibc-ng/Makefile

@@ -197,6 +197,35 @@ ifeq ($(ADK_CPU_MIPS32R2),y)
 endif
 endif
 
+# sh
+ifeq ($(ADK_TARGET_ARCH_SH),y)
+ifeq ($(ADK_CPU_SH4),y)
+	$(SED) 's/.*\(CONFIG_SH2A=\).*/# \1 is not set/' ${WRKBUILD}/.config
+	$(SED) 's/.*\(CONFIG_SH2=\).*/# \1 is not set/' ${WRKBUILD}/.config
+	$(SED) 's/.*\(CONFIG_SH3=\).*/# \1 is not set/' ${WRKBUILD}/.config
+	$(SED) 's/.*\(CONFIG_SH4\).*/\1=y/' ${WRKBUILD}/.config
+endif
+ifeq ($(ADK_CPU_SH3),y)
+	$(SED) 's/.*\(CONFIG_SH2A=\).*/# \1 is not set/' ${WRKBUILD}/.config
+	$(SED) 's/.*\(CONFIG_SH2=\).*/# \1 is not set/' ${WRKBUILD}/.config
+	$(SED) 's/.*\(CONFIG_SH4=\).*/# \1 is not set/' ${WRKBUILD}/.config
+	$(SED) 's/.*\(CONFIG_SH3\).*/\1=y/' ${WRKBUILD}/.config
+endif
+ifeq ($(ADK_CPU_SH2),y)
+	$(SED) 's/.*\(CONFIG_SH2A=\).*/# \1 is not set/' ${WRKBUILD}/.config
+	$(SED) 's/.*\(CONFIG_SH3=\).*/# \1 is not set/' ${WRKBUILD}/.config
+	$(SED) 's/.*\(CONFIG_SH4=\).*/# \1 is not set/' ${WRKBUILD}/.config
+	$(SED) 's/.*\(CONFIG_SH2\).*/\1=y/' ${WRKBUILD}/.config
+endif
+ifeq ($(ADK_CPU_SH2A),y)
+	$(SED) 's/.*\(CONFIG_SH2A=\).*/# \1 is not set/' ${WRKBUILD}/.config
+	$(SED) 's/.*\(CONFIG_SH3=\).*/# \1 is not set/' ${WRKBUILD}/.config
+	$(SED) 's/.*\(CONFIG_SH4=\).*/# \1 is not set/' ${WRKBUILD}/.config
+	$(SED) 's/.*\(CONFIG_SH2A\).*/\1=y/' ${WRKBUILD}/.config
+endif
+endif
+
+# x86
 ifeq ($(ADK_TARGET_ARCH_X86),y)
 ifeq ($(ADK_CPU_I486),y)
 	$(SED) 's/.*\(CONFIG_686\).*/# \1 is not set/' ${WRKBUILD}/.config