From f6e087a05c6e8efff02e10c0deee6515708b334f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Goran=20Meki=C4=87?= Date: Tue, 24 Apr 2018 22:46:03 +0000 Subject: [PATCH] Merged in mekanix/nuttx/feature/clang (pull request #632) Add clang support to stm32f746g-disco board Approved-by: Gregory Nutt --- configs/stm32f746g-disco/scripts/Make.defs | 36 ++++++++++++++++------ tools/configure.sh | 7 ++++- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/configs/stm32f746g-disco/scripts/Make.defs b/configs/stm32f746g-disco/scripts/Make.defs index 70d2f9ec5f..354180c1c4 100644 --- a/configs/stm32f746g-disco/scripts/Make.defs +++ b/configs/stm32f746g-disco/scripts/Make.defs @@ -65,19 +65,39 @@ NM = $(ARCROSSDEV)nm OBJCOPY = $(CROSSDEV)objcopy OBJDUMP = $(CROSSDEV)objdump -ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'} -ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1} - -ifeq ($(CONFIG_DEBUG_SYMBOLS),y) - ARCHOPTIMIZATION = -g -endif - ifneq ($(CONFIG_DEBUG_NOOPT),y) ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer endif ARCHCFLAGS = -fno-builtin ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti + +ifeq ($(CONFIG_ARMV7M_TOOLCHAIN_CLANGL),y) + ARCHCCVERSION = {shell $(CC) -v 2>&1 | sed -n '/clang version/p' | sed -e 's/.* clang version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g'} + HOSTCC = clang + CC = clang + CXX = clang++ + CPP = clang -E + ARCHCFLAGS += -nostdlib -ffreestanding -target arm-none-eabi -march=armv7-m -mcpu=cortex-m7 + ARCHCXXFLAGS += -nostdlib -ffreestanding -target arm-none-eabi -march=armv7-m -mcpu=cortex-m7 -DCONFIG_WCHAR_BUILTIN +else + ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'} + HOSTCC = gcc + CC = $(CROSSDEV)gcc + CXX = $(CROSSDEV)g++ + CPP = $(CROSSDEV)gcc -E + ARCHCXXFLAGS += -fno-rtti + ifneq ($(CONFIG_DEBUG_NOOPT),y) + ARCHOPTIMIZATION += -fno-strength-reduce + endif +endif + + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + ARCHOPTIMIZATION = -g +endif + +ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1} ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef ARCHWARNINGSXX = -Wall -Wshadow -Wundef ARCHDEFINES = @@ -107,8 +127,6 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y) endif -HOSTCC = gcc HOSTINCLUDES = -I. HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe HOSTLDFLAGS = - diff --git a/tools/configure.sh b/tools/configure.sh index e4a6c5f29c..78a6c7b830 100755 --- a/tools/configure.sh +++ b/tools/configure.sh @@ -325,4 +325,9 @@ fi echo " Refreshing..." cd ${TOPDIR} || { echo "Failed to cd to ${TOPDIR}"; exit 1; } -make olddefconfig 1>/dev/null +MAKE_BIN=make +if [ ! -z `which gmake` ]; then + MAKE_BIN=gmake +fi + +${MAKE_BIN} olddefconfig 1>/dev/null