nuttx/arch/sparc/src/sparc_v8/Toolchain.defs
2024-04-29 17:34:10 +08:00

126 lines
3.4 KiB
Plaintext

############################################################################
# arch/sparc/src/sparc_v8/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
#
# Handle old-style chip-specific toolchain names in the absence of
# a new-style toolchain specification, force the selection of a single
# toolchain and allow the selected toolchain to be overridden by a
# command-line selection.
#
ifeq ($(filter y, \
$(CONFIG_SPARC_TOOLCHAIN_BUILDROOT) \
),y)
CONFIG_SPARC_TOOLCHAIN ?= BUILDROOT
endif
ifeq ($(filter y, \
$(CONFIG_SPARC_TOOLCHAIN_CODEREDW) \
),y)
CONFIG_SPARC_TOOLCHAIN ?= CODEREDW
endif
ifeq ($(filter y, \
$(CONFIG_SPARC_LINUXGCC_TOOLCHAIN) \
),y)
CONFIG_SPARC_TOOLCHAIN ?= LINUXGCC
endif
# Chip-specific CPU flags
ifeq ($(CONFIG_ARCH_CHIP_BM3803),y)
# ARCHCPUFLAGS += -mcpu=leon -mflat
ARCHCPUFLAGS += -mcpu=leon
else ifeq ($(CONFIG_ARCH_CHIP_BM3823),y)
ARCHCPUFLAGS += -mcpu=leon -mflat
else ifeq ($(CONFIG_ARCH_CHIP_S698PM),y)
ARCHCPUFLAGS += -mcpu=leon3
endif
ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)
ARCHOPTIMIZATION += $(CONFIG_DEBUG_OPTLEVEL)
else ifeq ($(CONFIG_DEBUG_FULLOPT),y)
ARCHOPTIMIZATION += -O2
endif
ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += -fno-strict-aliasing
endif
ifeq ($(CONFIG_FRAME_POINTER),y)
ARCHOPTIMIZATION += -fno-omit-frame-pointer -fno-optimize-sibling-calls
else
ARCHOPTIMIZATION += -fomit-frame-pointer
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION += -g
endif
ARCHCFLAGS += -fno-common
ARCHCXXFLAGS += -fno-common
ARCHCFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas
ARCHCXXFLAGS += -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas
ifneq ($(CONFIG_LIBCXXTOOLCHAIN),y)
ARCHCXXFLAGS += -nostdinc++
endif
ifneq ($(CONFIG_CXX_STANDARD),)
ARCHCXXFLAGS += -std=$(CONFIG_CXX_STANDARD)
endif
ifneq ($(CONFIG_CXX_EXCEPTION),y)
ARCHCXXFLAGS += -fno-exceptions -fcheck-new
endif
ifneq ($(CONFIG_CXX_RTTI),y)
ARCHCXXFLAGS += -fno-rtti
endif
LDFLAGS += -nostdlib
# NuttX buildroot GCC toolchain under Linux or Cygwin
ifeq ($(CONFIG_SPARC_TOOLCHAIN),BUILDROOT)
CROSSDEV ?= sparc-gaisler-elf-
LDSCRIPT = sparc-gaisler-elf-debug.ld
endif
# NuttX Windows Native toolchain
ifeq ($(CONFIG_SPARC_TOOLCHAIN),CODEREDW)
CROSSDEV ?= sparc-elf-
LDSCRIPT = sparc-elf-debug.ld
endif
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
NM = $(CROSSDEV)nm
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump