Explorar o código

rework CFLAGS and default gcc --with-cpu usage

For better maintenance, rework hardware model specific
CFLAGS. Work in progress, needs moe testing.
Waldemar Brodkorb %!s(int64=9) %!d(string=hai) anos
pai
achega
b1619be7fa

+ 12 - 2
mk/vars.mk

@@ -101,12 +101,22 @@ TARGET_CXX+=		$(ADK_TARGET_ABI_CFLAGS)
 endif
 
 TARGET_CPPFLAGS:=	
-TARGET_CFLAGS:=		$(ADK_TARGET_CFLAGS) -fwrapv -fno-ident -fhonour-copts
-TARGET_CXXFLAGS:=	$(ADK_TARGET_CFLAGS) -fwrapv -fno-ident -fhonour-copts
+TARGET_CFLAGS:=		-fwrapv -fno-ident -fhonour-copts
+TARGET_CXXFLAGS:=	-fwrapv -fno-ident -fhonour-copts
 TARGET_LDFLAGS:=	-L$(STAGING_TARGET_DIR)/lib -L$(STAGING_TARGET_DIR)/usr/lib \
 			-Wl,-O1 -Wl,-rpath -Wl,/usr/lib \
 			-Wl,-rpath-link -Wl,${STAGING_TARGET_DIR}/usr/lib
 
+ifneq ($(ADK_TARGET_CPU),)
+ifeq ($(ADK_CPU_ARC700),y)
+TARGET_CFLAGS+=		-mcpu=ARC700
+TARGET_CXXFLAGS+=	-mcpu=ARC700
+else
+TARGET_CFLAGS+=		-mcpu=$(ADK_TARGET_CPU)
+TARGET_CXXFLAGS+=	-mcpu=$(ADK_TARGET_CPU)
+endif
+endif
+
 ifeq ($(ADK_TARGET_BINFMT_FLAT),y)
 TARGET_LDFLAGS+=	-elf2flt
 endif

+ 1 - 0
rules.mk

