nuttx/arch/arm/src/armv7-r/Toolchain.defs
Xiang Xiao b329e2377d boards: Move toolchain related variables to Toolchain.defs
1.It make sense to let Toolchain.defs give the default value
2.The board can still change if the default isn't suitable
3.Avoid the same definition spread more than 200 Make.defs

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ic2649f1c7689bcf59c105ca8db61cad45b6e0e64
2020-07-20 17:10:37 +01:00

117 lines
3.2 KiB
Plaintext

############################################################################
# arch/arm/src/armv7-r/Toolchain.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
# Setup for the selected toolchain
#
# Select and allow the selected toolchain to be overridden by a command-line
#selection.
#
ifeq ($(filter y, \
$(CONFIG_ARMV7R_TOOLCHAIN_BUILDROOT) \
),y)
CONFIG_ARMV7R_TOOLCHAIN ?= BUILDROOT
endif
ifeq ($(filter y, \
$(CONFIG_ARMV7R_TOOLCHAIN_GNU_EABIL) \
),y)
CONFIG_ARMV7R_TOOLCHAIN ?= GNU_EABI
endif
ifeq ($(filter y, \
$(CONFIG_ARMV7R_TOOLCHAIN_GNU_EABIW) \
),y)
CONFIG_ARMV7R_TOOLCHAIN ?= GNU_EABI
endif
#
# Supported toolchains
#
# Each toolchain definition should set:
#
# CROSSDEV The GNU toolchain triple (command prefix)
# ARCROSSDEV If required, an alternative prefix used when
# invoking ar and nm.
# ARCHCPUFLAGS CPU-specific flags selecting the instruction set
# FPU options, etc.
# MAXOPTIMIZATION The maximum optimization level that results in
# reliable code generation.
#
ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)
MAXOPTIMIZATION := $(CONFIG_DEBUG_OPTLEVEL)
endif
ifeq ($(CONFIG_ENDIAN_BIG),y)
TARGET_ARCH := armeb
else
TARGET_ARCH := arm
endif
# NuttX buildroot under Linux or Cygwin
ifeq ($(CONFIG_ARMV7R_TOOLCHAIN),BUILDROOT)
ifeq ($(CONFIG_ARMV7R_OABI_TOOLCHAIN),y)
CROSSDEV ?= $(TARGET_ARCH)-nuttx-elf-
ARCROSSDEV ?= $(TARGET_ARCH)-nuttx-elf-
else
CROSSDEV ?= $(TARGET_ARCH)-nuttx-eabi-
ARCROSSDEV ?= $(TARGET_ARCH)-nuttx-eabi-
endif
MAXOPTIMIZATION ?= -Os
endif
# Generic GNU EABI toolchain
ifeq ($(CONFIG_ARMV7R_TOOLCHAIN),GNU_EABI)
CROSSDEV ?= $(TARGET_ARCH)-none-eabi-
ARCROSSDEV ?= $(TARGET_ARCH)-none-eabi-
MAXOPTIMIZATION ?= -Os
endif
# Default toolchain
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E -P -x c
LD = $(CROSSDEV)ld
STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(ARCROSSDEV)ar rcs
NM = $(ARCROSSDEV)nm
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
# Add the builtin library
EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name}}"
ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}"
endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}"
endif