arch/tricore: add support of tricore gcc toolchain
Toolchain Upstream: https://github.com/EEESlab/tricore-gcc-toolchain-11.3.0 Signed-off-by: chao an <anchao@lixiang.com>
This commit is contained in:
parent
7e2b25d45e
commit
8e20b8d862
@ -8,12 +8,18 @@ comment "Tricore Options"
|
||||
|
||||
choice
|
||||
prompt "Tricore Toolchain Selection"
|
||||
default TRICORE_TOOLCHAIN_TASKING
|
||||
default TRICORE_TOOLCHAIN_GNU
|
||||
|
||||
config TRICORE_TOOLCHAIN_TASKING
|
||||
bool "AURIX Tasking C/C++ toolchain"
|
||||
select ARCH_TOOLCHAIN_TASKING
|
||||
|
||||
config TRICORE_TOOLCHAIN_GNU
|
||||
bool "Generic GNU toolchain"
|
||||
select ARCH_TOOLCHAIN_GNU
|
||||
---help---
|
||||
This option should work for any modern GNU toolchain (GCC 4.5 or newer)
|
||||
|
||||
endchoice # Tricore Toolchain Selection
|
||||
|
||||
config ARCH_TC3XX
|
||||
|
@ -115,7 +115,11 @@ void up_irq_enable(void);
|
||||
|
||||
noinstrument_function static inline uintptr_t up_getsp(void)
|
||||
{
|
||||
#ifdef CONFIG_TRICORE_TOOLCHAIN_TASKING
|
||||
return (uintptr_t)__get_sp();
|
||||
#else
|
||||
return __builtin_frame_address(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -130,6 +130,7 @@
|
||||
|
||||
static inline uintptr_t sys_call0(unsigned int nbr)
|
||||
{
|
||||
#ifdef CONFIG_TRICORE_TOOLCHAIN_TASKING
|
||||
register long reg0;
|
||||
|
||||
__asm volatile
|
||||
@ -146,6 +147,17 @@ static inline uintptr_t sys_call0(unsigned int nbr)
|
||||
: "i"(SYS_syscall), "d"(nbr)
|
||||
: "memory", "a11"
|
||||
);
|
||||
#else
|
||||
register long reg0 __asm__("d8") = (long)(nbr);
|
||||
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"syscall %1"
|
||||
: "=d"(reg0)
|
||||
: "i"(SYS_syscall), "d"(reg0)
|
||||
: "memory", "a11"
|
||||
);
|
||||
#endif
|
||||
|
||||
return reg0;
|
||||
}
|
||||
@ -154,6 +166,7 @@ static inline uintptr_t sys_call0(unsigned int nbr)
|
||||
|
||||
static inline uintptr_t sys_call1(unsigned int nbr, uintptr_t parm1)
|
||||
{
|
||||
#ifdef CONFIG_TRICORE_TOOLCHAIN_TASKING
|
||||
register long reg0;
|
||||
|
||||
__asm volatile
|
||||
@ -171,6 +184,18 @@ static inline uintptr_t sys_call1(unsigned int nbr, uintptr_t parm1)
|
||||
: "i"(SYS_syscall)
|
||||
: "memory", "a11"
|
||||
);
|
||||
#else
|
||||
register long reg0 __asm__("d8") = (long)(nbr);
|
||||
register long reg1 __asm__("d9") = (long)(parm1);
|
||||
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"syscall %1"
|
||||
: "=d"(reg0)
|
||||
: "i"(SYS_syscall), "d"(reg0), "d"(reg1)
|
||||
: "memory", "a11"
|
||||
);
|
||||
#endif
|
||||
|
||||
return reg0;
|
||||
}
|
||||
@ -180,6 +205,7 @@ static inline uintptr_t sys_call1(unsigned int nbr, uintptr_t parm1)
|
||||
static inline uintptr_t sys_call2(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2)
|
||||
{
|
||||
#ifdef CONFIG_TRICORE_TOOLCHAIN_TASKING
|
||||
register long reg0;
|
||||
|
||||
__asm volatile
|
||||
@ -198,6 +224,19 @@ static inline uintptr_t sys_call2(unsigned int nbr, uintptr_t parm1,
|
||||
: "i"(SYS_syscall)
|
||||
: "memory", "a11"
|
||||
);
|
||||
#else
|
||||
register long reg0 __asm__("d8") = (long)(nbr);
|
||||
register long reg2 __asm__("d10") = (long)(parm2);
|
||||
register long reg1 __asm__("d9") = (long)(parm1);
|
||||
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"syscall %1"
|
||||
: "=d"(reg0)
|
||||
: "i"(SYS_syscall), "d"(reg0), "d"(reg1), "d"(reg2)
|
||||
: "memory", "a11"
|
||||
);
|
||||
#endif
|
||||
|
||||
return reg0;
|
||||
}
|
||||
@ -207,6 +246,7 @@ static inline uintptr_t sys_call2(unsigned int nbr, uintptr_t parm1,
|
||||
static inline uintptr_t sys_call3(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2, uintptr_t parm3)
|
||||
{
|
||||
#ifdef CONFIG_TRICORE_TOOLCHAIN_TASKING
|
||||
register long reg0;
|
||||
|
||||
__asm volatile
|
||||
@ -226,6 +266,20 @@ static inline uintptr_t sys_call3(unsigned int nbr, uintptr_t parm1,
|
||||
: "i"(SYS_syscall)
|
||||
: "memory", "a11"
|
||||
);
|
||||
#else
|
||||
register long reg0 __asm__("d8") = (long)(nbr);
|
||||
register long reg3 __asm__("d11") = (long)(parm3);
|
||||
register long reg2 __asm__("d10") = (long)(parm2);
|
||||
register long reg1 __asm__("d9") = (long)(parm1);
|
||||
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"syscall %1"
|
||||
: "=d"(reg0)
|
||||
: "i"(SYS_syscall), "d"(reg0), "d"(reg1), "d"(reg2), "d"(reg3)
|
||||
: "memory", "a11"
|
||||
);
|
||||
#endif
|
||||
|
||||
return reg0;
|
||||
}
|
||||
@ -236,6 +290,7 @@ static inline uintptr_t sys_call4(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2, uintptr_t parm3,
|
||||
uintptr_t parm4)
|
||||
{
|
||||
#ifdef CONFIG_TRICORE_TOOLCHAIN_TASKING
|
||||
register long reg0;
|
||||
|
||||
__asm volatile
|
||||
@ -256,6 +311,22 @@ static inline uintptr_t sys_call4(unsigned int nbr, uintptr_t parm1,
|
||||
: "i"(SYS_syscall)
|
||||
: "memory", "a11"
|
||||
);
|
||||
#else
|
||||
register long reg0 __asm__("d8") = (long)(nbr);
|
||||
register long reg4 __asm__("d12") = (long)(parm4);
|
||||
register long reg3 __asm__("d11") = (long)(parm3);
|
||||
register long reg2 __asm__("d10") = (long)(parm2);
|
||||
register long reg1 __asm__("d9") = (long)(parm1);
|
||||
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"syscall %1"
|
||||
: "=d"(reg0)
|
||||
: "i"(SYS_syscall), "d"(reg0), "d"(reg1), "d"(reg2),
|
||||
"d"(reg3), "d"(reg4)
|
||||
: "memory", "a11"
|
||||
);
|
||||
#endif
|
||||
|
||||
return reg0;
|
||||
}
|
||||
@ -266,6 +337,7 @@ static inline uintptr_t sys_call5(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm2, uintptr_t parm3,
|
||||
uintptr_t parm4, uintptr_t parm5)
|
||||
{
|
||||
#ifdef CONFIG_TRICORE_TOOLCHAIN_TASKING
|
||||
register long reg0;
|
||||
|
||||
__asm volatile
|
||||
@ -287,6 +359,23 @@ static inline uintptr_t sys_call5(unsigned int nbr, uintptr_t parm1,
|
||||
: "i"(SYS_syscall)
|
||||
: "memory", "a11"
|
||||
);
|
||||
#else
|
||||
register long reg0 __asm__("d8") = (long)(nbr);
|
||||
register long reg5 __asm__("d13") = (long)(parm5);
|
||||
register long reg4 __asm__("d12") = (long)(parm4);
|
||||
register long reg3 __asm__("d11") = (long)(parm3);
|
||||
register long reg2 __asm__("d10") = (long)(parm2);
|
||||
register long reg1 __asm__("d9") = (long)(parm1);
|
||||
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"syscall %1"
|
||||
: "=d"(reg0)
|
||||
: "i"(SYS_syscall), "d"(reg0), "d"(reg1), "d"(reg2),
|
||||
"d"(reg3), "d"(reg4), "d"(reg5)
|
||||
: "memory", "a11"
|
||||
);
|
||||
#endif
|
||||
|
||||
return reg0;
|
||||
}
|
||||
@ -298,6 +387,7 @@ static inline uintptr_t sys_call6(unsigned int nbr, uintptr_t parm1,
|
||||
uintptr_t parm4, uintptr_t parm5,
|
||||
uintptr_t parm6)
|
||||
{
|
||||
#ifdef CONFIG_TRICORE_TOOLCHAIN_TASKING
|
||||
register long reg0;
|
||||
|
||||
__asm volatile
|
||||
@ -321,6 +411,24 @@ static inline uintptr_t sys_call6(unsigned int nbr, uintptr_t parm1,
|
||||
: "i"(SYS_syscall)
|
||||
: "memory", "a11"
|
||||
);
|
||||
#else
|
||||
register long reg0 __asm__("d8") = (long)(nbr);
|
||||
register long reg6 __asm__("d14") = (long)(parm6);
|
||||
register long reg5 __asm__("d13") = (long)(parm5);
|
||||
register long reg4 __asm__("d12") = (long)(parm4);
|
||||
register long reg3 __asm__("d11") = (long)(parm3);
|
||||
register long reg2 __asm__("d10") = (long)(parm2);
|
||||
register long reg1 __asm__("d9") = (long)(parm1);
|
||||
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"syscall %1"
|
||||
: "=d"(reg0)
|
||||
: "i"(SYS_syscall), "d"(reg0), "d"(reg1), "d"(reg2),
|
||||
"d"(reg3), "d"(reg4), "d"(reg5), "d"(reg6)
|
||||
: "memory", "a11"
|
||||
);
|
||||
#endif
|
||||
|
||||
return reg0;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <IfxCpu_Intrinsics.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Prototypes
|
||||
|
@ -89,11 +89,29 @@ $(foreach lib,$(notdir $(wildcard $(APPDIR)$(DELIM)staging$(DELIM)*$(LIBEXT))),
|
||||
EXTRA_LIBS := $(filter-out $(NAMEFULL_LIBS) $(NAMESPEC_LIBS),$(EXTRA_LIBS))
|
||||
EXTRA_LIBS += $(wildcard $(APPDIR)$(DELIM)staging$(DELIM)*$(LIBEXT))
|
||||
|
||||
LIBPATH_OPT = --library-directory=
|
||||
SCRIPT_OPT = --lsl-file=
|
||||
LIBRARY_OPT = -l
|
||||
ifeq ($(CONFIG_TRICORE_TOOLCHAIN_TASKING),y)
|
||||
LIBPATH_OPT = --library-directory=
|
||||
SCRIPT_OPT = --lsl-file=
|
||||
LIBRARY_OPT = -l
|
||||
else
|
||||
LDFLAGS := $(addprefix -Xlinker ,$(LDFLAGS))
|
||||
LDFLAGS += $(CFLAGS)
|
||||
|
||||
LIBPATH_OPT = -L
|
||||
SCRIPT_OPT = -T
|
||||
LIBRARY_OPT = -l
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TRICORE_TOOLCHAIN_TASKING),y)
|
||||
LDFLAGS += $(addprefix $(SCRIPT_OPT),$(call CONVERT_PATH,$(ARCHSCRIPT))) $(EXTRALINKCMDS)
|
||||
else
|
||||
ARCHSCRIPT := $(call CONVERT_PATH,$(ARCHSCRIPT))
|
||||
LDFLAGS += $(addprefix $(SCRIPT_OPT),$(addsuffix .tmp,$(ARCHSCRIPT))) $(EXTRALINKCMDS)
|
||||
|
||||
LDSTARTGROUP ?= -Wl,--start-group
|
||||
LDENDGROUP ?= -Wl,--end-group
|
||||
endif
|
||||
|
||||
LDFLAGS += $(addprefix $(SCRIPT_OPT),$(call CONVERT_PATH,$(ARCHSCRIPT))) $(EXTRALINKCMDS)
|
||||
LIBPATHS += $(call CONVERT_PATH,$(TOPDIR)$(DELIM)staging)
|
||||
|
||||
BOARDMAKE = $(if $(wildcard board$(DELIM)Makefile),y,)
|
||||
@ -145,7 +163,16 @@ define LINK_ALLSYMS
|
||||
$(Q) $(call DELFILE, allsyms.tmp allsyms$(OBJEXT))
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_TRICORE_TOOLCHAIN_TASKING),)
|
||||
$(addsuffix .tmp,$(ARCHSCRIPT)): $(ARCHSCRIPT)
|
||||
$(call PREPROCESS, $(patsubst %.tmp,%,$@), $@)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TRICORE_TOOLCHAIN_TASKING),y)
|
||||
nuttx$(EXEEXT): $(HEAD_COBJ) board$(DELIM)libboard$(LIBEXT) $(ARCHSCRIPT) $(EXTRA_LIBS)
|
||||
else
|
||||
nuttx$(EXEEXT): $(HEAD_COBJ) board$(DELIM)libboard$(LIBEXT) $(EXTRA_LIBS) $(addsuffix .tmp,$(ARCHSCRIPT))
|
||||
endif
|
||||
$(Q) echo "LD: nuttx"
|
||||
ifneq ($(CONFIG_ALLSYMS),y)
|
||||
$(Q) $(LD) $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
|
||||
@ -164,6 +191,9 @@ ifneq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
|
||||
sort > $(TOPDIR)$(DELIM)System.map
|
||||
endif
|
||||
ifeq ($(CONFIG_TRICORE_TOOLCHAIN_TASKING),)
|
||||
$(Q) $(call DELFILE, $(addsuffix .tmp,$(ARCHSCRIPT)))
|
||||
endif
|
||||
|
||||
# This is part of the top-level export target
|
||||
# Note that there may not be a head object if layout is handled
|
||||
|
@ -18,110 +18,8 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
#
|
||||
# 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.
|
||||
# ARCHOPTIMIZATION The optimization level that results in
|
||||
# reliable code generation.
|
||||
#
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)
|
||||
ARCHOPTIMIZATION += $(CONFIG_DEBUG_OPTLEVEL)
|
||||
else ifeq ($(CONFIG_DEBUG_FULLOPT),y)
|
||||
ifeq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),y)
|
||||
ARCHOPTIMIZATION += -Oz
|
||||
else
|
||||
ARCHOPTIMIZATION += -Os
|
||||
endif
|
||||
ifeq ($(CONFIG_TRICORE_TOOLCHAIN_TASKING),y)
|
||||
include $(TOPDIR)/arch/tricore/src/common/ToolchainTasking.defs
|
||||
else
|
||||
include $(TOPDIR)/arch/tricore/src/common/ToolchainGnuc.defs
|
||||
endif
|
||||
|
||||
# Tasking toolchain
|
||||
|
||||
CC = cctc
|
||||
CXX = cctc
|
||||
CPP = cctc $(ARCHOPTIMIZATION)
|
||||
LD = cctc
|
||||
STRIP = strip --strip-unneeded
|
||||
AR = artc -r
|
||||
NM = nm
|
||||
OBJCOPY = echo
|
||||
OBJDUMP = elfdump
|
||||
|
||||
ARCHOPTIMIZATION += --lsl-core=vtc
|
||||
LDFLAGS += --lsl-core=vtc
|
||||
ARCHOPTIMIZATION += --iso=99
|
||||
ARCHOPTIMIZATION += --language=+gcc,+volatile,-strings,-kanji
|
||||
|
||||
# pragma align <4> (default: 0)
|
||||
|
||||
ARCHOPTIMIZATION += --align=4
|
||||
|
||||
# Always use 32-bit integers for enumeration
|
||||
|
||||
ARCHOPTIMIZATION += --integer-enumeration
|
||||
|
||||
# tradeoff between speed (-t0) and size (-t4) (default: 4)
|
||||
|
||||
ARCHOPTIMIZATION += --tradeoff=2
|
||||
|
||||
# enable symbolic debug information
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION += --debug-info=default
|
||||
ARCHOPTIMIZATION += --keep-temporary-files
|
||||
LDFLAGS += -g
|
||||
endif
|
||||
|
||||
# merge source code with assembly output
|
||||
|
||||
ARCHOPTIMIZATION += --source
|
||||
|
||||
# generate alignment depending on assume_if hints
|
||||
|
||||
ARCHOPTIMIZATION += --branch-target-align
|
||||
|
||||
|
||||
# Since nuttx uses too many of GNU extensions in the implementation of
|
||||
# FPU-related library functions, which is not supported in tasking,
|
||||
# so currently we cannot use FPU-related configurations to manage it.
|
||||
#
|
||||
# Just set fp-model to Double Precision:
|
||||
# --fp-model[=<flag>,...] floating-point model (default: cFlnrSTz)
|
||||
# 0 alias for --fp-model=CFLNRStZ (strict)
|
||||
# 1 alias for --fp-model=cFLNRSTZ (precise)
|
||||
# 2 alias for --fp-model=cFlnrSTz (fast-dp)
|
||||
# 3 alias for --fp-model=cflnrSTz (fast-sp)
|
||||
|
||||
ARCHOPTIMIZATION += --fp-model=2
|
||||
LDFLAGS += --fp-model=2
|
||||
LDFLAGS += -lfp_fpu
|
||||
|
||||
LDFLAGS += --hex-format=s -Wl-OtxYcL -Wl-mcrfiklsmnoduq
|
||||
LDFLAGS += -lrt
|
||||
|
||||
# ctc W500: ["stdio/lib_libvsprintf.c" 884/29] expression without effect
|
||||
# ctc W507: ["mm_heap/mm_malloc.c" 238/64] variable "nodesize" is possibly uninitialized
|
||||
# ctc W508: ["misc/lib_impure.c" 1/1] empty source file
|
||||
# ctc W525: ["getopt.c" 678/3] discarded 'const' qualifier at assignment: conversion from char const * to char *
|
||||
# ctc W527: ["stdlib/lib_strtold.c" 565/23] constant of type "double" saturated
|
||||
# ctc W526: ["include/sys/epoll.h" 87/5] enumeration constant shall be representable as 'int'
|
||||
# ctc W529: ["wchar/lib_mbrtowc.c" 88/35] overflow in constant expression of type "unsigned long int"
|
||||
# ctc W544: ["wqueue/kwork_thread.c" 210/32] unreachable code
|
||||
# ctc W549: ["unistd/lib_getopt_common.c" 544/15] condition is always true
|
||||
# ctc W553: ["vfs/fs_fcntl.c" 231/7] no 'break' or comment before case label
|
||||
# ctc W557: ["common/tricore_main.c" 58/11] possible infinite loop
|
||||
# ctc W560: ["tmpfs/fs_tmpfs.c" 232/25] possible truncation at implicit conversion to type "unsigned short int"
|
||||
# ctc W562: ["mm_heap/mm_memalign.c" 70/20] unary minus applied to unsigned value
|
||||
# ctc W558: ["include/nuttx/power/regulator.h" 224/36] struct/union/enum definition in parameter declaration
|
||||
# ctc W587: ["stdlib/lib_strtold.c" 571/23] underflow on constant of type "double"
|
||||
# ctc W588: ["misc/lib_glob.c" 150/13] dead assignment to "i" eliminated
|
||||
# ctc W589: ["inode/fs_inodesearch.c" 72/8] pointer assumed to be nonzero - test removed
|
||||
|
||||
TASKING_WARNINGS = 500,507,508,525,526,527,529,544,549,553,560,562,557,558,587,588,589
|
||||
|
||||
ARCHOPTIMIZATION += --pass-c=--no-warnings=$(TASKING_WARNINGS)
|
||||
|
192
arch/tricore/src/common/ToolchainGnuc.defs
Normal file
192
arch/tricore/src/common/ToolchainGnuc.defs
Normal file
@ -0,0 +1,192 @@
|
||||
############################################################################
|
||||
# arch/tricore/src/common/ToolchainGnuc.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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
#
|
||||
# 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.
|
||||
# ARCHOPTIMIZATION The optimization level that results in
|
||||
# reliable code generation.
|
||||
#
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)
|
||||
ARCHOPTIMIZATION += $(CONFIG_DEBUG_OPTLEVEL)
|
||||
else ifeq ($(CONFIG_DEBUG_FULLOPT),y)
|
||||
ARCHOPTIMIZATION += -Os
|
||||
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_STACK_CANARIES),y)
|
||||
ARCHOPTIMIZATION += -fstack-protector-all
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STACK_USAGE),y)
|
||||
ARCHOPTIMIZATION += -fstack-usage
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_STACK_USAGE_WARNING),0)
|
||||
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
|
||||
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
||||
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
||||
ARCHOPTIMIZATION += -fsanitize-undefined-trap-on-error
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MM_KASAN_ALL),y)
|
||||
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MM_KASAN_GLOBAL),y)
|
||||
ARCHOPTIMIZATION += --param asan-globals=1
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MM_KASAN_DISABLE_READS_CHECK),y)
|
||||
ARCHOPTIMIZATION += --param asan-instrument-reads=0
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MM_KASAN_DISABLE_WRITES_CHECK),y)
|
||||
ARCHOPTIMIZATION += --param asan-instrument-writes=0
|
||||
endif
|
||||
|
||||
# Instrumentation options
|
||||
|
||||
ifeq ($(CONFIG_ARCH_INSTRUMENT_ALL),y)
|
||||
ARCHOPTIMIZATION += -finstrument-functions
|
||||
endif
|
||||
|
||||
# Link Time Optimization
|
||||
|
||||
ifeq ($(CONFIG_LTO_THIN),y)
|
||||
ARCHOPTIMIZATION += -flto=thin
|
||||
else ifeq ($(CONFIG_LTO_FULL),y)
|
||||
ARCHOPTIMIZATION += -flto
|
||||
ARCHOPTIMIZATION += -fuse-linker-plugin
|
||||
endif
|
||||
|
||||
# Default toolchain
|
||||
|
||||
CC = $(CROSSDEV)tricore-elf-gcc
|
||||
CXX = $(CROSSDEV)tricore-elf-g++
|
||||
CPP = $(CROSSDEV)tricore-elf-gcc -E -P -x c
|
||||
LD = $(CROSSDEV)tricore-elf-gcc
|
||||
STRIP = $(CROSSDEV)tricore-elf-strip --strip-unneeded
|
||||
AR = $(CROSSDEV)tricore-elf-gcc-ar rcs
|
||||
NM = $(CROSSDEV)tricore-elf-gcc-nm
|
||||
OBJCOPY = $(CROSSDEV)tricore-elf-objcopy
|
||||
OBJDUMP = $(CROSSDEV)tricore-elf-objdump
|
||||
|
||||
ARCHOPTIMIZATION += -fno-builtin
|
||||
|
||||
# Architecture flags
|
||||
|
||||
ARCHCFLAGS += -Wstrict-prototypes -Wno-attributes -Wno-unknown-pragmas
|
||||
ARCHCXXFLAGS += -Wno-attributes -Wno-unknown-pragmas
|
||||
|
||||
# When all C++ code is built using GCC 7.1 or a higher version,
|
||||
# we can safely disregard warnings of the type "parameter passing for X changed in GCC 7.1."
|
||||
# Refer to : https://stackoverflow.com/questions/48149323/what-does-the-gcc-warning-project-parameter-passing-for-x-changed-in-gcc-7-1-m
|
||||
|
||||
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
|
||||
|
||||
ARCHOPTIMIZATION += -fno-common -Wall -Wshadow -Wundef
|
||||
|
||||
LDFLAGS += -nostdlib
|
||||
|
||||
# Optimization of unused sections
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_OPT_UNUSED_SECTIONS),y)
|
||||
LDFLAGS += --gc-sections
|
||||
ARCHOPTIMIZATION += -ffunction-sections -fdata-sections
|
||||
endif
|
||||
|
||||
# Debug --whole-archive
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_LINK_WHOLE_ARCHIVE),y)
|
||||
LDFLAGS += --whole-archive
|
||||
endif
|
||||
|
||||
# Debug link map
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_LINK_MAP),y)
|
||||
LDFLAGS += --cref -Map=$(call CONVERT_PATH,$(TOPDIR)$(DELIM)nuttx.map)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION += -g
|
||||
endif
|
||||
|
||||
LDFLAGS += --no-warn-rwx-segments
|
||||
|
||||
# Add the builtin library
|
||||
|
||||
COMPILER_RT_LIB = $(shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name)
|
||||
|
||||
EXTRA_LIBS += $(COMPILER_RT_LIB)
|
||||
|
||||
ifeq ($(CONFIG_LIBM_TOOLCHAIN),y)
|
||||
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a))
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LIBSUPCXX),y)
|
||||
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a))
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_COVERAGE),y)
|
||||
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a))
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LIBCXXTOOLCHAIN),y)
|
||||
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libstdc++.a))
|
||||
endif
|
127
arch/tricore/src/common/ToolchainTasking.defs
Normal file
127
arch/tricore/src/common/ToolchainTasking.defs
Normal file
@ -0,0 +1,127 @@
|
||||
############################################################################
|
||||
# arch/tricore/src/common/ToolchainTasking.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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
#
|
||||
# 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.
|
||||
# ARCHOPTIMIZATION The optimization level that results in
|
||||
# reliable code generation.
|
||||
#
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)
|
||||
ARCHOPTIMIZATION += $(CONFIG_DEBUG_OPTLEVEL)
|
||||
else ifeq ($(CONFIG_DEBUG_FULLOPT),y)
|
||||
ifeq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),y)
|
||||
ARCHOPTIMIZATION += -Oz
|
||||
else
|
||||
ARCHOPTIMIZATION += -Os
|
||||
endif
|
||||
endif
|
||||
|
||||
# Tasking toolchain
|
||||
|
||||
CC = cctc
|
||||
CXX = cctc
|
||||
CPP = cctc $(ARCHOPTIMIZATION)
|
||||
LD = cctc
|
||||
STRIP = strip --strip-unneeded
|
||||
AR = artc -r
|
||||
NM = nm
|
||||
OBJCOPY = echo
|
||||
OBJDUMP = elfdump
|
||||
|
||||
ARCHOPTIMIZATION += --lsl-core=vtc
|
||||
LDFLAGS += --lsl-core=vtc
|
||||
ARCHOPTIMIZATION += --iso=99
|
||||
ARCHOPTIMIZATION += --language=+gcc,+volatile,-strings,-kanji
|
||||
|
||||
# pragma align <4> (default: 0)
|
||||
|
||||
ARCHOPTIMIZATION += --align=4
|
||||
|
||||
# Always use 32-bit integers for enumeration
|
||||
|
||||
ARCHOPTIMIZATION += --integer-enumeration
|
||||
|
||||
# tradeoff between speed (-t0) and size (-t4) (default: 4)
|
||||
|
||||
ARCHOPTIMIZATION += --tradeoff=2
|
||||
|
||||
# enable symbolic debug information
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION += --debug-info=default
|
||||
ARCHOPTIMIZATION += --keep-temporary-files
|
||||
LDFLAGS += -g
|
||||
endif
|
||||
|
||||
# merge source code with assembly output
|
||||
|
||||
ARCHOPTIMIZATION += --source
|
||||
|
||||
# generate alignment depending on assume_if hints
|
||||
|
||||
ARCHOPTIMIZATION += --branch-target-align
|
||||
|
||||
|
||||
# Since nuttx uses too many of GNU extensions in the implementation of
|
||||
# FPU-related library functions, which is not supported in tasking,
|
||||
# so currently we cannot use FPU-related configurations to manage it.
|
||||
#
|
||||
# Just set fp-model to Double Precision:
|
||||
# --fp-model[=<flag>,...] floating-point model (default: cFlnrSTz)
|
||||
# 0 alias for --fp-model=CFLNRStZ (strict)
|
||||
# 1 alias for --fp-model=cFLNRSTZ (precise)
|
||||
# 2 alias for --fp-model=cFlnrSTz (fast-dp)
|
||||
# 3 alias for --fp-model=cflnrSTz (fast-sp)
|
||||
|
||||
ARCHOPTIMIZATION += --fp-model=2
|
||||
LDFLAGS += --fp-model=2
|
||||
LDFLAGS += -lfp_fpu
|
||||
|
||||
LDFLAGS += --hex-format=s -Wl-OtxYcL -Wl-mcrfiklsmnoduq
|
||||
LDFLAGS += -lrt
|
||||
|
||||
# ctc W500: ["stdio/lib_libvsprintf.c" 884/29] expression without effect
|
||||
# ctc W507: ["mm_heap/mm_malloc.c" 238/64] variable "nodesize" is possibly uninitialized
|
||||
# ctc W508: ["misc/lib_impure.c" 1/1] empty source file
|
||||
# ctc W525: ["getopt.c" 678/3] discarded 'const' qualifier at assignment: conversion from char const * to char *
|
||||
# ctc W527: ["stdlib/lib_strtold.c" 565/23] constant of type "double" saturated
|
||||
# ctc W526: ["include/sys/epoll.h" 87/5] enumeration constant shall be representable as 'int'
|
||||
# ctc W529: ["wchar/lib_mbrtowc.c" 88/35] overflow in constant expression of type "unsigned long int"
|
||||
# ctc W544: ["wqueue/kwork_thread.c" 210/32] unreachable code
|
||||
# ctc W549: ["unistd/lib_getopt_common.c" 544/15] condition is always true
|
||||
# ctc W553: ["vfs/fs_fcntl.c" 231/7] no 'break' or comment before case label
|
||||
# ctc W557: ["common/tricore_main.c" 58/11] possible infinite loop
|
||||
# ctc W560: ["tmpfs/fs_tmpfs.c" 232/25] possible truncation at implicit conversion to type "unsigned short int"
|
||||
# ctc W562: ["mm_heap/mm_memalign.c" 70/20] unary minus applied to unsigned value
|
||||
# ctc W558: ["include/nuttx/power/regulator.h" 224/36] struct/union/enum definition in parameter declaration
|
||||
# ctc W587: ["stdlib/lib_strtold.c" 571/23] underflow on constant of type "double"
|
||||
# ctc W588: ["misc/lib_glob.c" 150/13] dead assignment to "i" eliminated
|
||||
# ctc W589: ["inode/fs_inodesearch.c" 72/8] pointer assumed to be nonzero - test removed
|
||||
|
||||
TASKING_WARNINGS = 500,507,508,525,526,527,529,544,549,553,560,562,557,558,587,588,589
|
||||
|
||||
ARCHOPTIMIZATION += --pass-c=--no-warnings=$(TASKING_WARNINGS)
|
@ -37,6 +37,7 @@
|
||||
# include <IfxCpu_reg.h>
|
||||
# include <Ifx_Ssw_Compilers.h>
|
||||
# include <Tricore/Compilers/Compilers.h>
|
||||
# include <IfxCpu_Intrinsics.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@ -182,11 +183,20 @@ extern uintptr_t __ISTACK0[];
|
||||
|
||||
/* These symbols are setup by the linker script. */
|
||||
|
||||
#ifdef CONFIG_TRICORE_TOOLCHAIN_TASKING
|
||||
extern uintptr_t _lc_gb_data[]; /* Start of .data */
|
||||
extern uintptr_t _lc_ge_data[]; /* End+1 of .data */
|
||||
#define _sdata _lc_gb_data
|
||||
#define _edata _lc_ge_data
|
||||
#define _eheap __USTACK0_END
|
||||
#else
|
||||
extern uintptr_t __HEAP[]; /* End+1 of .data */
|
||||
extern uintptr_t __A0_MEM[]; /* End+1 of .data */
|
||||
#define _sdata LCF_DSPR0_START
|
||||
#define _edata __A0_MEM
|
||||
#define _eheap __USTACK0_END
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -56,6 +56,6 @@ spinlock_t up_testset(volatile spinlock_t *lock)
|
||||
{
|
||||
/* Perform the compare and set operation */
|
||||
|
||||
return __cmpswapw((volatile void *)lock, SP_LOCKED, SP_UNLOCKED);
|
||||
return Ifx__cmpAndSwap((volatile void *)lock, SP_LOCKED, SP_UNLOCKED);
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,8 @@ CHIP_CSRCS += tc3xx_serial.c
|
||||
|
||||
VPATH += tc3xx
|
||||
|
||||
ifeq ($(CONFIG_TRICORE_TOOLCHAIN_TASKING),y)
|
||||
|
||||
tc3xx_libc$(OBJEXT): tc3xx_libc.c
|
||||
$(call COMPILE, $<, $@)
|
||||
|
||||
@ -34,6 +36,19 @@ libc_fpu$(LIBEXT): tc3xx_libc$(OBJEXT)
|
||||
$(call ARCHIVE, $@, $<)
|
||||
|
||||
EXTRA_LIBS += libc_fpu$(LIBEXT)
|
||||
|
||||
else
|
||||
|
||||
tc3xx_dummy$(OBJEXT): tc3xx_dummy.c
|
||||
$(call COMPILE, $<, $@)
|
||||
|
||||
libos$(LIBEXT): tc3xx_dummy$(OBJEXT)
|
||||
$(call ARCHIVE, $@, $<)
|
||||
|
||||
EXTRA_LIBS += libos$(LIBEXT)
|
||||
|
||||
endif
|
||||
|
||||
LIBPATHS += $(CURDIR)
|
||||
|
||||
TC397_UNPACK = tc397
|
||||
|
@ -19,8 +19,17 @@
|
||||
############################################################################
|
||||
|
||||
ifeq ($(CONFIG_ARCH_CHIP_TC397),y)
|
||||
ARCHOPTIMIZATION += --cpu=tc39xb
|
||||
LDFLAGS += -Ctc39xb
|
||||
ifeq ($(CONFIG_TRICORE_TOOLCHAIN_TASKING),y)
|
||||
ARCHCPUFLAGS += --cpu=tc39xb
|
||||
LDFLAGS += -Ctc39xb
|
||||
else
|
||||
ARCHCPUFLAGS += -mcpu=tc39xx
|
||||
ARCHCPUFLAGS += -mtc162
|
||||
endif
|
||||
|
||||
ARCHINCLUDES += ${INCDIR_PREFIX}$(CHIP_DIR)/tc397/Libraries/iLLD/TC39B/Tricore/Cpu/Std
|
||||
ARCHINCLUDES += ${INCDIR_PREFIX}$(CHIP_DIR)/tc397/Libraries/Infra/Platform
|
||||
ARCHINCLUDES += ${INCDIR_PREFIX}$(CHIP_DIR)/tc397/Configurations
|
||||
endif
|
||||
|
||||
include $(TOPDIR)/arch/tricore/src/common/Toolchain.defs
|
||||
|
0
arch/tricore/src/tc3xx/tc3xx_dummy.c
Normal file
0
arch/tricore/src/tc3xx/tc3xx_dummy.c
Normal file
2981
boards/tricore/tc3xx/tc397/scripts/Lcf_Gnuc_Tricore_Tc.lsl
Normal file
2981
boards/tricore/tc3xx/tc397/scripts/Lcf_Gnuc_Tricore_Tc.lsl
Normal file
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,11 @@ include $(TOPDIR)/.config
|
||||
include $(TOPDIR)/tools/Config.mk
|
||||
include $(TOPDIR)/arch/tricore/src/tc3xx/Toolchain.defs
|
||||
|
||||
ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)Lcf_Tasking_Tricore_Tc.lsl
|
||||
ifeq ($(CONFIG_TRICORE_TOOLCHAIN_TASKING),y)
|
||||
ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)Lcf_Tasking_Tricore_Tc.lsl
|
||||
else
|
||||
ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)Lcf_Gnuc_Tricore_Tc.lsl
|
||||
endif
|
||||
|
||||
CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
|
||||
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||
|
Loading…
Reference in New Issue
Block a user