@@ -33,6 +33,7 @@ ADK_TARGET_KERNEL:=			$(strip $(subst ",, $(ADK_TARGET_KERNEL)))
 ADK_TARGET_LIBC:=			$(strip $(subst ",, $(ADK_TARGET_LIBC)))
 ADK_TARGET_LIBC_PATH:=			$(strip $(subst ",, $(ADK_TARGET_LIBC_PATH)))
 ADK_TARGET_ENDIAN:=			$(strip $(subst ",, $(ADK_TARGET_ENDIAN)))
+ADK_TARGET_CPU:=			$(strip $(subst ",, $(ADK_TARGET_CPU)))
 ADK_TARGET_FLOAT:=			$(strip $(subst ",, $(ADK_TARGET_FLOAT)))
 ADK_TARGET_FPU:=			$(strip $(subst ",, $(ADK_TARGET_FPU)))
 ADK_TARGET_ARM_MODE:=			$(strip $(subst ",, $(ADK_TARGET_ARM_MODE)))

+ 1 - 1
target/aarch64/systems/arm-fm

@@ -3,8 +3,8 @@ config ADK_TARGET_SYSTEM_ARM_FM
 	select ADK_aarch64
 	select ADK_arm_fm
 	select ADK_little
-	select ADK_CPU_ARMV8
 	select ADK_LINUX_64
+	select ADK_CPU_CORTEX_A57
 	select ADK_TARGET_KERNEL_IMAGE
 	select ADK_PACKAGE_BOOT_WRAPPER_AARCH64
 	select ADK_TARGET_WITH_SERIAL

+ 1 - 1
target/aarch64/systems/qemu-aarch64

@@ -4,7 +4,7 @@ config ADK_TARGET_SYSTEM_QEMU_AARCH64
 	select ADK_qemu_aarch64
 	select ADK_little
 	select ADK_LINUX_64
-	select ADK_CPU_ARMV8
+	select ADK_CPU_CORTEX_A57
 	select ADK_TARGET_QEMU
 	select ADK_TARGET_KERNEL_IMAGE
 	help

+ 1 - 1
target/aarch64/systems/toolchain-aarch64

@@ -3,7 +3,7 @@ config ADK_TARGET_SYSTEM_TOOLCHAIN_AARCH64
 	select ADK_aarch64
 	select ADK_toolchain_aarch64
 	select ADK_little
-	select ADK_CPU_ARMV8
+	select ADK_CPU_CORTEX_A57
 	select ADK_LINUX_64
 	select ADK_TARGET_TOOLCHAIN
 	select ADK_TARGET_PACKAGE_TXZ

+ 1 - 1
target/alpha/systems/qemu-alpha

@@ -4,7 +4,7 @@ config ADK_TARGET_SYSTEM_QEMU_ALPHA
 	select ADK_qemu_alpha
 	select ADK_TARGET_QEMU
 	select ADK_LINUX_64
-	select ADK_LINUX_ALPHA
+	select ADK_CPU_ALPHA
 	help
 	 Support for Qemu Emulator ALPHA architecture.
 

+ 1 - 1
target/alpha/systems/toolchain-alpha

@@ -5,7 +5,7 @@ config ADK_TARGET_SYSTEM_TOOLCHAIN_ALPHA
 	select ADK_TARGET_TOOLCHAIN
 	select ADK_TARGET_PACKAGE_TXZ
 	select ADK_LINUX_64
-	select ADK_LINUX_ALPHA
+	select ADK_CPU_ALPHA
 	help
 	  ALPHA toolchain.
 

+ 1 - 1
target/arc/systems/toolchain-arc

@@ -2,7 +2,7 @@ config ADK_TARGET_SYSTEM_TOOLCHAIN_ARC
 	bool "Toolchain only"
 	select ADK_arc
 	select ADK_toolchain_arc
-	select ADK_CPU_ARC
+	select ADK_CPU_ARC700
 	select ADK_TARGET_TOOLCHAIN
 	select ADK_TARGET_PACKAGE_TXZ
 	help

+ 2 - 2
target/avr32/uclibc.config

@@ -88,9 +88,9 @@ UCLIBC_HAS_THREADS=y
 PTHREADS_DEBUG_SUPPORT=y
 UCLIBC_HAS_SYSLOG=y
 UCLIBC_HAS_LFS=y
-MALLOC=y
+# MALLOC is not set
 # MALLOC_SIMPLE is not set
-# MALLOC_STANDARD is not set
+MALLOC_STANDARD=y
 MALLOC_GLIBC_COMPAT=y
 UCLIBC_HAS_OBSTACK=y
 UCLIBC_DYNAMIC_ATEXIT=y

+ 1 - 1
target/config/Config.in.arm.choice

@@ -33,7 +33,7 @@ config ADK_CPU_ARMV5TE_ARM926EJ_S
         bool "arm926ej-s (armv5te)"
         select ADK_CPU_ARM926EJ_S
 
-config ADK_CPU_XSCALE
+config ADK_CPU_ARMV5TE_XSCALE
         bool "xscale"
         select ADK_CPU_XSCALE
 

+ 60 - 6
target/config/Config.in.cpu

@@ -13,7 +13,12 @@ config ADK_CPU_AMDFAM10
 	select ADK_TARGET_WITH_NPTL
 	select ADK_TARGET_WITH_MMU
 
-config ADK_CPU_ARC
+config ADK_CPU_ARC700
+	bool
+	select ADK_TARGET_WITH_NPTL
+	select ADK_TARGET_WITH_MMU
+
+config ADK_CPU_ARCv2EM
 	bool
 	select ADK_TARGET_WITH_NPTL
 	select ADK_TARGET_WITH_MMU
@@ -56,8 +61,12 @@ config ADK_CPU_C6X
 	bool
 	select ADK_TARGET_WITH_LT
 
+config ADK_CPU_CF
+	bool
+
 config ADK_CPU_CF_5208
 	bool
+	select ADK_CPU_CF
 	select ADK_TARGET_WITH_LT
 
 config ADK_CPU_CORTEX_M3
@@ -80,6 +89,16 @@ config ADK_CPU_CORTEX_A9
 	select ADK_TARGET_WITH_MMU
 	select ADK_TARGET_CPU_WITH_FPU_VFP3
 
+config ADK_CPU_CORTEX_A53
+	bool
+	select ADK_TARGET_WITH_NPTL
+	select ADK_TARGET_WITH_MMU
+
+config ADK_CPU_CORTEX_A57
+	bool
+	select ADK_TARGET_WITH_NPTL
+	select ADK_TARGET_WITH_MMU
+
 config ADK_CPU_CRIS_V10
 	bool
 	select ADK_TARGET_WITH_LT
@@ -258,17 +277,52 @@ config ADK_TARGET_CPU_WITH_3DNOW
 config ADK_TARGET_CPU_WITH_3DNOWEXT
 	bool
 
+config ADK_TARGET_CPU
+	string
+	default "440" if ADK_CPU_PPC_440
+	default "5208" if ADK_CPU_CF_5208
+	default "amdfam10" if ADK_CPU_AMDFAM10
+	default "arc700" if ADK_CPU_ARC700
+	default "arcv2em" if ADK_CPU_ARCv2EM
+	default "arm1176jzf-s" if ADK_CPU_ARM1176JZF_S
+	default "arm926ej-s" if ADK_CPU_ARM926EJ_S
+	default "armv8-a" if ADK_CPU_ARMV8
+	default "athlon" if ADK_CPU_ATHLON
+	default "atom" if ADK_CPU_ATOM
+	default "cortex-a7" if ADK_CPU_CORTEX_A7
+	default "cortex-a9" if ADK_CPU_CORTEX_A9
+	default "cortex-a53" if ADK_CPU_CORTEX_A53
+	default "cortex-a57" if ADK_CPU_CORTEX_A57
+	default "cortex-m3" if ADK_CPU_CORTEX_M3
+	default "cortex-m4" if ADK_CPU_CORTEX_M4
+	default "geode" if ADK_CPU_GEODE
+	default "i486" if ADK_CPU_I486
+	default "i586" if ADK_CPU_I586
+	default "i686" if ADK_CPU_I686
+	default "loongson2f" if ADK_CPU_LOONGSON2F
+	default "mips32" if ADK_CPU_MIPS32
+	default "mips32r2" if ADK_CPU_MIPS32R2
+	default "mips64" if ADK_CPU_MIPS64
+	default "mips64r2" if ADK_CPU_MIPS64R2
+	default "pentium-m" if ADK_CPU_PENTIUM_M
+	default "powerpc" if ADK_CPU_PPC
+	default "powerpc64" if ADK_CPU_PPC64
+	default "ultrasparc" if ADK_CPU_SPARC_V9
+	default "v10" if ADK_CPU_CRIS_V10
+	default "v32" if ADK_CPU_CRIS_V32
+	default "v7.10.d" if ADK_CPU_MICROBLAZE
+	default "v8" if ADK_CPU_SPARC_V8
+	default "x86-64" if ADK_CPU_X86_64
+	default "xscale" if ADK_CPU_XSCALE
+
 config ADK_TARGET_CPU_ARCH
 	string
 	default "aarch64" if ADK_TARGET_ARCH_AARCH64 && ADK_little
 	default "alpha" if ADK_TARGET_ARCH_ALPHA
-	default "armv5te" if ADK_TARGET_ARCH_ARM && ADK_little && ADK_armv5te
-	default "armv6" if ADK_TARGET_ARCH_ARM && ADK_little && ADK_armv6
-	default "armv7a" if ADK_TARGET_ARCH_ARM && ADK_little && ADK_armv7a
 	default "arm" if ADK_TARGET_ARCH_ARM && ADK_little
 	default "armeb" if ADK_TARGET_ARCH_ARM && ADK_big
-	default "arc" if ADK_CPU_ARC && ADK_little
-	default "arceb" if ADK_CPU_ARC && ADK_big
+	default "arc" if ADK_TARGET_ARCH_ARC && ADK_little
+	default "arceb" if ADK_TARGET_ARCH_ARC && ADK_big
 	default "avr32" if ADK_CPU_AVR32
 	default "bfin" if ADK_CPU_BFIN
 	default "c6x" if ADK_CPU_C6X

+ 0 - 38
target/config/Config.in.target

@@ -1,44 +1,6 @@
 # This file is part of the OpenADK project. OpenADK is copyrighted
 # material, please see the LICENCE file in the top-level directory.
 
-config ADK_TARGET_CFLAGS
-	string
-	default "-march=v32" if ADK_CPU_CRIS_V32
-	default "-march=v10" if ADK_CPU_CRIS_V10
-	default "-mcpu=5208" if ADK_CPU_CF_5208
-	default "-mcpu=v7.10.d" if ADK_CPU_MICROBLAZE
-	default "-m4 -ml" if ADK_CPU_SH4 && ADK_little
-	default "-m4 -mb" if ADK_CPU_SH4 && ADK_big
-	default "-mcpu=powerpc" if ADK_CPU_PPC
-	default "-mcpu=440" if ADK_CPU_PPC_440
-	default "-mcpu=powerpc64" if ADK_CPU_PPC64
-	default "-march=geode" if ADK_CPU_GEODE
-	default "-march=i486" if ADK_CPU_I486
-	default "-march=i586" if ADK_CPU_I586
-	default "-march=i686" if ADK_CPU_I686
-	default "-march=x86-64" if ADK_CPU_X86_64
-	default "-march=athlon" if ADK_CPU_ATHLON
-	default "-march=pentium-m" if ADK_CPU_PENTIUM_M
-	default "-march=atom" if ADK_CPU_ATOM
-	default "-march=amdfam10" if ADK_CPU_AMDFAM10
-	default "-mcpu=v8" if ADK_CPU_SPARC_V8
-	default "-mcpu=ultrasparc -m64" if ADK_CPU_SPARC_V9
-	default "-march=loongson2f -Wa,-mfix-loongson2f-nop" if ADK_CPU_LOONGSON2F
-	default "-march=mips32" if ADK_CPU_MIPS32
-	default "-march=mips32r2" if ADK_CPU_MIPS32R2
-	default "-march=mips64" if ADK_CPU_MIPS64
-	default "-march=armv8-a" if ADK_CPU_ARMV8
-	default "-march=armv5te -mtune=iwmmxt" if ADK_CPU_XSCALE
-	default "-march=armv5te -mtune=arm926ej-s" if ADK_CPU_ARM926EJ_S
-	default "-march=armv6 -mtune=arm1176jzf-s" if ADK_CPU_ARM1176JZF_S
-	default "-mcpu=cortex-m3" if ADK_CPU_CORTEX_M3
-	default "-mcpu=cortex-m4" if ADK_CPU_CORTEX_M3
-	default "-mcpu=cortex-a7" if ADK_CPU_CORTEX_A7
-	default "-mcpu=cortex-a9" if ADK_CPU_CORTEX_A9
-	default "-march=armv5te" if ADK_CPU_ARMV5TE
-	default "-march=armv6" if ADK_CPU_ARMV6
-	default "-march=armv7-a" if ADK_CPU_ARMV7A
-
 config ADK_TARGET_CMDLINE
 	string
 	default "fbcon=rotate:1" if ADK_TARGET_SYSTEM_SHARP_ZAURUS

+ 14 - 51
toolchain/gcc/Makefile

@@ -84,11 +84,24 @@ endif
 #
 # architecture specific
 #
+ifneq ($(ADK_TARGET_CPU),)
+GCC_CONFOPTS+=		--with-cpu=$(ADK_TARGET_CPU)
+endif
 
-ifneq ($(ADK_TARGET_ARCH_ARM)$(ADK_TARGET_ARCH_MIPS)$(ADK_TARGET_ARCH_PPC),)
 ifneq ($(ADK_TARGET_FLOAT),)
 GCC_CONFOPTS+=		--with-float=$(ADK_TARGET_FLOAT)
 endif
+
+ifneq ($(ADK_TARGET_FPU),)
+GCC_CONFOPTS+=		--with-fpu=$(ADK_TARGET_FPU)
+endif
+
+ifeq ($(ADK_TARGET_ARCH_ARM_WITH_THUMB),y)
+GCC_CONFOPTS+=		--with-mode=thumb
+endif
+
+ifeq ($(ADK_CPU_CF),y)
+GCC_CONFOPTS+=		--enable-multilib --with-arch=cf
 endif
 
 ifeq ($(ADK_TARGET_ARCH_M68K)$(ADK_TARGET_ARCH_SH)$(ADK_TARGET_ARCH_X86_64)$(ADK_TARGET_ARCH_X86),)
@@ -125,56 +138,6 @@ ifeq ($(ADK_TARGET_ARCH_PPC),y)
 GCC_CONFOPTS+=		--with-long-double-64 --enable-secureplt
 endif
 
-ifeq ($(ADK_TARGET_ARCH_ARM),y)
-ifneq ($(ADK_TARGET_FPU),)
-GCC_CONFOPTS+=		--with-fpu=$(ADK_TARGET_FPU)
-endif
-endif
-
-ifeq ($(ADK_CPU_ARM926EJ_S),y)
-GCC_CONFOPTS+=		--with-cpu=arm926ej-s
-endif
-
-ifeq ($(ADK_CPU_ARM1176JZF_S),y)
-GCC_CONFOPTS+=		--with-cpu=arm1176jzf-s
-endif
-
-ifeq ($(ADK_CPU_CORTEX_M3),y)
-GCC_CONFOPTS+=		--with-cpu=cortex-m3 --with-mode=thumb
-endif
-
-ifeq ($(ADK_CPU_CORTEX_M4),y)
-GCC_CONFOPTS+=		--with-cpu=cortex-m4 --with-mode=thumb
-endif
-
-ifeq ($(ADK_CPU_CORTEX_A7),y)
-GCC_CONFOPTS+=		--with-cpu=cortex-a7
-endif
-
-ifeq ($(ADK_CPU_CORTEX_A9),y)
-GCC_CONFOPTS+=		--with-cpu=cortex-a9
-endif
-
-ifeq ($(ADK_CPU_XSCALE),y)
-GCC_CONFOPTS+=		--with-cpu=xscale
-endif
-
-ifeq ($(ADK_CPU_SPARC_V8),y)
-GCC_CONFOPTS+=		--with-cpu=v8
-endif
-
-ifeq ($(ADK_CPU_SPARC_V9),y)
-GCC_CONFOPTS+=		--with-cpu=ultrasparc
-endif
-
-ifeq ($(ADK_CPU_ARC),y)
-GCC_CONFOPTS+=		--with-cpu=arc700
-endif
-
-ifeq ($(ADK_CPU_CF_5208),y)
-GCC_CONFOPTS+=		--enable-multilib --with-arch=cf --with-cpu=5208
-endif
-
 ifneq ($(ADK_TARGET_MIPS_ABI),)
 GCC_CONFOPTS+=		--with-abi=${ADK_TARGET_MIPS_ABI}
 endif