toolchain: add powerpc SPE ABI support

Add the ability for buildroot to build an SPE ABI enabled toolchain.

This is mandatory for e500v1/v2 cores since they don't support classic
FPU mode as the e500mc does.

Useful for Freescale's PowerQUICC III and single/dual-core QorIQ
line of processors.

The new TARGET_ABI variable is used rather than TARGET_CFLAGS for
uclibc's UCLIBC_EXTRA_CFLAGS to avoid breakish CFLAGS leaking in, a
good example being -mthumb for ARM.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
This commit is contained in:
Gustavo Zacarias 2012-01-05 16:31:43 -03:00 committed by Peter Korsgaard
parent c2c06aad27
commit 5a6087d62e
4 changed files with 48 additions and 3 deletions

View File

@ -31,6 +31,21 @@ ABI=eabi
endif endif
endif endif
# For FSL PowerPC there's SPE
ifeq ($(BR2_powerpc_SPE),y)
ABI=spe
# MPC8540s are e500v1 with single precision FP
ifeq ($(BR2_powerpc_8540),y)
TARGET_ABI+=-mabi=spe -mfloat-gprs=single -Wa,-me500
endif
ifeq ($(BR2_powerpc_8548),y)
TARGET_ABI+=-mabi=spe -mfloat-gprs=double -Wa,-me500x2
endif
ifeq ($(BR2_powerpc_e500mc),y)
TARGET_ABI+=-mabi=spe -mfloat-gprs=double -Wa,-me500mc
endif
endif
REAL_GNU_TARGET_NAME=$(ARCH)-unknown-linux-$(LIBC)$(ABI) REAL_GNU_TARGET_NAME=$(ARCH)-unknown-linux-$(LIBC)$(ABI)
STAGING_DIR=$(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)/sysroot STAGING_DIR=$(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)/sysroot
@ -60,7 +75,7 @@ ifeq ($(BR2_DEBUG_3),y)
TARGET_DEBUGGING=-g3 TARGET_DEBUGGING=-g3
endif endif
TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) TARGET_CFLAGS=$(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
ifneq ($(BR2_PREFER_STATIC_LIB),y) ifneq ($(BR2_PREFER_STATIC_LIB),y)
ifeq ($(BR2_x86_64),y) ifeq ($(BR2_x86_64),y)

View File

@ -447,7 +447,9 @@ config BR2_powerpc_860
config BR2_powerpc_970 config BR2_powerpc_970
bool "970" bool "970"
config BR2_powerpc_8540 config BR2_powerpc_8540
bool "8540" bool "8540 / e500v1"
config BR2_powerpc_8548
bool "8548 / e500v2"
comment "e300c2 needs gcc >= 4.4.x" comment "e300c2 needs gcc >= 4.4.x"
config BR2_powerpc_e300c2 config BR2_powerpc_e300c2
bool "e300c2" bool "e300c2"
@ -459,6 +461,22 @@ config BR2_powerpc_e500mc
bool "e500mc" bool "e500mc"
endchoice endchoice
choice
prompt "Target ABI"
depends on BR2_powerpc
default BR2_powerpc_CLASSIC if BR2_powerpc_e500mc
default BR2_powerpc_SPE if BR2_powerpc_8540 || BR2_powerpc_8548
help
Application Binary Interface to use
config BR2_powerpc_CLASSIC
bool "Classic"
depends on !(BR2_powerpc_8540 || BR2_powerpc_8548)
config BR2_powerpc_SPE
bool "SPE"
depends on BR2_powerpc_8540 || BR2_powerpc_8548 || BR2_powerpc_e500mc
endchoice
config BR2_ARCH config BR2_ARCH
string string
default "arm" if BR2_arm default "arm" if BR2_arm
@ -614,6 +632,7 @@ config BR2_GCC_TARGET_TUNE
default 860 if BR2_powerpc_860 default 860 if BR2_powerpc_860
default 970 if BR2_powerpc_970 default 970 if BR2_powerpc_970
default 8540 if BR2_powerpc_8540 default 8540 if BR2_powerpc_8540
default 8548 if BR2_powerpc_8548
default e300c2 if BR2_powerpc_e300c2 default e300c2 if BR2_powerpc_e300c2
default e300c3 if BR2_powerpc_e300c3 default e300c3 if BR2_powerpc_e300c3
default e500mc if BR2_powerpc_e500mc default e500mc if BR2_powerpc_e500mc

View File

@ -47,6 +47,11 @@ EXTRA_GCC_CONFIG_OPTIONS+=--disable-libmudflap
SOFT_FLOAT_CONFIG_OPTION:= SOFT_FLOAT_CONFIG_OPTION:=
endif endif
# Disable mudflap and enable proper double/long double for SPE ABI
ifeq ($(BR2_powerpc_SPE),y)
EXTRA_GCC_CONFIG_OPTIONS+=--disable-libmudflap --enable-e500_double --with-long-double-128
endif
ifeq ($(BR2_PACKAGE_GCC_TARGET),y) ifeq ($(BR2_PACKAGE_GCC_TARGET),y)
EXTRA_TARGET_GCC_CONFIG_OPTIONS:= EXTRA_TARGET_GCC_CONFIG_OPTIONS:=

View File

@ -217,7 +217,7 @@ ifeq ($(UCLIBC_TARGET_ARCH),sparc)
$(SED) 's/^.*$(UCLIBC_SPARC_TYPE)[^B].*/$(UCLIBC_SPARC_TYPE)=y/g' $(UCLIBC_DIR)/.oldconfig $(SED) 's/^.*$(UCLIBC_SPARC_TYPE)[^B].*/$(UCLIBC_SPARC_TYPE)=y/g' $(UCLIBC_DIR)/.oldconfig
endif endif
ifeq ($(UCLIBC_TARGET_ARCH),powerpc) ifeq ($(UCLIBC_TARGET_ARCH),powerpc)
ifeq ($(BR2_powerpc_8540)$(BR2_powerpc_e500mc),y) ifeq ($(BR2_powerpc_8540)$(BR2_powerpc_8548)$(BR2_powerpc_e500mc),y)
/bin/echo "# CONFIG_CLASSIC is not set" >> $(UCLIBC_DIR)/.oldconfig /bin/echo "# CONFIG_CLASSIC is not set" >> $(UCLIBC_DIR)/.oldconfig
/bin/echo "CONFIG_E500=y" >> $(UCLIBC_DIR)/.oldconfig /bin/echo "CONFIG_E500=y" >> $(UCLIBC_DIR)/.oldconfig
else else
@ -385,6 +385,7 @@ $(UCLIBC_DIR)/.config: $(UCLIBC_DIR)/.oldconfig
DEVEL_PREFIX=/usr/ \ DEVEL_PREFIX=/usr/ \
RUNTIME_PREFIX=$(TOOLCHAIN_DIR)/uClibc_dev/ \ RUNTIME_PREFIX=$(TOOLCHAIN_DIR)/uClibc_dev/ \
CROSS_COMPILE="$(TARGET_CROSS)" \ CROSS_COMPILE="$(TARGET_CROSS)" \
UCLIB_EXTRA_CFLAGS="$(TARGET_ABI)" \
HOSTCC="$(HOSTCC)" \ HOSTCC="$(HOSTCC)" \
oldconfig oldconfig
touch $@ touch $@
@ -403,6 +404,7 @@ $(UCLIBC_DIR)/.configured: $(LINUX_HEADERS_DIR)/.configured $(UCLIBC_DIR)/.confi
DEVEL_PREFIX=/usr/ \ DEVEL_PREFIX=/usr/ \
RUNTIME_PREFIX=$(TOOLCHAIN_DIR)/uClibc_dev/ \ RUNTIME_PREFIX=$(TOOLCHAIN_DIR)/uClibc_dev/ \
CROSS_COMPILE="$(TARGET_CROSS)" \ CROSS_COMPILE="$(TARGET_CROSS)" \
UCLIB_EXTRA_CFLAGS="$(TARGET_ABI)" \
HOSTCC="$(HOSTCC)" headers \ HOSTCC="$(HOSTCC)" headers \
lib/crt1.o lib/crti.o lib/crtn.o \ lib/crt1.o lib/crti.o lib/crtn.o \
install_headers install_headers
@ -424,6 +426,7 @@ $(UCLIBC_DIR)/lib/libc.a: $(UCLIBC_DIR)/.configured $(gcc_intermediate) $(LIBFLO
DEVEL_PREFIX=/ \ DEVEL_PREFIX=/ \
RUNTIME_PREFIX=/ \ RUNTIME_PREFIX=/ \
CROSS_COMPILE="$(TARGET_CROSS)" \ CROSS_COMPILE="$(TARGET_CROSS)" \
UCLIB_EXTRA_CFLAGS="$(TARGET_ABI)" \
HOSTCC="$(HOSTCC)" \ HOSTCC="$(HOSTCC)" \
all all
touch -c $@ touch -c $@
@ -435,6 +438,7 @@ uclibc-menuconfig: dirs $(UCLIBC_DIR)/.config
DEVEL_PREFIX=/usr/ \ DEVEL_PREFIX=/usr/ \
RUNTIME_PREFIX=$(TOOLCHAIN_DIR)/uClibc_dev/ \ RUNTIME_PREFIX=$(TOOLCHAIN_DIR)/uClibc_dev/ \
CROSS_COMPILE="$(TARGET_CROSS)" \ CROSS_COMPILE="$(TARGET_CROSS)" \
UCLIB_EXTRA_CFLAGS="$(TARGET_ABI)" \
HOSTCC="$(HOSTCC)" \ HOSTCC="$(HOSTCC)" \
menuconfig && \ menuconfig && \
touch -c $(UCLIBC_DIR)/.config touch -c $(UCLIBC_DIR)/.config
@ -447,6 +451,7 @@ $(STAGING_DIR)/usr/lib/libc.a: $(UCLIBC_DIR)/lib/libc.a
DEVEL_PREFIX=/usr/ \ DEVEL_PREFIX=/usr/ \
RUNTIME_PREFIX=/ \ RUNTIME_PREFIX=/ \
CROSS_COMPILE="$(TARGET_CROSS)" \ CROSS_COMPILE="$(TARGET_CROSS)" \
UCLIB_EXTRA_CFLAGS="$(TARGET_ABI)" \
install_runtime install_dev install_runtime install_dev
# Install the kernel headers to the staging dir if necessary # Install the kernel headers to the staging dir if necessary
if [ ! -f $(STAGING_DIR)/usr/include/linux/version.h ]; then \ if [ ! -f $(STAGING_DIR)/usr/include/linux/version.h ]; then \
@ -477,6 +482,7 @@ $(TARGET_DIR)/lib/libc.so.0: $(STAGING_DIR)/usr/lib/libc.a
DEVEL_PREFIX=/usr/ \ DEVEL_PREFIX=/usr/ \
RUNTIME_PREFIX=/ \ RUNTIME_PREFIX=/ \
CROSS_COMPILE="$(TARGET_CROSS)" \ CROSS_COMPILE="$(TARGET_CROSS)" \
UCLIB_EXTRA_CFLAGS="$(TARGET_ABI)" \
install_runtime install_runtime
touch -c $@ touch -c $@