Переглянути джерело

rework toolchain support for ARM.

Use --with-cpu for gcc to have optimized code for
requested ARM cpus.
Add some basic support for cortex-m3.
Waldemar Brodkorb 10 роки тому
батько
коміт
ec3f682d79

+ 1 - 1
Config.in

@@ -18,8 +18,8 @@ source "target/config/Config.in.kernel"
 source "target/config/Config.in.arch"
 source "target/config/Config.in.arch"
 source "target/config/Config.in.system"
 source "target/config/Config.in.system"
 source "target/config/Config.in.endian"
 source "target/config/Config.in.endian"
-source "target/config/Config.in.abi"
 source "target/config/Config.in.arm"
 source "target/config/Config.in.arm"
+source "target/config/Config.in.abi"
 source "target/config/Config.in.cris"
 source "target/config/Config.in.cris"
 source "target/config/Config.in.x86"
 source "target/config/Config.in.x86"
 source "target/config/Config.in.qemu"
 source "target/config/Config.in.qemu"

+ 3 - 0
target/arm/Makefile

@@ -28,6 +28,9 @@ endif
 ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_VEXPRESS_A9),y)
 ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_VEXPRESS_A9),y)
 QEMU_ARGS+=-M vexpress-a9 -cpu cortex-a9 -net user -net nic,model=lan9118
 QEMU_ARGS+=-M vexpress-a9 -cpu cortex-a9 -net user -net nic,model=lan9118
 endif
 endif
+ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_STELLARIS_M3),y)
+QEMU_ARGS+=-M lm3s6965evb -cpu cortex-m3
+endif
 ifeq ($(ADK_TARGET_QEMU_WITH_VIRTIO),y)
 ifeq ($(ADK_TARGET_QEMU_WITH_VIRTIO),y)
 QEMU_ARGS+=-drive file=qemu-${ADK_TARGET_CPU_ARCH}.img,if=virtio,index=0 -net nic,model=virtio -net user
 QEMU_ARGS+=-drive file=qemu-${ADK_TARGET_CPU_ARCH}.img,if=virtio,index=0 -net nic,model=virtio -net user
 endif
 endif

+ 16 - 11
target/config/Config.in.arm.choice

@@ -2,21 +2,26 @@
 # material, please see the LICENCE file in the top-level directory.
 # material, please see the LICENCE file in the top-level directory.
 
 
 choice ADK_TARGET_ARM_CPU_ARCH
 choice ADK_TARGET_ARM_CPU_ARCH
-prompt "CPU architecture"
+prompt "CPU architecture and family"
 depends on ADK_TARGET_TOOLCHAIN && ADK_LINUX_ARM
 depends on ADK_TARGET_TOOLCHAIN && ADK_LINUX_ARM
-default ADK_CPU_ARMV7A
 
 
-config ADK_CPU_ARMV5TE
-        boolean "armv5te"
-        select ADK_armv5te
+config ADK_CPU_ARMV7A_CORTEX_A9
+        boolean "cortex-a9 (armv7-a)"
+        select ADK_CPU_CORTEX_A9
 
 
-config ADK_CPU_ARMV6
-        boolean "armv6"
-        select ADK_armv6
+config ADK_CPU_ARMV7M_CORTEX_M3
+        boolean "cortex-m3 (armv7-m)"
+        select ADK_CPU_CORTEX_M3
+	select ADK_LINUX_ARM_WITH_THUMB
+	select ADK_TARGET_UCLINUX
 
 
-config ADK_CPU_ARMV7A
-        boolean "armv7-a"
-        select ADK_armv7a
+config ADK_CPU_ARMV6_ARM1176JZF_S
+        boolean "arm1176jzf-s (armv6)"
+        select ADK_CPU_ARM1176JZF_S
+
+config ADK_CPU_ARMV5TE_ARM926EJ_S
+        boolean "arm926ej-s (armv5te)"
+        select ADK_CPU_ARM926EJ_S
 
 
 endchoice
 endchoice
 
 

+ 0 - 15
target/config/Config.in.arm.default

@@ -1,21 +1,6 @@
 # This file is part of the OpenADK project. OpenADK is copyrighted
 # This file is part of the OpenADK project. OpenADK is copyrighted
 # material, please see the LICENCE file in the top-level directory.
 # material, please see the LICENCE file in the top-level directory.
 
 
