From d6c9603c41b3d11400cee7b5b409203af0632aa2 Mon Sep 17 00:00:00 2001 From: Paul Burton Date: Tue, 27 May 2014 15:18:42 +0100 Subject: [PATCH] build: mipsel cross compiler support This patch introduces support for building a MIPS cross compiler targetting little endian machines by default. Change-Id: I116f6f431cdf80f5f5f58d2743357a9f70a7347d Signed-off-by: Paul Burton Reviewed-on: https://chromium-review.googlesource.com/207970 Reviewed-by: Aaron Durbin Reviewed-by: David Hendricks --- toolchain.inc | 6 +++++- util/crossgcc/Makefile | 2 ++ util/xcompile/xcompile | 11 ++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/toolchain.inc b/toolchain.inc index 86e8b60363..6dd88c3611 100644 --- a/toolchain.inc +++ b/toolchain.inc @@ -19,11 +19,12 @@ ####################################################################### -ARCH_SUPPORTED := ARM ARM64 X86_32 +ARCH_SUPPORTED := ARM ARM64 X86_32 MIPS ARCH_TO_TOOLCHAIN_X86_32 := x86_32 ARCH_TO_TOOLCHAIN_ARM := arm ARCH_TO_TOOLCHAIN_ARM64 := arm64 +ARCH_TO_TOOLCHAIN_MIPS := mipsel COREBOOT_STANDARD_STAGES := bootblock verstage romstage ramstage @@ -31,10 +32,13 @@ ARCHDIR-i386 := x86 ARCHDIR-arm := arm ARCHDIR-arm64 := arm64 ARCHDIR-x86_32 := x86 +ARCHDIR-mipsel := mips CFLAGS_arm := -mno-unaligned-access -ffunction-sections -fdata-sections CFLAGS_arm64 := -ffunction-sections -fdata-sections +CFLAGS_mipsel := -mips32r2 -G 0 + toolchain_to_dir = \ $(foreach arch,$(ARCH_SUPPORTED),\ $(eval INCLUDES_$(ARCH_TO_TOOLCHAIN_$(arch)) = \ diff --git a/util/crossgcc/Makefile b/util/crossgcc/Makefile index 3d7739206b..209ce67426 100644 --- a/util/crossgcc/Makefile +++ b/util/crossgcc/Makefile @@ -4,12 +4,14 @@ build: bash ./buildgcc -G -p i386-elf bash ./buildgcc -G -p armv7a-eabi bash ./buildgcc -G -p aarch64-elf + bash ./buildgcc -G -p mipsel-elf .PHONY: build-without-gdb build-without-gdb: bash ./buildgcc -p i386-elf bash ./buildgcc -p armv7a-eabi bash ./buildgcc -p aarch64-elf + bash ./buildgcc -p mipsel-elf clean: rm -rf xgcc diff --git a/util/xcompile/xcompile b/util/xcompile/xcompile index cb5eb09aad..5215c48f58 100644 --- a/util/xcompile/xcompile +++ b/util/xcompile/xcompile @@ -115,6 +115,9 @@ detect_special_flags() { arm ) testcc "$CC" "$CFLAGS" && CFLAGS="$CFLAGS" ;; + mipsel ) + testcc "$CC" "$CFLAGS" + ;; esac } @@ -140,7 +143,7 @@ touch "$TMPFILE" trap clean_up EXIT # Architecture definition -SUPPORTED_ARCHITECTURE="x86 arm aarch64" +SUPPORTED_ARCHITECTURE="x86 arm aarch64 mipsel" # ARM Architecture TARCH_arm="arm" @@ -161,6 +164,12 @@ TCLIST_x86="i386 x86_64" TWIDTH_x86="32" XGCCPATH=${1:-"`pwd`/util/crossgcc/xgcc/bin/"} +# MIPS Architecture (Little Endian) +TARCH_mipsel="mipsel" +TBFDARCH_mipsel="littlemips" +TCLIST_mipsel="mipsel" +TWIDTH_mipsel="32" + # This loops over all supported architectures. for architecture in $SUPPORTED_ARCHITECTURE; do GCCPREFIX="invalid"