2015-12-14 08:40:38 -06:00
|
|
|
############################################################################
|
|
|
|
# arch/arm/src/armv7-r/Toolchain.defs
|
|
|
|
#
|
2020-05-13 08:18:31 -06:00
|
|
|
# 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
|
2015-12-14 08:40:38 -06:00
|
|
|
#
|
2020-05-13 08:18:31 -06:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2015-12-14 08:40:38 -06:00
|
|
|
#
|
2020-05-13 08:18:31 -06:00
|
|
|
# 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.
|
2015-12-14 08:40:38 -06:00
|
|
|
#
|
|
|
|
############################################################################
|
|
|
|
|
|
|
|
# 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, \
|
2022-04-19 14:38:36 +08:00
|
|
|
$(CONFIG_ARMV7R_TOOLCHAIN_GNU_EABI) \
|
2015-12-14 08:40:38 -06:00
|
|
|
),y)
|
2020-05-18 22:18:15 +08:00
|
|
|
CONFIG_ARMV7R_TOOLCHAIN ?= GNU_EABI
|
2015-12-14 08:40:38 -06:00
|
|
|
endif
|
|
|
|
|
|
|
|
#
|
|
|
|
# Supported toolchains
|
|
|
|
#
|
|
|
|
# Each toolchain definition should set:
|
|
|
|
#
|
|
|
|
# CROSSDEV The GNU toolchain triple (command prefix)
|
|
|
|
# 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)
|
2021-04-23 17:57:02 -03:00
|
|
|
else
|
|
|
|
MAXOPTIMIZATION ?= -Os
|
2015-12-14 08:40:38 -06:00
|
|
|
endif
|
|
|
|
|
2021-12-27 12:13:48 +08:00
|
|
|
ifeq ($(CONFIG_FRAME_POINTER),y)
|
|
|
|
MAXOPTIMIZATION += -fno-omit-frame-pointer -fno-optimize-sibling-calls
|
|
|
|
else
|
|
|
|
MAXOPTIMIZATION += -fomit-frame-pointer
|
|
|
|
endif
|
|
|
|
|
2022-02-28 17:26:15 +08:00
|
|
|
ifeq ($(CONFIG_ARCH_CORTEXR4),y)
|
|
|
|
ARCHCPUFLAGS += -mcpu=cortex-r4
|
|
|
|
else ifeq ($(CONFIG_ARCH_CORTEXR5),y)
|
|
|
|
ARCHCPUFLAGS += -mcpu=cortex-r5
|
|
|
|
else ifeq ($(CONFIG_ARCH_CORTEXR7),y)
|
|
|
|
ARCHCPUFLAGS += -mcpu=cortex-r7
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_ARCH_FPU),y)
|
|
|
|
ARCHCPUFLAGS += -mfpu=vfpv3-d16
|
|
|
|
ifeq ($(CONFIG_ARM_FPU_ABI_SOFT),y)
|
|
|
|
ARCHCPUFLAGS += -mfloat-abi=softfp
|
|
|
|
else
|
|
|
|
ARCHCPUFLAGS += -mfloat-abi=hard
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
ARCHCPUFLAGS += -mfloat-abi=soft
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_ENDIAN_BIG),y)
|
|
|
|
ARCHCPUFLAGS += -mbig-endian
|
|
|
|
endif
|
|
|
|
|
2022-03-28 02:55:53 +08:00
|
|
|
ifeq ($(CONFIG_MM_KASAN),y)
|
|
|
|
ARCHCPUFLAGS += -fsanitize=kernel-address
|
|
|
|
endif
|
|
|
|
|
2015-12-26 18:13:01 -06:00
|
|
|
ifeq ($(CONFIG_ENDIAN_BIG),y)
|
|
|
|
TARGET_ARCH := armeb
|
|
|
|
else
|
|
|
|
TARGET_ARCH := arm
|
|
|
|
endif
|
|
|
|
|
2015-12-14 08:40:38 -06:00
|
|
|
# NuttX buildroot under Linux or Cygwin
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_ARMV7R_TOOLCHAIN),BUILDROOT)
|
|
|
|
ifeq ($(CONFIG_ARMV7R_OABI_TOOLCHAIN),y)
|
2015-12-26 18:13:01 -06:00
|
|
|
CROSSDEV ?= $(TARGET_ARCH)-nuttx-elf-
|
2015-12-14 08:40:38 -06:00
|
|
|
else
|
2015-12-26 18:13:01 -06:00
|
|
|
CROSSDEV ?= $(TARGET_ARCH)-nuttx-eabi-
|
2015-12-14 08:40:38 -06:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2020-05-18 22:18:15 +08:00
|
|
|
# Generic GNU EABI toolchain
|
2015-12-14 08:40:38 -06:00
|
|
|
|
2020-05-18 22:18:15 +08:00
|
|
|
ifeq ($(CONFIG_ARMV7R_TOOLCHAIN),GNU_EABI)
|
2015-12-26 18:13:01 -06:00
|
|
|
CROSSDEV ?= $(TARGET_ARCH)-none-eabi-
|
2015-12-14 08:40:38 -06:00
|
|
|
endif
|
2020-07-15 20:51:26 +08:00
|
|
|
|
2022-03-29 11:19:16 -03:00
|
|
|
ARCHCFLAGS =
|
|
|
|
ARCHCXXFLAGS =
|
|
|
|
|
|
|
|
ifneq ($(CONFIG_CXX_EXCEPTION),y)
|
|
|
|
ARCHCXXFLAGS += -fno-exceptions -fcheck-new
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(CONFIG_CXX_RTTI),y)
|
|
|
|
ARCHCXXFLAGS += -fno-rtti
|
|
|
|
endif
|
|
|
|
|
2020-07-01 18:08:10 +08:00
|
|
|
# Default toolchain
|
|
|
|
|
|
|
|
CC = $(CROSSDEV)gcc
|
|
|
|
CXX = $(CROSSDEV)g++
|
|
|
|
CPP = $(CROSSDEV)gcc -E -P -x c
|
2021-06-11 08:14:48 +09:00
|
|
|
LD = $(CROSSDEV)ld
|
2020-07-01 18:08:10 +08:00
|
|
|
STRIP = $(CROSSDEV)strip --strip-unneeded
|
2021-09-06 08:47:27 +09:00
|
|
|
AR = $(CROSSDEV)ar rcs
|
|
|
|
NM = $(CROSSDEV)nm
|
2020-07-01 18:08:10 +08:00
|
|
|
OBJCOPY = $(CROSSDEV)objcopy
|
|
|
|
OBJDUMP = $(CROSSDEV)objdump
|
|
|
|
|
2020-07-15 20:51:26 +08:00
|
|
|
# Add the builtin library
|
|
|
|
|
2022-04-15 15:05:16 +08:00
|
|
|
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name))
|
2020-07-15 20:51:26 +08:00
|
|
|
|
|
|
|
ifneq ($(CONFIG_LIBM),y)
|
2022-04-15 15:05:16 +08:00
|
|
|
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a))
|
2020-07-15 20:51:26 +08:00
|
|
|
endif
|
|
|
|
|
2021-08-28 00:13:21 +08:00
|
|
|
ifeq ($(CONFIG_LIBSUPCXX),y)
|
2022-04-15 15:05:16 +08:00
|
|
|
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
|
2020-07-15 20:51:26 +08:00
|
|
|
endif
|