-config ADK_armv5te
-	boolean
-
-config ADK_armv6
-	boolean
-
-config ADK_armv7a
-	boolean
-
-config ADK_TARGET_ARM_CPU
-	string
-	default "armv5te" if ADK_armv5te
-	default "armv6" if ADK_armv6
-	default "armv7-a" if ADK_armv7a
-
 config ADK_soft_float
 config ADK_soft_float
 	boolean
 	boolean
 
 

+ 3 - 0
target/config/Config.in.cpu

@@ -113,6 +113,9 @@ config ADK_CPU_ARM926EJ_S
 config ADK_CPU_ARM1176JZF_S
 config ADK_CPU_ARM1176JZF_S
 	boolean
 	boolean
 
 
+config ADK_CPU_CORTEX_M3
+	boolean
+
 config ADK_CPU_CORTEX_A9
 config ADK_CPU_CORTEX_A9
 	boolean
 	boolean
 
 

+ 8 - 0
target/config/Config.in.qemu

@@ -56,6 +56,14 @@ config ADK_TARGET_QEMU_ARM_MODEL_VEXPRESS_A9
 	boolean "ARM Ltd. Versatile Express for Cortex-A9"
 	boolean "ARM Ltd. Versatile Express for Cortex-A9"
 	select ADK_CPU_CORTEX_A9
 	select ADK_CPU_CORTEX_A9
 
 
+config ADK_TARGET_QEMU_ARM_MODEL_STELLARIS_M3
+	boolean "Stellaris LM3S6965EVB"
+	select ADK_soft_float
+	select ADK_eabi
+	select ADK_CPU_CORTEX_M3
+	select ADK_LINUX_ARM_WITH_THUMB
+	depends on ADK_TARGET_ARM_SOFT_FLOAT
+
 config ADK_TARGET_QEMU_ARM_MODEL_VERSATILEPB
 config ADK_TARGET_QEMU_ARM_MODEL_VERSATILEPB
 	boolean "ARM Ltd. Versatile/PB"
 	boolean "ARM Ltd. Versatile/PB"
 	select ADK_soft_float
 	select ADK_soft_float

+ 4 - 3
target/config/Config.in.target

@@ -22,7 +22,7 @@ config ADK_TARGET_CFLAGS
 	default "-march=atom" if ADK_CPU_ATOM
 	default "-march=atom" if ADK_CPU_ATOM
 	default "-march=amdfam10" if ADK_CPU_AMDFAM10
 	default "-march=amdfam10" if ADK_CPU_AMDFAM10
 	default "-mcpu=v8" if ADK_CPU_SPARC_V8
 	default "-mcpu=v8" if ADK_CPU_SPARC_V8
-	default "-m64 -mcpu=ultrasparc" if ADK_CPU_SPARC_V9
+	default "-mcpu=ultrasparc -m64" if ADK_CPU_SPARC_V9
 	default "-march=loongson2f -Wa,-mfix-loongson2f-nop" if ADK_CPU_LOONGSON2F
 	default "-march=loongson2f -Wa,-mfix-loongson2f-nop" if ADK_CPU_LOONGSON2F
 	default "-march=mips32" if ADK_CPU_MIPS32
 	default "-march=mips32" if ADK_CPU_MIPS32
 	default "-march=mips64" if ADK_CPU_MIPS64
 	default "-march=mips64" if ADK_CPU_MIPS64
@@ -32,8 +32,9 @@ config ADK_TARGET_CFLAGS
 	default "-march=armv5te -mtune=arm926ej-s -mfloat-abi=hard" if ADK_CPU_ARM926EJ_S && ADK_hard_float
 	default "-march=armv5te -mtune=arm926ej-s -mfloat-abi=hard" if ADK_CPU_ARM926EJ_S && ADK_hard_float
 	default "-march=armv6 -mtune=arm1176jzf-s -mfloat-abi=soft" if ADK_CPU_ARM1176JZF_S && ADK_soft_float
 	default "-march=armv6 -mtune=arm1176jzf-s -mfloat-abi=soft" if ADK_CPU_ARM1176JZF_S && ADK_soft_float
 	default "-march=armv6 -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard" if ADK_CPU_ARM1176JZF_S && ADK_hard_float
 	default "-march=armv6 -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard" if ADK_CPU_ARM1176JZF_S && ADK_hard_float
-	default "-march=armv7-a -mtune=cortex-a9 -mfloat-abi=soft" if ADK_CPU_CORTEX_A9 && ADK_soft_float
-	default "-march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard" if ADK_CPU_CORTEX_A9 && ADK_hard_float
+	default "-mcpu=cortex-m3 -mfloat-abi=soft" if ADK_CPU_CORTEX_M3 && ADK_soft_float
+	default "-mcpu=cortex-a9 -mfloat-abi=soft" if ADK_CPU_CORTEX_A9 && ADK_soft_float
+	default "-mcpu=cortex-a9 -mfpu=neon -mfloat-abi=hard" if ADK_CPU_CORTEX_A9 && ADK_hard_float
 	default "-march=armv5te" if ADK_CPU_ARMV5TE
 	default "-march=armv5te" if ADK_CPU_ARMV5TE
 	default "-march=armv6" if ADK_CPU_ARMV6
 	default "-march=armv6" if ADK_CPU_ARMV6
 	default "-march=armv7-a" if ADK_CPU_ARMV7A
 	default "-march=armv7-a" if ADK_CPU_ARMV7A

+ 3 - 2
target/config/Config.in.toolchain

@@ -130,11 +130,12 @@ config ADK_TARGET_CFLAGS_OPT_O0
 endchoice
 endchoice
 
 
 config ADK_LINUX_ARM_WITH_THUMB
 config ADK_LINUX_ARM_WITH_THUMB
-	prompt "Use THUMB2 ARM mode"
+	prompt "Use THUMB2 only mode"
 	boolean
 	boolean
-	depends on ADK_CPU_CORTEX_A9 && ADK_TARGET_LIB_GLIBC
 	select ADK_KERNEL_THUMB2_KERNEL
 	select ADK_KERNEL_THUMB2_KERNEL
 	default n
 	default n
+	help
+	  Experimental option. Use with care.
 
 
 config ADK_TOOLCHAIN_WITH_SSP
 config ADK_TOOLCHAIN_WITH_SSP
 	boolean
 	boolean

+ 7 - 15
toolchain/gcc/Makefile

@@ -126,28 +126,20 @@ GCC_CONFOPTS+=		--with-fpu=$(ADK_TARGET_FPU)
 endif
 endif
 endif
 endif
 
 
-ifeq ($(ADK_CPU_ARMV5TE),y)
-GCC_CONFOPTS+=		--with-arch=armv5te
-endif
-
-ifeq ($(ADK_CPU_ARMV6),y)
-GCC_CONFOPTS+=		--with-arch=armv6
-endif
-
-ifeq ($(ADK_CPU_ARMV7A),y)
-GCC_CONFOPTS+=		--with-arch=armv7-a
-endif
-
 ifeq ($(ADK_CPU_ARM926EJ_S),y)
 ifeq ($(ADK_CPU_ARM926EJ_S),y)
-GCC_CONFOPTS+=		--with-arch=armv5te --with-tune=arm926ej-s
+GCC_CONFOPTS+=		--with-cpu=arm926ej-s
 endif
 endif
 
 
 ifeq ($(ADK_CPU_ARM1176JZF_S),y)
 ifeq ($(ADK_CPU_ARM1176JZF_S),y)
-GCC_CONFOPTS+=		--with-arch=armv6 --with-tune=arm1176jzf-s
+GCC_CONFOPTS+=		--with-cpu=arm1176jzf-s
+endif
+
+ifeq ($(ADK_CPU_CORTEX_M3),y)
+GCC_CONFOPTS+=		--with-cpu=cortex-m3
 endif
 endif
 
 
 ifeq ($(ADK_CPU_CORTEX_A9),y)
 ifeq ($(ADK_CPU_CORTEX_A9),y)
-GCC_CONFOPTS+=		--with-arch=armv7-a --with-tune=cortex-a9
+GCC_CONFOPTS+=		--with-cpu=cortex-a9
 endif
 endif
 
 
 ifeq ($(ADK_CPU_SPARC_V9),y)
 ifeq ($(ADK_CPU_SPARC_V9),y)