TC Reference Guide v2.1
TC Reference Guide v2.1
TriCore v2.1
C Compiler,
Assembler, Linker
Reference Manual
A publication of
Altium BV
Documentation Department
http://www.tasking.com
http://www.altium.com
The information in this document has been carefully reviewed and is
believed to be accurate and reliable. However, Altium assumes no liabilities
for inaccuracies in this document. Furthermore, the delivery of this
information does not convey to the recipient any license to use or copy the
software or documentation, except as provided in an executed license
agreement covering the software and documentation.
CONTENTS
CONTENTS
Table of Contents V
LIBRARIES 2-1
2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
2.2 Library Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
2.2.1 assert.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
2.2.2 complex.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
2.2.3 ctype.h and wctype.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
2.2.4 errno.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
2.2.5 fcntl.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9
2.2.6 fenv.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9
2.2.7 float.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10
2.2.8 fss.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10
2.2.9 inttypes.h and stdint.h . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11
2.2.10 iso646.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-12
2.2.11 limits.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-12
2.2.12 locale.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-12
2.2.13 math.h and tgmath.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13
2.2.14 setjmp.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-20
• • • • • • • •
VI TriCore Reference Manual
• • • • • • • •
VIII TriCore Reference Manual
INDEX
Manual Purpose and Structure IX
Windows Users
The documentation explains and describes how to use the TriCore
toolchain to program a TriCore DSP. The documentation is primarily aimed
at Windows users. You can use the tools either with the graphical
Embedded Development Environment (EDE) or from the command line in
a command prompt window.
Unix Users
For UNIX the toolchain works the same as it works for the Windows
command line.
Directory paths are specified in the Windows way, with back slashes as in
\ctc\bin. Simply replace the back slashes by forward slashes for use
with UNIX: /ctc/bin.
Structure
The TriCore documentation consists of a User's Manual which includes a
Getting Started section and a separate Reference Manual (this manual).
After installation you are ready to follow the Getting Started in Chapter 2
of the User's Manual.
Next, move on with the other chapters in the User's Manual which explain
how to use the compiler, assembler, linker and the various utilities.
Once you are familiar with these tools, you can use the Reference Manual
to lookup specific options and details to make fully use of the TriCore
toolchain.
• • • • • • • •
X TriCore Reference Manual
Chapter 2: Libraries
Contains overviews of all library functions you can use in your C source.
The libraries are implemented according to the ISO/IEC 9899:1999(E)
standard.
• • • • • • • •
XII TriCore Reference Manual
filename
ctc [ -? ]
... You can repeat the preceding item zero or more times.
,... You can repeat the preceding item zero or more times,
separating each item with a comma.
Example
ctc [option]... filename
You can read this line as follows: enter the command ctc with or without
an option, follow this by zero or more options and specify a filename. The
following input lines are all valid:
ctc test.c
ctc -g test.c
ctc -g -E test.c
Icons
The following illustrations are used in this manual:
This illustration indicates actions you can perform with the mouse. Such as
EDE menu entries and dialogs.
• • • • • • • •
XIV TriCore Reference Manual
RELATED PUBLICATIONS
C Standards
• C A Reference Manual (fifth edition) by Samual P. Harbison and Guy L.
Steele Jr. (2002, Prentice Hall)
• The C Programming Language (second edition) by B. Kernighan and D.
Ritchie (1988, Prentice Hall)
• ISO/IEC 9899:1999(E), Programming languages - C [ISO/IEC]
More information on the standards can be found at
http://www.ansi.org
• DSP-C, An Extension to ISO/IEC 9899:1999(E),
Programming languages - C [TASKING, TK0071-14]
MISRA C
• Guidelines for the Use of the C Language in Vehicle Based Software
[MISRA]
See also http://www.misra.org.uk
TASKING Tools
• TriCore C Compiler, Assembler, Linker User's Manual
[TASKING, MA060-024-00-00]
MANUAL STRUCTURE
TriCore
• TriCore 1 Unified Processor Core v1.3 Architecture Manual, Doc v1.3.3
[2002-09, Infineon]
• TriCore2 Architecture Overview Handbook [2002, Infineon]
• TriCore Embedded Application Binary Interface [2000, Infineon]
CHAPTER
TRICORE
C LANGUAGE
1
1-2 TriCore Reference Manual
CHAPTER
1
C LANGUAGE
TriCore C Language 1-3
1.1 INTRODUCTION
The TASKING TriCore C compiler fully supports the ANSI C standard but
adds possibilities to program the special functions of the TriCore.
• • • • • • • •
1-4 TriCore Reference Manual
Size Align
Type Keyword Ranges
(bit) (bit)
Bit __bit 8 8 0 or 1
Boolean _Bool 8 8 0 or 1
Character char
8 8 -27 .. 27-1
signed char
unsigned int
32 16 0 .. 232-1
unsigned long
long long
unsigned
long long
64 32 0 .. 264-1
Size Align
Type Keyword Ranges
(bit) (bit)
Accum __laccum 64 64 [-131072,131072>
Packed __packb
32 16 4x: -27 .. 27-1
signed __packb
unsigned
__packhw
32 16 2x: 0 .. 216-1
• • • • • • • •
1-6 TriCore Reference Manual
1.3 KEYWORDS
__asm()
With the __asm() keyword you can use assembly instructions in the C
source and pass C variables as operands to the assembly code.
__asm( "instruction_template"
[ : output_param_list
[ : input_param_list
[ : register_save_list]]] );
output_param_list [[ "=[&]constraint_char"(C_expression)],...]
input_param_list [[ "constraint_char"(C_expression)],...]
register_save_list [["register_name"],...]
For more information on __asm, see section 3.6, Using Assembly in the C
Source, in Chapter TriCore C Language of the User's Manual.
__at()
With the attribute __at() you can place an object at an absolute address.
int myvar __at(0x100);
__atbit()
If you have defined a 32-bits base variable (int, long) you can declare a
single bit of that variable as a bit variable with the keyword __atbit().
The syntax is:
name is the name of an integer variable in which the bit is located. offset
(range 0-31) is the bit-offset within the variable.
__circ
The TriCore C compiler supports the __circ keyword for circular buffers.
• • • • • • • •
1-8 TriCore Reference Manual
__near
__far
With keyword __near the declared data object will be located in the first
16 kB of a 256 MB block. These parts of memory are directly addressable
with the absolute addressing mode.
With keyword __far the data object can be located anywhere in the
indirect addressable memory region.
__sfrbit16
__sfrbit32
With the data type qualifiers __sfrbit16 and __sfrbit32 you can
declare bit fields in special function registers. These keywords force 16-bit
or 32-bit access.
For more information see section 3.4.2, Declare an SFR Bit Field: __sfrbit16
and __sfrbit32, in Chapter TriCore C Language of the User's Manual.
C LANGUAGE
TriCore C Language 1-9
__enable_
__bisr_()
During the execution of an interrupt service routine or trap service routine,
the system blocks the CPU from taking further interrupt requests. You can
immediately re-enable the system to accept interrupt requests:
__interrupt(vector) __enable_ isr( void )
__trap(class) __enable_ tsr( void )
For more information see section 3.9.2, Interrupt and Trap Functions, in
Chapter TriCore C Language of the User's Manual.
__indirect
Functions are default called with a single word direct call. However, when
you link the application and the target address appears to be out of reach
(+/- 16 MB from the callg or jg instruction), the linker generates an
error. In this case you can use the __indirect keyword to force the less
efficient, two and a half word indirect call to the function:
int __indirect foo( void )
{
...
}
inline
__noinline
You can use the inline qualifier to tell the compiler to inline the function
body instead of calling the function. Use the __noinline qualifier to tell
the compiler not to inline the function body.
• • • • • • • •
1-10 TriCore Reference Manual
__interrupt()
__interrupt_fast()
You can use the qualifier __interrupt() to declare a function as an
interrupt service routine.
void __interrupt(vector_number) isr(void)
{
...
}
The vector_number identifies the entry into the interrupt vector table
(0..255). Unlike other interrupt systems, the priority number (PIPN) of the
interrupt now being serviced by the CPU identifies the entry into the
vector table.
For more information see section 3.9.2, Interrupt and Trap Functions, in
Chapter TriCore C Language of the User's Manual.
__trap()
__trap_fast()
__syscallfunc()
The definition of a trap service routine is similar to the definition of an
interrupt service routine. Trap functions cannot accept arguments and do
not return anything:
TriCore C Language 1-11
The argument class identifies the entry into the trap vector table. TriCore
defines eight classes of trap functions. Each class has its own trap handler.
A special kind of trap service routine is the system call trap. With a system
call the trap service routine of class 6 is called. For the system call trap, the
trap identification number (TIN) is taken from the immediate constant
specified with the function qualifier __syscallfunc() :
__syscallfunc(TIN)
The TIN is a value in the range 0 and 255. You can only use
__syscallfunc() in the function declaration. A function body is useless,
because when you call the function declared with __syscallfunc() , a
trap class 6 occurs which calls the corresponding trap service routine.
For more information see section 3.9.2, Interrupt and Trap Functions, in
Chapter TriCore C Language of the User's Manual.
__stackparm
The function qualifier __stackparm changes the standard calling
convention of a function into a convention where all function arguments
are passed via the stack, conforming a so called stack model. This qualifier
is only needed for situations where you need to use an indirect call to a
function for which you do not have a valid prototype.
void __stackparm stack_func ( int );
• • • • • • • •
1-12 TriCore Reference Manual
• • • • • • • •
1-14 TriCore Reference Manual
• • • • • • • •
1-16 TriCore Reference Manual
Table 1-6: Intrinsic Functions to Extract Values from Packed Data Types
C LANGUAGE
TriCore C Language 1-17
• • • • • • • •
1-18 TriCore Reference Manual
Table 1-7: Intrinsic Functions to Insert Values into Packed Data Types
• • • • • • • •
1-20 TriCore Reference Manual
You can also use inline assembly but these intrinsics provide a shorthand
for frequently used assembly instructions.
• • • • • • • •
1-22 TriCore Reference Manual
Atomic Load-Modify-Store
With the next intrinsic function you can peform atomic Load-Modify-Store
of a bit-field from an integer value. This function uses the IMASK and
LDMST instruction. The intrinsic writes the number of bits of an integer
value at a certain address location in memory with a bitoffset. The number
of bits must be a constant value.
Intrinsic Function
void __imaskldmst(int* address,int value,int bitoffset,int bits)
With the intrinsic macro __putbit() you can store a single bit atomicly
in memory at a specified bit offset. The bit at offset 0 in value is stored at
an address location in memory with a bitoffset.
• • • • • • • •
1-24 TriCore Reference Manual
Intrinsic Macro
void __putbit( int value, int* address, int bitoffset )
With the intrinsic macro __getbit() you can load a single bit from
memory at a specified bit offset. A bit value is loaded from an address
location in memory with a bitoffset and returned as an unsigned integer
value.
Intrinsic Macro
unsigned integer __getbit( int* address, int bitoffset )
C LANGUAGE
TriCore C Language 1-25
Intrinsic Function
int __mulsc( int a, int b, int offset )
Swap Mask
The next intrinsic exchanges the values of value and memory, but only
those bits that are allowed by mask. Before the __swapmsk instruction is
generated, the parameters value and mask are moved into a double
register.
Intrinsic Function
void __swapmsk ( int value, int mask, int * memory )
Intrinsic Function
__circ void * __initcirc( void * buf, unsigned short bufsize,
unsigned short byteindex )
• • • • • • • •
1-26 TriCore Reference Manual
1.6 PRAGMAS
Pragmas are keywords in the C source that control the behavior of the
compiler. Pragmas overrule compiler options and keywords.
#pragma CPU_functiona_problem
#pragma TC112_functional_problem
#pragma TC113_functional_problem
Use software work arounds for the specified functional problem.
See also the .EQU directive directive in Section 3.3, Assembler Directives
and Controls, in Chapter Assembly Language.
#pragma align n
#pragma align restore
See compiler option --align in section Compiler Options in Chapter Tool
Options.
#pragma clear
#pragma noclear
Performs 'clearing' or no 'clearing' of non-initialized static/public variables.
TriCore C Language 1-27
With this pragma you force the compiler to generate the .EXTERN
directive, creating an external symbol in the generated assembly source,
even when the symbol is not used in the C module.
• • • • • • • •
1-28 TriCore Reference Manual
#pragma indirect
Generates code for indirect function calling.
#pragma indirect_runtime
Generates code for indirect calls to run-time functions.
#pragma inline
#pragma noinline
C LANGUAGE
#pragma smartinline
See section 3.9.1, Inlining Functions of the User's Manual.
#pragma macro
#pragma nomacro
Turns macro expansion on or off. Default, macro expansion is turned on.
#pragma pack 2
#pragma pack 0
See section 3.2.4, Packed Data Types of the User's Manual.
#pragma source
#pragma nosource
See compiler option -s in section Compiler Options in Chapter Tool
Options.
• • • • • • • •
1-30 TriCore Reference Manual
See the .WEAK directive directive in Section 3.3, Assembler Directives and
Controls, in Chapter Assembly Language.
TriCore C Language 1-31
Macro Description
__DOUBLE_FP__ Defined when you do not use compiler option -F
(Treat double as float)
__SINGLE_FP__ Defined when you use compiler option -F (Treat
double as float)
__FPU__ Defined when you use compiler option
--fpu-present (Use hardware floating-point
instructions)
__CTC__ Identifies the compiler. You can use this symbol to flag
parts of the source which must be recognized by the
ctc compiler only. It expands to the version number of
the compiler.
__TASKING__ Identifies the compiler as the TASKING TriCore
compiler. It expands to 1.
__DSPC__ Indicates conformation to the DSP-C standard. It
expands to 1.
__DSPC_VERSION__ Expands to the decimal constant 200001L.
__VERSION__ Identifies the version number of the compiler. For
example, if you use version 2.1r1 of the compiler,
__VERSION__ expands to 2001 (dot and revision
number are omitted, minor version number in 3 digits).
__REVISION__ Identifies the revision number of the compiler. For
example, if you use version 2.1r1 of the compiler,
__REVISION__ expands to 1.
__BUILD__ Identifies the build number of the compiler, composed
of decimal digits for the build number, three digits for
the major branch number and three digits for the
minor branch number. For example, if you use build
1.22.1 of the compiler, __BUILD__ expands to
1022001. If there is no branch number, the branch
digits expand to zero. For example, build 127 results
in 127000000.
• • • • • • • •
1-32 TriCore Reference Manual
C LANGUAGE
CHAPTER
LIBRARIES
2
2-2 TriCore Reference Manual
CHAPTER
2
LIBRARIES
Libraries 2-3
2.1 INTRODUCTION
This chapter contains an overview of all library functions that you can call
in your C source. This includes all functions of the standard C library
(libc.a) and some functions of the floating-point library (libfp.a or
libfpt.a).
The following libraries are included in the TriCore (ctc) toolchain. Both
EDE and the control program cctc automatically select the appropriate
libraries depending on the specified TriCore derivative.
• • • • • • • •
2-4 TriCore Reference Manual
2.2.1 ASSERT.H
2.2.2 COMPLEX.H
The complex number z is also written as x+yi where x (the real part) and
y (the imaginary part) are real numbers of types float, double or long
double. The real and imaginary part can be stored in structs or in arrays.
This implementation uses arrays because structs may have different
alignments.
The header file complex.h also defines the following macros for
backward compatibility:
Parallel sets of functions are defined for double, float and long double.
LIBRARIES
Trigonometric functions
csin csinf csinl Returns the complex sine of z.
ccos ccosf ccosl Returns the complex cosine of z.
ctan ctanf ctanl Returns the complex tangent of z.
casin casinf casinl Returns the complex arc sine sin-1(z).
cacos cacosf cacosl Returns the complex arc cosine cos-1(z).
catan catanf catanl Returns the complex arc tangent tan-1(z).
csinh csinhf csinhl Returns the complex hyperbolic sine of z.
ccosh ccoshf ccoshl Returns the complex hyperbolic cosine of z.
ctanh ctanhf ctanhl Returns the complex hyperbolic tangent of z.
casinh casinh cfasinhl Returns the complex arc hyperbolic sinus of z.
cacosh cacosh cfacoshl Returns the complex arc hyperbolic cosinus of z.
catanh catanhfcatanhl Returns the complex arc hyperbolic tangent of z.
Manipulation functions
carg cargf cargl Returns the argument of z (also known as phase
angle).
cimag cimagf cimagl Returns the imaginary part of z as a real (re
spectively as a double, float, long double)
conj conjf conjl Returns the complex conjugate value (the sign
of its imaginary part is reversed).
• • • • • • • •
2-6 TriCore Reference Manual
cproj cprojf cprojl Returns the value of the projection of z onto the
Riemann sphere.
creal crealf creall Returns the real part of z (respectively as a
double, float, long double)
2.2.4 ERRNO.H
int errno External variable that holds implementation defined error codes.
• • • • • • • •
2-8 TriCore Reference Manual
EZERO 0 No error
EPERM 1 Not owner
ENOENT 2 No such file or directory
EINTR 3 Interrupted system call
EIO 4 I/O error
EBADF 5 Bad file number
EAGAIN 6 No more processes
ENOMEM 7 Not enough core
EACCES 8 Permission denied
EFAULT 9 Bad address
EEXIST 10 File exists
ENOTDIR 11 Not a directory
EISDIR 12 Is a directory
EINVAL 13 Invalid argument
ENFILE 14 File table overflow
EMFILE 15 Too many open files
ETXTBSY 16 Text file busy
ENOSPC 17 No space left on device
ESPIPE 18 Illegal seek
EROFS 19 Read-only file system
EPIPE 20 Broken pipe
ELOOP 21 Too many levels of symbolic links
ENAMETOOLONG 22 File name too long
Floating-point errors
2.2.5 FCNTL.H
The header file fcntl.h contains the function open(), which calls the
low level function _open(), and definitions of flags used by the low level
function _open(). This header file is not defined in ISO/IEC9899.
2.2.6 FENV.H
Contains mechanisms to control the floating-point environment. The
functions in this header file are not implemented.
• • • • • • • •
2-10 TriCore Reference Manual
2.2.7 FLOAT.H
The header file float.h defines the characteristics of the real
floating-point types float, double and long double.
2.2.8 FSS.H
The header file fss.h contains definitions and prototypes for low level
I/O functions used for CrossView Pro's file system simulation (FSS). The
low level functions are also declared in stdio.h; they are all
implemented as FSS functions. This header file is not defined in
ISO/IEC9899.
Stdio.h Description
Buffer and breakpoint functions for
LIBRARIES
_fss_break(void)
CrossView Pro.
Opens file descriptors 0 (stdin), 1 (stdout)
_fss_init(fd,is_close) and 2 (stderr) and associates them with
terminal window FSS 0 of CrossView Pro.
_close(fd)
_lseek(fd,offset,whence)
_open(fd,flags) See Low Level File Access Functions in
_read(fd,*buff,cnt) section 2.2.20, Stdio.h.
_unlink(*name)
_write(fd,*buffer,cnt)
Libraries 2-11
• • • • • • • •
2-12 TriCore Reference Manual
2.2.10 ISO646.H
The header file iso646.h adds tokens that can be used instead of regular
operator tokens.
2.2.11 LIMITS.H
Contains the sizes of integral types, defined as macros.
2.2.12 LOCALE.H
To keep C code reasonable portable accross different languages and
cultures, a number of facilities are provided in the header file local.h.
The following categories are defined and can be used as input for this
function:
LC_ALL 0 LC_NUMERIC 3
LC_COLLATE 1 LC_TIME 4
LC_CTYPE 2 LC_MONETARY 5
Libraries 2-13
The header file tgmath.h contains parallel type generic math macros
whose expansion depends on the used type. tgmath.h includes math.h
and the effect of expansion is that the correct math.h functions are called.
The type generic macro, if available, is listed in the second column of the
tables below.
Trigonometric functions
Math.h Tgmath.h Description
sin sinf sinl sin Returns the sine of x.
cos cosf cosl cos Returns the cosine of x.
tan tanf tanl tan Returns the tangent of x.
asin asinf asinl asin Returns the arc sine sin-1(x) of x.
acos acosf acosl acos Returns the arc cosine cos-1(x) of x.
atan atanf atanl atan Returns the arc tangent tan-1(x) of x.
atan2 atan2f atan2l atan2 Returns the result of: tan-1(y/x).
sinh sinhf sinhl sinh Returns the hyperbolic sine of x.
cosh coshf coshl cosh Returns the hyperbolic cosine of x.
tanh tanhf tanhl tanh Returns the hyperbolic tangent of x.
asinh asinhf asinhl asinh Returns the arc hyperbolic sinus of x.
• • • • • • • •
2-14 TriCore Reference Manual
Rounding functions
Math.h Tgmath.h Description
ceil ceilf ceill ceil Returns the smallest integer not
less than x, as a double.
floor floorf floorl floor Returns the largest integer not
greater than x, as a double.
rint rintl rintf rint Returns the rounded integer
value as an int according to the
current rounding direction. See
fenv.h. (Not implemented)
lrint lrintf lrintl lrint Returns the rounded integer
value as a long int according
to the current rounding direction.
See fenv.h. (Not implemented)
llrint lrintf lrintl llrint Returns the rounded integer
value as a long long int
according to the current rounding
direction. See fenv.h.
(Not implemented)
nearbyint nearbyintf nearbyint Returns the rounded integer
nearbyintl value as a floating-point
according to the current rounding
direction. See fenv.h.
(Not implemented)
round roundl roundf round Returns the nearest integer
value of x as int.
(Not implemented)
lround lroundl lroundf lround Returns the nearest integer
value of x as long int.
(Not implemented)
llround llroundl llroundf llround Returns the nearest integer
value of x as long long int.
(Not implemented)
trunc truncl truncf trunc Returns the truncated integer
value x. (Not implemented)
• • • • • • • •
2-16 TriCore Reference Manual
normally by computing
FLT_RADIXn explicitly.
scalbln scalblnl scalblnf scalbln Same as scalbn but with
argument n as long int.
Libraries 2-17
• • • • • • • •
2-18 TriCore Reference Manual
Comparison macros
The next are implemented as macros. For any ordered pair of numeric
values exactly one of the relationships - less, greater, and equal - is true.
These macros are type generic and therefor do not have a parallel function
in tgmath.h. All arguments must be expressions of real-floating type.
Classification macros
The next are implemented as macros. These macros are type generic and
therefor do not have a parallel function in tgmath.h. All arguments must
be expressions of real-floating type.
• • • • • • • •
2-20 TriCore Reference Manual
2.2.14 SETJMP.H
The setjmp and longjmp in this header file implement a primitive form
of nonlocal jumps, which may be used to handle exceptional situations.
This facility is traditionally considered more portable than signal.h.
2.2.15 SIGNAL.H
Signals are possible asynchronous events that may require special
processing. Each signal is named by a number. The following signals are
defined:
The first argument specifies the signal, the second argument points to the
signal-handler function or has one of the following values:
2.2.16 STDARG.H
The facilities in this header file gives you a portable way to access variable
arguments lists, such as needed for as fprintf and vfprintf. This
header file contains the following macros:
2.2.17 STDBOOL.H
This header file contains the following macro definitions. These names for
boolean type and values are consisten with C++. You are allowed to
#undefine or redefine the macros below.
• • • • • • • •
2-22 TriCore Reference Manual
2.2.18 STDDEF.H
This header file defines the types for common use:
2.2.19 STDINT.H
Types
The header file stdio.h contains for performing input and output. A
number of also have a parallel wide character function or macro, defined
in wchar.h. The header file wchar.h also stdio.h.
In the C language, many I/O facilities are based on the concept of streams.
The stdio.h header file defines the data type FILE which holds the
information about a stream. An FILE object is created with the function
LIBRARIES
Macros
Stdio.h Description
BUFSIZ 512 Size of the buffer used by the setbuf/setvbuf function:
512
EOF -1 End of file indicator.
WEOF UINTMAX End of file indicator.
NOTE: WEOF need not to be a negative number as long
as its value does not correspond to a member of the
wide character set. (Defined in wchar.h).
FOPEN_MAX Number of files that can be opened simultaneously: 4
NOTE: According to ISO/IEC 9899 this value must be at
least 8.
FILENAME_MAX 100 Maximum length of a filename: 100
_IOFBF Expand to an integer expression, suitable for use as
_IOLBF argument to the setvbuf function.
_IONBF
L_tmpnam Size of the string used to hold temporary file names: 8
(tmpxxxxx)
TMP_MAX 0x8000 Maximum number of unique temporary filenames that
can be generated: 0x8000
stderr Expressions of type "pointer to FILE" that point to the
stdin FILE objects associated with standard error, input and
stdout output streams.
• • • • • • • •
2-24 TriCore Reference Manual
File access
Stdio.h Description
fopen(name,mode) Opens a file for a given mode. Available
modes are:
"r" read; open text file for reading
"w" write; create text file for writing;
if the file already exists its contents is
discarded
"a" append; open existing text file or create
new text file for writing at end of file
"r+" open text file for update; reading and
writing
"w+" create text file for update; previous
contents if any is discarded
LIBRARIES
Stdio.h Description
freopen(name,mode,stream) Similar to fopen, but rather then generating a
new value of type FILE *, the existing value
is associated with a new stream.
(FSS implementation)
setbuf(stream,buffer) If buffer is NULL, buffering is turned off for
the stream. Otherwise, setbuf is equivalent
to:
(void)setvbuf(stream,buf,_IOFBF,
BUFSIZ).
setvbuf(stream,buffer, Controls buffering for the stream; this
mode,size) function must be called before reading or
writing. Mode can have the following values:
_IOFBF causes full buffering
_IOLBF causes line buffering of text files
_IONBF causes no buffering
If buffer is not NULL, it will be used as a
buffer; otherwise a buffer will be allocated.
size determines the buffer size.
Character input/output
The format string of printf related functions can contain plain text
mixed with conversion specifiers. Each conversion specifier should be
preceded by a '%' character. The conversion specifier should be build in
order:
- Flags (in any order):
- specifies left adjustment of the converted argument.
+ a number is always preceded with a sign character.
+ has higher precedence than space.
space a negative number is preceded with a sign, positive
numbers with a space.
0 specifies padding to the field width with zeros (only for
numbers).
# specifies an alternate output form. For o, the first digit will
be zero. For x or X, "0x" and "0X" will be prefixed to the
number. For e, E, f, g, G, the output always contains a
decimal point, trailing zeros are not removed.
• • • • • • • •
2-26 TriCore Reference Manual
Character Printed as
d, i int, signed decimal
o int, unsigned octal
x, X int, unsigned hexadecimal in lowercase or uppercase
LIBRARIES
respectively
u int, unsigned decimal
c int, single character (converted to unsigned char)
s char *, the characters from the string are printed until a NULL
character is found. When the given precision is met before,
printing will also stop
f double
e, E double
g, G double
Libraries 2-27
Character Printed as
n int *, the number of characters written so far is written into the
argument. This should be a pointer to an integer in default
memory. No value is printed.
p pointer (hexadecimal 24-bit value)
% No argument is converted, a '%' is printed.
• • • • • • • •
2-28 TriCore Reference Manual
Character Scanned as
d int, signed decimal.
i int, the integer may be given octal (i.e. a leading 0 is entered)
or hexadecimal (leading "0x" or "0X"), or just decimal.
o int, unsigned octal.
u int, unsigned decimal.
x int, unsigned hexadecimal in lowercase or uppercase.
c single character (converted to unsigned char).
s char *, a string of non white space characters. The argument
should point to an array of characters, large enough to hold the
string and a terminating NULL character.
f float
e, E float
g, G float
n int *, the number of characters written so far is written into the
argument. No scanning is done.
p pointer; hexadecimal 24-bit value which must be entered
without 0x- prefix.
[...] Matches a string of input characters from the set between the
brackets. A NULL character is added to terminate the string.
Specifying []...] includes the ']' character in the set of scanning
characters.
[^...] Matches a string of input characters not in the set between the
brackets. A NULL character is added to terminate the string.
Specifying [^]...] includes the ']' character in the set.
% Literal '%', no assignment is done.
• • • • • • • •
2-30 TriCore Reference Manual
• • • • • • • •
2-32 TriCore Reference Manual
Direct input/output
Stdio.h Description
fread(ptr,size,nobj,stream) Reads nobj members of size bytes
from the given stream into the array
pointed to by ptr. Returns the number of
elements succesfully read.
(FSS implementation)
fwrite((ptr,size,nobj,stream) Writes nobj members of size bytes from
to the array pointed to by ptr to the
given stream. Returns the number of
elements succesfully written.
(FSS implementation)
Random access
Stdio.h Description
fseek(stream,offset, Sets the position indicator for stream.
origin) (FSS implementation)
When repositioning a binary file, the new position origin is given by the following
macros:
SEEK_SET 0 offset characters from the beginning of the file
SEEK_CUR 1 offset characters from the current position in the file
SEEK_END 2 offset characters from the end of the file
Operations on files
Stdio.h Description
remove(file) Removes the named file, so that a subsequent
attempt to open it fails. Returns a non-zero value if
not succesful.
rename(old,new) Changes the name of the file from old name to new
name. Returns a non-zero value if not succesful.
tmpfile() Creates a temporary file of the mode "wb+" that will be
automatically removed when closed or when the
program terminates normally. Returns a file pointer.
tmpnam(buffer) Creates new file names that do not conflict with other
file names currently in use. The new file name is
stored in a buffer which must have room for
L_tmpnam characters. Returns a pointer to the
temporary name. The file names are created in the
current directory and all start with "tmp". At most
TMP_MAX unique file names can be generated.
Error handling
Stdio.h Description
clearerr(stream) Clears the end of file and error indicators for stream.
ferror(stream) Returns a non-zero value if the error indicator for
stream is set.
feof(stream) Returns a non-zero value if the end of file indicator for
stream is set.
perror(*s) Prints s and the error message belonging to the inte
ger errno. (See section 2.2.4, errno.h)
• • • • • • • •
2-34 TriCore Reference Manual
• Integer arithmetic
• Multibyte/wide character and string conversions.
Macros
RAND_MAX 32767 Highest number that can be returned by the
rand/srand function.
EXIT_SUCCES 0 Predefined exit codes that can be used in the exit
EXIT_FAILURE 1 function.
MB_CUR_MAX 1 Maximum number of bytes in a multibyte character
for the extended character set specified by the
current locale (category LC_CTYPE, see section
2.2.12, locale.h).
Numeric conversions
Next functions convert the intial portion of a string *s to a double, int,
long int and long long int value respectively.
double atof(*s)
int atoi(*s)
long atol(*s)
long long atoll(*s)
Next functions convert the initial portion of the string *s to a float, double
and long double value respectively. *endp will point to the first character
not used by the conversion.
Stdlib.h Wchar.h
float strtof(*s,**endp) float wcstof(*s,**endp)
double strtod(*s,**endp) double wcstod(*s,**endp)
long double strtold(*s,**endp) long double wcstold(*s,**endp)
LIBRARIES
Libraries 2-35
Next functions convert the initial portion of the string *s to a long, long
long, unsigned long and unsigned long long respectively. Base
specifies the radix. *endp will point to the first character not used by the
conversion.
Stdlib.h Wchar.h
long strtol (*s,**endp,base) long wcstol (*s,**endp,base)
long long strtoll long long wcstoll
(*s,**endp,base) (*s,**endp,base)
unsigned long strtoul unsigned long wcstoul
(*s,**endp,base) (*s,**endp,base)
unsigned long long strtoull unsigned long long wcstoull
(*s,**endp,base) (*s,**endp,base)
Memory management
malloc(size) Allocates space for an object with size size.
The allocated space is not initialized. Returns a
pointer to the allocated space.
calloc(nobj,size) Allocates space for n objects with size size.
The allocated space is initialized with zeros. Returns
a pointer to the allocated space.
free(*ptr) Deallocates the memory space pointed to by ptr
which should be a pointer earlier returned by the
malloc or calloc function.
realloc(*ptr,size) Deallocates the old object pointed to by ptr and
returns a pointer to a niew object with size size.
The new object cannot have a size larger than the
previous object.
• • • • • • • •
2-36 TriCore Reference Manual
Environment communication
abort() Causes abnormal program termination. If the signal
SIGABRTis caught, the signal handler may take over
control. (See section 2.2.15, signal.h).
atexit(*func) Func points to a function that is called (without
arguments) when the program normally terminates.
exit(status) Causes normal program termination. Acts as if
main() returns with status as the return value.
Status can also be specified with the predefined
macros EXIT_SUCCES or EXIT_FAILURE.
_Exit(status) Same as exit, but not registered by the atexit
function or signal handlers registerd by the signal
function are called.
getenv(*s) Searches an environment list for a string s. Returns a
pointer to the contents of s.
NOTE: this function is not implemented because
there is no OS.
system(*s) Passes the string s to the environment for execution.
NOTE: this function is not implemented because
there is no OS.
Integer arithmetic
int abs(j) Compute the absolute value of an int, long int,
long labs(j) and long long int j resepectively.
long long llabs(j)
div_t div(x,y) Compute x/y and x%y in a single operation. X and
ldiv_t ldiv(x,y) y have respectively type int, long int and
lldiv_t lldiv(x,y) long long int. The result is stored in the
members quot and rem of struct div_t,
ldiv_t and lldiv_t which have the same types.
• • • • • • • •
2-38 TriCore Reference Manual
Comparison functions
Stdio.h Wchar.h Description
memcmp(*s1,*s2,n) wmemcmp(*s1,*s2,n) Compares the first n
characters of *s1 to the first n
characters of *s2. Returns
< 0 if *s1 < *s2, 0 if *s1 = =
*s2, or > 0 if *s1 > *s2.
strcmp(*s1,*s2) wcscmp(*s1,*s2) Compares string *s1 to *s2.
Returns < 0 if *s1 < *s2, 0 if
*s1 = = *s2, or > 0 if *s1 >
*s2.
strncmp(*s1,*s2,n) wcsncmp(*s1,*s2,n) Compares the first n
characters of *s1 to the first n
characters of *s2. Returns <
0 if *s1 < *s2, 0 if *s1 = = *s2,
or > 0 if *s1 > *s2.
strcoll(*s1,*s2) wcscoll(*s1,*s2) Performs a local-specific
comparison between string
*s1 and string *s2 according
to the LC_COLLATE
category of the current
locale. Returns < 0 if *s1 <
*s2, 0 if *s1 = = *s2, or > 0 if
*s1 > *s2. (See section
2.2.12, locale.h)
strxfrm(*s1,*s2,n) wcsxfrm(*s1,*s2,n) Transforms (a local) string
*s2 so that a comparison
between transformed strings
with strcmp gives the same
result as a comparison
between non-transformed
strings with strcoll.
Returns the transformed
string *s1.
• • • • • • • •
2-40 TriCore Reference Manual
Search functions
Stdio.h Wchar.h Description
memchr(*s,c,n) wmemchr(*s,c,n) Checks the first n characters of
*s on the occurence of character
c. Returns a pointer to the found
character.
strchr(*s,c) wcschr(*s,c) Returns a pointer to the first
occurence of character c in *s or
the null pointer if not found.
strrchr(*s,c) wcsrchr(*s,c) Returns a pointer to the last
occurence of character c in *s or
the null pointer if not found.
strspn(*s,*set) wcsspn(*s,*set) Searches *s for a sequence of
characters specified in *set.
Returns the length of the first
sequence found.
strcspn(*s,*set) wcscspn(*s,*set) Searches *s for a sequence of
characters not specified in *set.
Returns the length of the first
sequence found.
strpbrk(*s,*set) wcspbrk(*s,*set) Same as strspn/wcsspn but
returns a pointer to the first
character in *s that also is
specified in *set.
strstr(*s,*sub) wcsstr(*s,*sub) Searches for a substring *sub in
*s. Returns a pointer to the first
occurence of *sub in *s.
strtok(*s,*dlm) wcstok(*s,*dlm) A sequence of calls to this
function breaks the string *s into
a sequence of tokens delimited
by a character specified in *dlm.
The token found in *s is
LIBRARIES
Miscellaneous functions
Stdio.h Wchar.h Description
memset(*s,c,n) wmemset(*s,c,n) Fills the first n bytes of *s with
character c and returns *s.
strerror(errno) - Typically, the values for errno
come from int errno. This
function returns a pointer to the
associated error message.
(See also section 2.2.4, errno.h)
strlen(*s) wcslen(*s) Returns the length of string *s.
• • • • • • • •
2-42 TriCore Reference Manual
Time manipulation
clock Returns the application's best approximation to the
processor time used by the program since it was
started. This low-level routine is not implemented
because it strongly depends on the hardware. To
determine the time in seconds, the result of clock
should be divided by the value defined as
CLOCKS_PER_SEC 12000000
difftime(t1,t0) Returns the difference t1-t0 in seconds.
mktime(tm *tp) Converts the broken-down time in the structure
pointed to by tp, to a value of type time_t. The
return value has the same encoding as the return
value of the time function.
time(*timer) Returns the current calendar time. This value is also
assigned to *timer.
Time conversion
asctime(tm *tp) Converts the broken-down time in the structure
pointed to by tp into a string in the form Mon Jan 21
16:15:14 2004\n\0. Returns a pointer to this
string.
ctime(*timer) Converts the calender time pointed to by timer to
local time in the form of a string. This is equivalent to:
asctime(localtime(timer))
gmtime(*timer) Converts the calender time pointed to by timer to the
broken-down time, expressed as UTC. Returns a
pointer to the broken-down time.
localtime(*timer) Converts the calendar time pointed to by timer to the
broken-down time, expressed as local time. Returns
a pointer to the broken-down time.
LIBRARIES
Libraries 2-43
Formatted time
The next function has a parallel function defined in wchar.h:
Stdio.h Wchar.h
strftime(*s,smax,*fmt,tm *tp) wstrftime(*s,smax,*fmt,tm *tp)
Formats date and time information from struct tm *tp into *s according
to the specified format *fmt. No more than smax characters are placed into
*s. The formatting of strftime is locale-specific using the LC_TIME
category (see section 2.2.12, locale.h). You can use the next conversion
specifiers:
• • • • • • • •
2-44 TriCore Reference Manual
2.2.24 UNISTD.H
The file unistd.h contains standard UNIX I/O functions. These functions
are all implemented using CrossView Pro's file system simulation. This
header file is not defined in ISO/IEC9899.
2.2.25 WCHAR.H
Many functions in wchar.h represent the wide-character variant of other
functions so these are discussed together. (See sections 2.2.20, stdio.h,
2.2.21, stdlib.h, 2.2.22, strings.h and 2.2.23, time.h).
When multibyte characters larger than 1 byte are used, this struct will be
used to store the conversion information when not all the bytes of a
particular multibyte character have been read from the source. In this
implementation, multi-byte characters are 1 byte long (MB_CUR_MAX and
MB_LEN_MAX are defined as 1) and this will never occur.
• • • • • • • •
2-46 TriCore Reference Manual
2.2.26 WCTYPE.H
Most functions in wctype.h represent the wide-character variant of
functions declared in ctype.h and are discussed in section 2.2.3, ctype.h.
In addition, this header file provides extensible, locale specific functions
and wide character classification.
• • • • • • • •
2-48 TriCore Reference Manual
• • • • • • • •
2-50 TriCore Reference Manual
• • • • • • • •
2-52 TriCore Reference Manual
• • • • • • • •
2-54 TriCore Reference Manual
memcmp wmemcmp -
memcpy wmemcpy -
memmovewmemmove -
memset wmemset -
mktime -
modf modfl modff -
nan nanl nanf (Not implemented)
Libraries 2-55
• • • • • • • •
2-56 TriCore Reference Manual
strncpy wcsncpy -
strpbrk wcspbrk -
strrchr wcsrchr -
strspn wcsspn -
strstr wcsstr -
strtod wcstod -
strtof wcstof -
strtoimax Sets errno via calls to other functions.
Libraries 2-57
• • • • • • • •
2-58 TriCore Reference Manual
Several functions in the C library are not reentrant due to the following
reasons:
- The iob[] structure is static. This influences all I/O functions.
- The ungetc[] array is static. This array holds the characters (one
for each stream) when ungetc() is called.
- The variable errno is globally defined. Numerous functions read or
modify errno
- _doprint and _doscan use static variables for e.g. character
counting in strings.
- Some string functions use locally defined (static) buffers. This is
LIBRARIES
prescribed by ANSI.
- malloc uses a static heap space.
The following description discusses these items into more detail. The
numbers at the begin of each paragraph relate to the number references in
the table above.
Libraries 2-59
The library routines can set errno to the values defined in errno.h. See
the file errno.h for more information.
errno can be set to ERR_FORMAT by the print and scan functions in the
C library if you specify illegal format strings.
• • • • • • • •
2-60 TriCore Reference Manual
(3) ungetc
Currently the ungetc buffer is static. For each file entry in the iob[]
structure array, there is one character available in the buffer to unget a
character.
strtok() scans through a string and remembers that the string and the
position in the string for subsequent calls. This function is not reentrant by
design. Making it reentrant requires support of a kernel to store the
information on a per process basis.
standard function.
(5) malloc
Malloc uses a heap space which is assigned at locate time. Thus this
implementation is not reentrant. Making a reentrant malloc requires some
sort of system call to obtain free memory space on a per process basis.
This is not easy to solve within the current context of the library. This
requires adaption to a kernel.
Libraries 2-61
• • • • • • • •
2-62 TriCore Reference Manual
LIBRARIES
CHAPTER
TRICORE ASSEMBLY
LANGUAGE
3
3-2 TriCore Reference Manual
CHAPTER
ASSEMBLY LANGUAGE
3
TriCore Assembly Language 3-3
3.1 INTRODUCTION
This chapter contains a detailed description of all built-in assembly
functions directives and controls. For a description of the TriCore
instruction set, refer to the TriCore Architecture v1.3 Manual [2000,
Infineon].
• • • • • • • •
3-4 TriCore Reference Manual
Function Description
@ABS(expr) Absolute value
@ACS(expr) Arc cosine
@ASN(expr) Arc sine
@AT2(expr1,expr2) Arc tangent
@ATN(expr) Arc tangent
@CEL(expr) Ceiling function
@COH(expr) Hyperbolic cosine
@COS(expr) Cosine
@FLR(expr) Floor function
@L10(expr) Log base 10
@LOG(expr) Natural logarithm
@MAX(expr,[,...,exprN]) Maximum value
@MIN(expr,[,...,exprN]) Minimum value
ASSEMBLY LANGUAGE
Function Description
@CVF(expr) Convert integer to floating-point
@CVI(expr) Convert floating-point to integer
@FLD(base,value, Shift and mask operation
width[,start])
@FRACT(expr) Convert floating-point to 32-bit fractional
@SFRACT(expr) Convert floating-point to 16-bit fractional
@LNG(expr) Concatenate to double word
@LUN(expr) Convert long fractional to floating-point
@RVB(expr1[,expr2]) Reverse order of bits in field
@UNF(expr) Convert fractional to floating-point
Function Description
@CAT(str1,str2) Concatenate strings
@LEN(string) Length of string
@POS(str1,str2[,start]) Position of substring in string
@SCP(str1,str2) Returns 1 if two strings are equal
@SUB(string,expr,expr) Returns a substring
Function Description
@ARG('symbol'|expr) Test if macro argument is present
@CNT() Return number of macro arguments
@MAC(symbol) Test if macro is defined
@MXP() Test if macro expansion is active
• • • • • • • •
3-6 TriCore Reference Manual
Function Description
@HI(expr) Returns upper 16 bits of expression value
@HIS(expr) Returns upper 16 bits of expression value,
adjusted for signed addition
@LO(expr) Returns lower 16 bits of expression value
@LOS(expr) Returns lower 16 bits of expression value,
adjusted for signed addition
@LSB(expr) Get least significant byte of a word
@MSB(expr) Get most significant byte of a word
Function Description
@ASPCP() Returns the name of the PCP assembler
executable
ASSEMBLY LANGUAGE
@ABS(expression)
Returns the absolute value of expression as an integer value.
Example:
AVAL .SET @ABS(-2.1) ; AVAL = 2
TriCore Assembly Language 3-7
@ACS(expression)
Returns the arc cosine of expression as a floating-point value in the range
zero to pi. The result of expression must be between -1 and 1.
Example:
ACOS .SET @ACS(-1.0) ;ACOS = 3.1415926535897931
@ARG('symbol' | expression)
Returns an integer 1 if the macro argument represented by symbol or
expression is present, 0 otherwise. If the argument is a symbol it must be
single-quoted and refer to a formal argument name. If the argument is an
expression it refers to the ordinal position of the argument in the macro
formal argument list. The assembler issues a warning if this function is
used when no macro expansion is active.
Example:
.IF @ARG('TWIDDLE') ;twiddle factor provided?
.IF @ARG(1) ;is first argument present?
@ASN(expression)
Returns the arc sine of expression as a floating-point value in the range
-pi/2 to pi/2. The result of expression must be between -1 and 1.
Example:
ARCSINE .SET @ASN(-1.0) ;ARCSINE = -1.570796
@ASPCP()
Returns the name of the PCP assembler executable. This is 'aspcp' for the
PCP assembler.
Example:
ANAME: .byte @ASPCP() ; ANAME = 'aspcp'
@ASTC()
Returns the name of the assembler executable. This is 'astc' for the TriCore
assembler.
Example:
ANAME: .byte @ASTC() ; ANAME = 'astc'
• • • • • • • •
3-8 TriCore Reference Manual
@AT2(expr1,expr2)
Returns the arc tangent of expr1/expr2 as a floating-point value in the
range -pi to pi. Expr1 and expr2 must be separated by a comma.
Example:
ATAN2 .EQU @AT2(-1.0,1.0) ;ATAN2 = -0.7853982
@ATN(expression)
Returns the arc tangent of expression as a floating-point value in the range
-pi/2 to pi/2.
Example:
ATAN .SET @ATN(1.0) ;ATAN = 0.78539816339744828
@CAT(string1,string2)
Concatenates the two strings into one string. The two strings must be
enclosed in single or double quotes.
ASSEMBLY LANGUAGE
Example:
.DEFINE ID "@CAT('Tri','Core')" ;ID = 'TriCore'
@CEL(expression)
Returns a floating-point value which represents the smallest integer greater
than or equal to expression.
Example:
CEIL .SET @CEL(-1.05) ;CEIL = -1.0
@CNT()
Returns the number of arguments of the current macro expansion as an
integer. The assembler issues a warning if this function is used when no
macro expansion is active.
Example:
ARGCNT .SET @CNT() ;reserve argument count
TriCore Assembly Language 3-9
@COH(expression)
Returns the hyperbolic cosine of expression as a floating-point value.
Example:
HYCOS .EQU @COH(VAL) ;compute hyperbolic cosine
@COS(expression)
Returns the cosine of expression as a floating-point value.
Example:
.WORD -@COS(@CVF(COUNT)*FREQ) ;compute cosine value
@CPU(string)
Returns an integer 1 if string corresponds to the selected CPU type; 0
otherwise. See also the assembler option -C (Select CPU).
Example:
IF @CPU("tc2") ;TriCore 2 specific part
@CVF(expression)
Converts the result of expression to a floating-point value.
Example:
FLOAT .SET @CVF(5) ;FLOAT = 5.0
@CVI(expression)
Converts the result of expression to an integer value. This function should
be used with caution since the conversions can be inexact (e.g.,
floating-point values are truncated).
Example:
INT .SET @CVI(-1.05) ;INT = -1
• • • • • • • •
3-10 TriCore Reference Manual
@DEF('symbol' | symbol)
Returns an integer 1 if symbol has been defined, 0 otherwise. symbol can
be any symbol or label not associated with a .MACRO or .SDECL directive.
If symbol is quoted it is looked up as a .DEFINE symbol; if it is not
quoted it is looked up as an ordinary symbol or label.
Example:
.IF @DEF('ANGLE') ;is symbol ANGLE defined?
.IF @DEF(ANGLE) ;does label ANGLE exist?
@EXP(expression)
Returns 0 if the evaluation of expression would normally result in an error.
Returns 1 if the expression can be evaluated correctly. With the @EXP
function, you prevent the assembler of generating an error if expression
contains an error. No test is made by the assembler for warnings. The
expression may be relative or absolute.
Example:
ASSEMBLY LANGUAGE
@FLD(base,value,width[,start])
Shift and mask value into base for width bits beginning at bit start. If start
is omitted, zero (least significant bit) is assumed. All arguments must be
positive integers and none may be greater than the target word size.
Returns the shifted and masked value.
Example:
VAR1 .EQU @FLD(0,1,1) ;turn bit 0 on, VAR1=1
VAR2 .EQU @FLD(0,3,1) ;turn bit 0 on, VAR2=1
VAR3 .EQU @FLD(0,3,2) ;turn bits 0 and 1 on, VAR3=3
VAR4 .EQU @FLD(0,3,2,1) ;turn bits 1 and 2 on, VAR4=6
VAR5 .EQU @FLD(0,1,1,7) ;turn eighth bit on, VAR5=0x80
TriCore Assembly Language 3-11
@FLR(expression)
Returns a floating-point value which represents the largest integer less
than or equal to expression.
Example:
FLOOR .SET @FLR(2.5) ;FLOOR = 2.0
@FRACT(expression)
This function returns the 32-bit fractional representation of the
floating-point expression. The expression must be in the range [-1,+1>.
Example:
.WORD @FRACT(0.1), @FRACT(1.0)
@HI(expression)
Returns the upper 16 bits of a value. @HI(expression) is equivalent to
((expression>>16) & 0xffff).
Example:
mov.u d2,#@LO(COUNT)
addih d2,d2,#@HI(COUNT) ; upper 16 bits of COUNT
@HIS(expression)
Returns the upper 16 bits of a value, adjusted for a signed addition.
@HIS(expression) is equivalent to (((expression+0x800)>>16) &
0xffff).
Example:
movh.a a3,#@HIS(label)
lea a3,[a3]@LOS(label)
@INT(expression)
Returns an integer 1 if expression has an integer result; otherwise, it
returns a 0. The expression may be relative or absolute.
Example:
.IF @INT(TERM) ;Test if result is an integer
• • • • • • • •
3-12 TriCore Reference Manual
@L10(expression)
Returns the base 10 logarithm of expression as a floating-point value.
expression must be greater than zero.
Example:
LOG .EQU @L10(100.0) ;LOG = 2
@LEN(string)
Returns the length of string as an integer.
Example:
SLEN .SET @LEN('string') ;SLEN = 6
@LNG(expr1,expr2)
Concatenates the 16-bit expr1 and expr2 into a 32-bit word value such
that expr1 is the high half and expr2 is the low half.
Example:
ASSEMBLY LANGUAGE
@LO(expression)
Returns the lower 16 bits of a value. @LO(expression) is equivalent to
expression & 0xffff).
Example:
mov.u d2,#@LO(COUNT) ;lower 16 bits of COUNT
addih d2,d2,#@HI(COUNT)
@LOG(expression)
Returns the natural logarithm of expression as a floating-point value.
expression must be greater than zero.
Example:
LOG .EQU @LOG(100.0) ;LOG = 4.605170
TriCore Assembly Language 3-13
@LOS(expression)
Returns the lower 16 bits of a value, adjusted for a signed addition.
@LOS(expression) is equivalent to (((expression+0x8000) &
0xffff) - 0x8000).
Example:
movh.a a3,#@HIS(label)
lea a3,[a3]@LOS(label)
@LSB(expression)
Returns the least significant byte of the result of the expression.
expression is interpreted as a half word (16 bit).
Example:
VAR1 .SET @LSB(0x34) ;VAR1 = 0x34
VAR2 .SET @LSB(0x1234) ;VAR2 = 0x34
VAR3 .SET @LSB(0x654321) ;VAR3 = 0x21
@LST()
Returns the value of the $LIST ON/OFF control flag as an integer.
Whenever a $LIST ON control is encountered in the assembler source, the
flag is incremented; when a $LIST OFF control is encountered, the flag is
decremented.
Example:
.DUP @ABS(@LST()) ;list unconditionally
@LUN(expression)
Converts the 32-bit expression to a floating-point value. expression should
represent a binary fraction.
Example:
DBLFRC1 .EQU @LUN(0x40000000) ;DBLFRC1 = 0.5
DBLFRC2 .EQU @LUN(3928472) ;DBLFRC2 = 0.007354736
DBLFRC3 .EQU @LUN(0xE0000000) ;DBLFRC3 = -0.75
• • • • • • • •
3-14 TriCore Reference Manual
@MAC(symbol)
Returns an integer 1 if symbol has been defined as a macro name, 0
otherwise.
Example:
.IF @MAC(DOMUL) ;does macro DOMUL exist?
@MAX(expr1[,exprN]...)
Returns the greatest of expr1,...,exprN as a floating-point value.
Example:
MAX: .BYTE @MAX(1,-2.137,3.5) ;MAX = 3.5
@MIN(expr1[,exprN]...)
Returns the least of expr1,...,exprN as a floating-point value.
Example:
ASSEMBLY LANGUAGE
@MSB(expression)
Returns the most significant byte of the result of the expression.
expression is interpreted as a half word (16 bit).
Example:
VAR1 .SET @MSB(0x34) ;VAR1 = 0x00
VAR2 .SET @MSB(0x1234) ;VAR2 = 0x12
VAR3 .SET @MSB(0x654321) ;VAR3 = 0x43
@MXP()
Returns an integer 1 if the assembler is expanding a macro, 0 otherwise.
Example:
.IF @MXP() ;macro expansion active?
TriCore Assembly Language 3-15
@POS(str1,str2[,start])
Returns the position of str2 in str1 as an integer, starting at position start. If
start is not given the search begins at the beginning of str1. If the start
argument is specified it must be a positive integer and cannot exceed the
length of the source string. Note that the first position in a string is
position 0.
Example:
ID .EQU @POS('TriCore','Core') ;ID = 3
ID2 .EQU @POS('ABCDABCD','B',2) ;ID2 = 5
@POW(expr1,expr2)
Returns expr1 raised to the power expr2 as a floating-point value. expr1
and expr2 must be separated by a comma.
Example:
BUF .EQU @CVI(@POW(2.0,3.0)) ;BUF = 8
@RND()
Returns a random value in the range 0.0 to 1.0.
Example:
SEED .EQU @RND() ;save initial SEED value
@RVB(expr1,expr2)
Reverse the order of bits in expr1 delimited by the number of bits in
expr2. If expr2 is omitted the field is bounded by the target word size.
Both expressions must be 16-bit integer values.
Example:
VAR1 .SET @RVB(0x200) ;reverse all bits, VAR1=0x40
VAR2 .SET @RVB(0xB02) ;reverse all bits, VAR2=0x40D0
VAR3 .SET @RVB(0xB02,2) ;reverse bits 0 and 1,
;VAR3=0xB01
• • • • • • • •
3-16 TriCore Reference Manual
@SCP(str1,str2)
Returns an integer 1 if the two strings compare, 0 otherwise. The two
strings must be separated by a comma.
Example:
.IF @SCP(STR,'MAIN') ;does STR equal MAIN?
@SFRACT(expression)
This function returns the 16-bit fractional representation of the
floating-point expression. The expression must be in the range [-1,+1>.
Example:
.WORD @SFRACT(0.1), @SFRACT(1.0)
@SGN(expression)
Returns the sign of expression as an integer: -1 if the argument is negative,
0 if zero, 1 if positive. The expression may be relative or absolute.
ASSEMBLY LANGUAGE
Example:
VAR1 .SET @SGN(-1.2e-92) ;VAR1 = -1
VAR2 .SET @SGN(0) ;VAR2 = 0
VAR3 .SET @SGN(28.382) ;VAR3 = 1
@SIN(expression)
Returns the sine of expression as a floating-point value.
Example:
.WORD @SIN(@CVF(COUNT)*FREQ) ;compute sine value
@SNH(expression)
Returns the hyperbolic sine of expression as a floating-point value.
Example:
HSINE .EQU @SNH(VAL) ;hyperbolic sine
TriCore Assembly Language 3-17
@SQT(expression)
Returns the square root of expression as a floating-point value. expression
must be positive.
Example:
SQRT1 .EQU @SQT(3.5) ;SQRT1 = 1.870829
SQRT2 .EQU @SQT(16) ;SQRT2 = 4
@SUB(string,expression1,expression2)
Returns the substring from string as a string. Expression1 is the starting
position within string, and expression2 is the length of the desired string.
The assembler issues an error if either expression1 or expression2 exceeds
the length of string. Note that the first position in a string is position 0.
Example:
.DEFINE ID "@SUB('TriCore',3,4)" ;ID = 'Core'
@TAN(expression)
Returns the tangent of expression as a floating-point value.
Example:
TANGENT .SET @TAN(1.0) ;TANGENT = 1.5574077
@TNH(expression)
Returns the hyperbolic tangent of expression as a floating-point value.
Example:
HTAN .SET @TNH(1) ;HTAN = 0.76159415595
@UNF(expression)
Converts expression to a floating-point value. expression should represent
a 16-bit binary fraction.
Example:
FRC .EQU @UNF(0x4000) ;FRC = 0.5
• • • • • • • •
3-18 TriCore Reference Manual
@XPN(expression)
Returns the exponential function (base e raised to the power of
expression) as a floating-point value.
Example:
EXP .EQU @XPN(1.0) ;EXP = 2.718282
ASSEMBLY LANGUAGE
TriCore Assembly Language 3-19
Directive Description
.COMMENT Start comment lines
.DEFINE Define substitution string
.END End of source program
.FAIL Programmer generated error message
.INCLUDE Include file
.MESSAGE Programmer generated message
.ORG Initialize memory space and location counters to
create a nameless section
.SDECL Declare a section with name, type and attributes
.SECT Activate a declared section
.UNDEF Undefine DEFINE symbol
.WARNING Programmer generated warning
• • • • • • • •
3-20 TriCore Reference Manual
Directive Description
.EQU Assign permanent value to a symbol
.EXTERN External symbol declaration
.GLOBAL Global section symbol declaration
.LOCAL Local symbol declaration
.SET Set temporary value to a symbol
.SIZE Set size of symbol in the ELF symbol table
.TYPE Set symbol type in the ELF symbol table
.WEAK Mark symbol as 'weak'
Directive Description
.ACCUM Define 64-bit constant of 18 + 46 bits format
ASSEMBLY LANGUAGE
Directive Description
.DUP / .ENDM Duplicate sequence of source lines
.DUPA / .ENDM Duplicate sequence with arguments
.DUPC / .ENDM Duplicate sequence with characters
.DUPF / .ENDM Duplicate sequence in loop
.EXITM Exit macro
.IF / .ELIF / .ELSE / Conditional assembly
.ENDIF
.MACRO / .ENDM Define macro
.PMACRO Undefine (purge) macro definition
Function Description
.CALLS Passes call information to object file. Used by the
linker to build a call graph and calculate stack size.
• • • • • • • •
3-22 TriCore Reference Manual
.ACCUM
Syntax
[label:] .ACCUM expression[,expression]...
Description
With the .ACCUM directive (Define 64-bit Constant) the assembler allocates
and initializes two words of memory (64 bits) for each argument. Use
commas to separate multiple arguments.
If the evaluated expression is out of the range [-217, 217>, the assembler
ASSEMBLY LANGUAGE
Example
ACC: .ACCUM 0.1,0.2,0.3
Related information
.SPACE (Define storage)
.ALIGN
Syntax
.ALIGN expression
Description
With the .ALIGN directive you instruct the assembler to align the location
counter. By default the assembler aligns on one byte.
Example
.ALIGN 16 ; the assembler aligns
add d2,d2,d4 ; this instruction at 16 bytes and
; fills the 'gap' with NOP instructions
Related information
-
• • • • • • • •
3-24 TriCore Reference Manual
.ASCII/.ASCIIZ
Syntax
[label:] .ASCII string[,string]...
Description
With the .ASCII or .ASCIIZ directive the assembler allocates and
initializes memory for each string argument.
The .ASCII directive does not add a NULL byte to the end of the string.
The .ASCIIZ directive does add a NULL byte to the end of the string. The
"z" in .ASCIIZ stands for "zero". Use commas to separate multiple strings.
Example
STRING: .ASCII "Hello world"
With the .BYTE directive you can obain exactly the same effect:
STRING: .BYTE "Hello world" ; without a NULL byte
STRINGZ: .BYTE "Hello world",0 ; with a NULL byte
Related information
.SPACE (Define storage)
.BYTE
Syntax
[label] .BYTE argument[,argument]...
Description
With the .BYTE directive (Define Constant Byte) the assembler allocates
and initializes a byte of memory for each argument.
If you specify label, it gets the value of the location counter at the start of
the directive processing.
Integer arguments are stored as is, but must be byte values (within the
range 0-255); floating-point numbers are not allowed. If the evaluated
expression is out of the range [-256, +255] the assembler issues an error.
For negative values within that range, the assembler adds 256 to the
specified value (for example, -254 is stored as 2).
Example
TABLE .BYTE 'two',0,'strings',0
CHARS .BYTE 'A','B','C','D'
Related information
.SPACE (Define storage)
• • • • • • • •
3-26 TriCore Reference Manual
.CALLS
Syntax
.CALLS 'caller', 'callee' [,call_frequency [,stack_usage]...]
Description
Create a flow graph reference between caller and callee. With this
information the linker can build a call graph and calculate stack size.
Caller and Callee are names of functions. The call_frequency shows how
many times the callee is called. The stack_usage represents the stack usage
in bytes at the location of the call or the maximum stack usage of function
caller. A function can use multiple stacks.
Example
.CALLS 'main', 'nfunc', 1, 8
Indicates that the function main calls the function nfunc 1 time and that
the stack usage at the location of the call is 8 bytes.
.CALLS 'main', '', 0, 8
Related information
-
TriCore Assembly Language 3-27
.COMMENT
Syntax
.COMMENT delimiter
.
.
delimiter
Description
With the .COMMENT directive (Start Comment Lines) you can define one or
more lines as comments. The first non-blank character after the .COMMENT
directive is the comment delimiter. The two delimiters are used to define
the comment text. The line containing the second comment delimiter will
be considered the last line of the comment. The comment text can include
any printable characters and the comment text will be produced in the
source listing as it appears in the source file.
Example
.COMMENT + This is a one line comment +
.COMMENT * This is a multiple line
comment. Any number of lines
can be placed between the two
delimiters.
*
Related information
-
• • • • • • • •
3-28 TriCore Reference Manual
.DEFINE
Syntax
.DEFINE symbol string
Description
With the .DEFINE directive you define a substitution string that you can
use on all following source lines. The assembler searches all succeeding
lines for an occurrence of symbol, and replaces it with string. If the symbol
occurs in a double quoted string it is also replaced. Strings between single
quotes are not expanded.
Example
If the following .DEFINE directive occurred in the first part of the source
program:
.DEFINE LEN '32'
Related information
.UNDEF (Undefine .DEFINE symbol)
.SET (Set temporary value to a symbol)
TriCore Assembly Language 3-29
.DUP / .ENDM
Syntax
[label] .DUP expression
.
.
.ENDM
Description
The sequence of source lines between the .DUP and .ENDM directives will
be duplicated by the number specified by the integer expression. If the
expression evaluates to a number less than or equal to 0, the sequence of
lines will not be included in the assembler output. The expression result
must be an absolute integer and cannot contain any forward references to
address labels (labels that have not already been defined). You can nest
the .DUP directive to any level.
If you specify label, it gets the value of the location counter at the start of
the DUP directive processing.
Example
Consider the following source input statements,
COUNT .SET 3
.DUP COUNT ; duplicate NOP count times
NOP
.ENDM
Related information
.DUPA (Duplicate Sequence with Arguments),
.DUPC (Duplicate Sequence with Characters),
.DUPF (Duplicate Sequence in Loop),
.MACRO (Define Macro)
• • • • • • • •
3-30 TriCore Reference Manual
.DUPA / .ENDM
Syntax
[label] .DUPA formal_arg,argument[,argument]...
.
.
.ENDM
Description
With the .DUPA and .ENDM directives (Duplicate Sequence with
Arguments) you can repeat a block of source statements for each
argument. For each repetition, every occurrence of the formal_arg
parameter within the block is replaced with each succeeding argument
string. If an argument includes an embedded blank or other
assembler-significant character, it must be enclosed with single quotes.
If you specify label, it gets the value of the location counter at the start of
the .DUPA directive processing.
ASSEMBLY LANGUAGE
Example
Consider the following source input statements,
.DUPA VALUE,12,,32,34
.BYTE VALUE
.ENDM
The second statement results in a warning of the assembler that the local
symbol VALUE is not defined in this module and is made external.
Related information
.DUP (Duplicate Sequence of Source Lines),
.DUPC (Duplicate Sequence with Characters),
.DUPF (Duplicate Sequence in Loop),
.MACRO (Define Macro)
TriCore Assembly Language 3-31
.DUPC / .ENDM
Syntax
[label] .DUPC formal_arg,string
.
.
.ENDM
Description
With the .DUPC and .ENDM directives (Duplicate Sequence with
Characters) you can repeat a block of source statements for each character
within string. For each character in the string, the formal_arg parameter
within the block is replaced with that character If the string is empty, then
the block is skipped.
If you specify label, it gets the value of the location counter at the start of
the .DUPC directive processing.
Example
Consider the following source input statements,
.DUPC VALUE,'123'
.BYTE VALUE
.ENDM
Related information
.DUP (Duplicate Sequence of Source Lines),
.DUPA (Duplicate Sequence with Arguments),
.DUPF (Duplicate Sequence in Loop),
.MACRO (Define Macro)
• • • • • • • •
3-32 TriCore Reference Manual
.DUPF / .ENDM
Syntax
[label] .DUPF formal_arg,[start],end[,increment]
.
.
.ENDM
Description
With the .DUPF and .ENDM directives (Duplicate Sequence in Loop) you
can repeat a block of source statements (end - start) + 1 / increment
times. Start is the starting value for the loop index; end represents the final
value. Increment is the increment for the loop index; it defaults to 1 if
omitted (as does the start value). The formal_arg parameter holds the
loop index value and may be used within the body of instructions.
If you specify label, it gets the value of the location counter at the start of
the .DUPF directive processing.
ASSEMBLY LANGUAGE
Example
Consider the following source input statements,
.DUPF NUM,0,7
MOV D\NUM,#0
.ENDM
Related information
.DUP (Duplicate Sequence of Source Lines),
.DUPA (Duplicate Sequence with Arguments),
.DUPC (Duplicate Sequence with Characters),
.MACRO (Define Macro)
TriCore Assembly Language 3-33
.END
Syntax
.END [expression]
Description
With the optional .END directive you tell the assembler that the logical end
of the source program is reached. If the assembler finds assembly source
lines beyond the .END directive, it ignores those lines and issues a
warning.
Example
.END ;End of source program
Related information
-
• • • • • • • •
3-34 TriCore Reference Manual
.EQU
Syntax
symbol .EQU expression
Description
With the .EQU directive you assign the value of expression to symbol
permanently. Once defined, you cannot redefine the symbol.
Example
To assign the value 0x4000 permanently to the symbol A_D_PORT :
A_D_PORT .EQU 0x4000
Related information
.SET (Set temporary value to a symbol)
TriCore Assembly Language 3-35
.EXITM
Syntax
.EXITM
Description
With the .EXITM directive (Exit Macro) the assembler will immediately
terminate a macro expansion. It is useful when you use it with the
conditional assembly directive .IF to terminate macro expansion when,
for example, error conditions are detected.
Example
CALC .MACRO XVAL,YVAL
.IF XVAL<0
.FAIL 'Macro parameter value out of range'
.EXITM ;Exit macro
.ENDIF
.
.
.
.ENDM
Related information
.DUP (Duplicate Sequence of Source Lines),
.DUPA (Duplicate Sequence with Arguments),
.DUPC (Duplicate Sequence with Characters),
.DUPF (Duplicate Sequence in Loop),
.MACRO (Define Macro)
• • • • • • • •
3-36 TriCore Reference Manual
.EXTERN
Syntax
.EXTERN symbol[,symbol]...
Description
With the .EXTERN directive (External Symbol Declaration) you specify that
the list of symbols is referenced in the current module, but is not defined
within the current module. These symbols must either have been defined
outside of any module or declared as globally accessible within another
module with the .GLOBAL directive.
Example
.EXTERN AA,CC,DD ;defined elsewhere
Related information
.GLOBAL (Global symbol declaration)
.LOCAL (Local symbol declaration)
TriCore Assembly Language 3-37
.FAIL
Syntax
.FAIL [{string | exp}[,{string | exp}]...]
Description
With the .FAIL directive (Programmer Generated Error) you tell the
assembler to output an error message during the assembling process.
The total error count will be incremented as with any other error. The
.FAIL directive is for example useful in combination with conditional
assembly for exceptional condition checking. The assembly process
proceeds normally after the error has been printed.
With this directive the assembler exits with exit code 1 (an error).
Example
.FAIL 'Parameter out of range'
Related information
.MESSAGE (Programmer Generated Message),
.WARNING (Programmer Generated Warning)
• • • • • • • •
3-38 TriCore Reference Manual
.FLOAT/.DOUBLE
Syntax
[label] .FLOAT expression[,expression]...
Description
With the .FLOAT or .DOUBLE directive the assembler allocates and
initializes a floating-point number (32 bits) or a double (64 bits) in
memory for each argument.
If you specify label, it gets the value of the location counter at the start of
the directive processing.
Examples
FLT: .FLOAT 12.457,+0.27E-13
Related information
.SPACE (Define storage)
TriCore Assembly Language 3-39
.FRACT/.SFRACT
Syntax
[label:] .FRACT expression[,expression]...
Description
With the .FRACT or .SFRACT directive the assembler allocates and
initializes one word of memory (32 bits) or a halfword (16 bits) for each
argument. Use commas to separate multiple arguments.
If the evaluated argument is out of the range [-1, +1> , the assembler
issues a warning and saturates the fractional value.
Example
FRCT: .FRACT 0.1,0.2,0.3
Related information
.SPACE (Define storage)
• • • • • • • •
3-40 TriCore Reference Manual
.GLOBAL
Syntax
.GLOBAL symbol[,symbol]...
Description
All symbols or labels defined in the current section or module are local to
the module by default. You can change this default behavior with
assembler option -ig.
Only symbols that are defined with the .EQU directive or program labels
can be made global.
ASSEMBLY LANGUAGE
If the symbols that appear in the operand field are not used in the module,
the assembler gives a warning.
Example
.SDECL ".data.io",DATA
.SECT ".data.io"
.GLOBAL LOOPA ; LOOPA will be globally
; accessible by other modules
LOOPA .HALF 0x100 ; assigns the value 0x100 to LOOPA
Related information
.EXTERN (External symbol declaration)
.LOCAL (Local symbol declaration)
TriCore Assembly Language 3-41
Description
With the .IF/ .ENDIF directives you can create a part of conditional
assembly code. The assembler assembles only the code that matches a
specified condition.
You can nest .IF directives to any level. The .ELSE, .ELIF and .ENDIF
directives always refer to the nearest previous .IF directive.
Example
Suppose you have an assemble source file with specific code for a test
version, for a demo version and for the final version. Within the assembly
source you define this code conditionally as follows:
.IF TEST
... ; code for the test version
.ELIF DEMO
... ; code for the demo version
.ELSE
... ; code for the final version
.ENDIF
• • • • • • • •
3-42 TriCore Reference Manual
Before assembling the file you can set the values of the symbols .TEST
and .DEMO in the assembly source before the .IF directive is reached. For
example, to assemble the demo version:
TEST .SET 0
DEMO .SET 1
You can also define the symbols on the command line with the option -D:
astc -DDEMO -DTEST=0 test.src
Related information
-
ASSEMBLY LANGUAGE
TriCore Assembly Language 3-43
.INCLUDE
Syntax
.INCLUDE 'filename' | <filename>
Description
With the .INCLUDE directive you include another file at the exact location
in the source where the .INCLUDE occurs. The .INCLUDE directive works
similarly to the #include statement in C. The source from the include file
is assembled as if it followed the point of the .INCLUDE directive. When
the end of the included file is reached, assembly of the original file
continues.
The current directory is not searched if you use the <filename> syntax.
Example
.INCLUDE 'storage\mem.asm' ; include file
.INCLUDE <data.asm> ; Do not look in
; current directory
Related information
Assembler option -I (Add directory to include file search path) in section
5.2, Assembler Options, of Chapter Tool Options.
• • • • • • • •
3-44 TriCore Reference Manual
.LOCAL
Syntax
.LOCAL symbol[,symbol]...
Description
All symbols or labels defined in the current section or module are local to
the module by default. You can change this default behavior with
assembler option -ig.
With the .LOCAL directive (Local Section Symbol Declaration) you declare
one of more symbols as local. This means that the specified symbols are
explicitly local to the module in which you define them.
If the symbols that appear in the operand field are not used in the module,
the assembler gives a warning.
Example
.SDECL ".data.io",DATA
.SECT ".data.io"
.LOCAL LOOPA ; LOOPA is local to this section
Related information
.EXTERN (External symbol declaration)
.GLOBAL (Global symbol declaration)
TriCore Assembly Language 3-45
.MACRO / .ENDM
Syntax
macro_name .MACRO [dumarg[,dumarg]...]
.
macro_definition_statements
.
.
.ENDM
Description
With the .MACRO directive you define a macro. Macros provide a
shorthand method for handling a repeated pattern of code or group of
instructions. You can define the pattern as a macro, and then call the
macro at the points in the program where the pattern would repeat. The
.ENDM directive indicates the end of the macro.
Macro definitions can be nested but the nested macro will not be defined
until the primary macro is expanded.
• • • • • • • •
3-46 TriCore Reference Manual
Example
The macro definition:
CONSTD .MACRO reg,value ;header
mov.u reg,#lo(value) ;body
ASSEMBLY LANGUAGE
addih reg,reg,#hi(value)
.ENDM ;terminator
Related information
.DUP (Duplicate Sequence of Source Lines),
.DUPA (Duplicate Sequence with Arguments),
.DUPC (Duplicate Sequence with Characters),
.DUPF (Duplicate Sequence in Loop)
.MESSAGE
Syntax
.MESSAGE [{string | exp}[,{string | exp}]...]
Description
With the .MESSAGE directive (Programmer Generated Message) you tell
the assembler to output an information message durring assembly.
The error and warning counts will not be affected. The .MESSAGE
directive is for example useful in combination with conditional assembly
for informational purposes. The assembly proceeds normally after the
message has been printed.
Example
.DEFINE LONG "SHORT"
.MESSAGE 'This is a LONG string'
.MESSAGE "This is a LONG string"
Within single quotes, the defined symbol LONG is not expanded. Within
double quotes the symbol LONG is expanded. So, the actual message is
printed as:
This is a LONG string
This is a SHORT string
Related information
.FAIL (Programmer Generated Error)
.WARNING (Programmer Generated Warning)
• • • • • • • •
3-48 TriCore Reference Manual
.ORG
Syntax
.ORG [abs-loc][,sect_type][,attribute]...
Description
With the .ORG directive you can specify an absolute location (abs_loc) in
memory of a section. This is the same as a .SDECL/.SECT without a
section name.
Code attibutes:
init section is copied from ROM to RAM at startup
noread section can be executed from but not read
Data attibutes:
noclear section is not cleared during startup
max data overlay with other parts with the same
name, is implicit a type of 'noclear'
rom data section remains in ROM
Example
; define a section on location 100 decimal
.org 100
Related information
.SDECL (Declare section name and attributes)
.SECT (Activate a declared section)
• • • • • • • •
3-50 TriCore Reference Manual
.PMACRO
Syntax
.PMACRO symbol[,symbol]...
Description
With the .PMACRO directive (Purge Macro) you tell the assembler to
undefine the specified macro, so that later uses of the symbol will not be
expanded.
Example
.PMACRO MAC1,MAC2
This statement causes the macros named MAC1 and MAC2 to be undefined.
Related information
ASSEMBLY LANGUAGE
.SDECL
Syntax
.SDECL "name", type [, attribute ]... [AT address]
Description
With the .SDECL directive you can define a section with a name, type and
optional attributes. Before any code or data can be placed in a section,
you must use the .SECT directive to activate the section.
Code attibutes:
init section is copied from ROM to RAM at startup
noread section can be executed from but not read
Data attibutes:
noclear section is not cleared during startup
max data overlay with other parts with the same
name, is implicit a type of 'noclear'
rom data section remains in ROM
Sections with attribute noclear are not zeroed at startup. This is a default
attribute for data sections. You can only use this attribute with a data
type section. This attribute is only useful with BSS sections, which are
cleared at startup by default.
The attribute init defines that the code section contains initialization
data, which is copied from ROM to RAM at program startup.
Sections with the attribute rom contain data to be placed in ROM. This
ROM area is not executable.
When data sections with the same name occur in different object
modules with the attribute max, the linker generates a section with a size
that is the largest of the sizes in the individual object modules. The
attribute max only applies to data sections.
• • • • • • • •
3-52 TriCore Reference Manual
The name of a section can have a special meaning for locating sections.
The name of code sections should always start with ".text" (or
".pcptext" for PCP code). With data sections, the prefix in the name is
important. The prefix determines if the section is initialized, constant or
uninitialized and which addressing mode is used.
.bss uninitialized
.zbss uninitialized, abs 18 addressing
.sbss uninitialized, a0 addressing
.bss_a8 uninitialized, a8 addressing
.bss_a9 uninitialized, a9 addressing
.ldata a1 addressing (read only constants, literal data)
.pcpdata pcp data
prefix.module-name.function-or-object-name
Examples:
.sdecl ".text.t.main", CODE ; declare code section
.sect ".text.t.main" ; activate section
• • • • • • • •
3-54 TriCore Reference Manual
.SECT
Syntax
.SECT "name" [, RESET]
Description:
With the .SECT directive you activate a previously declared section with
the name name. Before you can activate a section, you must define the
section with the .SDECL directive. You can activate a section as many
times as you need.
With the section attribute RESET you can reset counting storage allocation
in data sections that have section attribute max.
Examples:
.sdecl ".zdata.t.var2", DATA ; declare data section
.sect ".zdata.t.var2" ; activate section
ASSEMBLY LANGUAGE
.SET
Syntax
symbol .SET expression
Description
With the .SET directive you assign the value of expression to symbol
temporarily. If a symbol was defined with the .SET directive, you can
redefine that symbol in another part of the assembly source, using another
.SET. directive.
Symbols that are set with the .EQU directive, cannot be redefined.
Example
COUNT .SET 0 ; Initialize COUNT. Later on you can
; assign other values to the symbol COUNT.
Related information
..EQU (Assign permanent value to a symbol)
• • • • • • • •
3-56 TriCore Reference Manual
.SIZE
Syntax
.SIZE symbol, expression
Description
With the .SIZE directive you set the size of the specified symbol to the
value represented by expression.
The .SIZE directive may occur anywhere in the source file unless the
specified symbol is a function. In this case, the .SIZE directive must occur
after the function has been defined.
Example
main: .type func
. ; function main
.
ret16
ASSEMBLY LANGUAGE
main_function_end:
.size main,main_function_end-main
Related information
.TYPE (Set Symbol Type)
TriCore Assembly Language 3-57
.SPACE
Syntax
[label] .SPACE expression
Description
With the .SPACE directive (Define Storage) the assembler reserves a block
of memory. The reserved block of memory is not initialized to any value.
If you specify label, it gets the value of the location counter at the start of
the directive processing.
Example
To reserve 12 bytes (not initialized) of memory in a TriCore data section:
.sdecl ".zbss.tst.uninit",DATA
.sect ".zbss.tst.uninit"
uninit .SPACE 12 ; Sample buffer
Related information
.ASCII / .ASCIIZ (Define ASCII string without/with ending NULL)
.BYTE (Define a constant byte)
.FLOAT / .DOUBLE (Define a 32-bit / 64-bit floating-point constant)
.WORD / .HALF (Define a word / halfword)
• • • • • • • •
3-58 TriCore Reference Manual
.TYPE
Syntax
symbol .TYPE typeid
Description
With the .TYPE directive you set a symbol's type to the specified value in
the ELF symbol table. Valid symbol types are:
Labels in code sections have the default type FUNC. Labels in data sections
ASSEMBLY LANGUAGE
Example
Afunc .TYPE FUNC
Related information
.SIZE (Set Symbol Size)
TriCore Assembly Language 3-59
.UNDEF
Syntax
.UNDEF symbol
Description
With the .UNDEF directive you can undefine a substitution string that was
previously defined with the .DEFINE directive. The substitution string
associated with symbol is released, and symbol will no longer represent a
valid .DEFINE substitution.
Example
.UNDEF LEN ; Undefines the LEN substitution string
; that was previously defined with the
; .DEFINE directive
Related information
.DEFINE (Define Substitution String)
• • • • • • • •
3-60 TriCore Reference Manual
.WARNING
Syntax
.WARNING [{string | exp}[,{string | exp}]...]
Description
With the .WARNING directive (Programmer Generated Warning) you tell
the assembler to output a warning message during the assembling process.
The total warning count will be incremented as with any other warning.
The .WARNING directive is for example useful in combination with
conditional assembly for exceptional condition checking. The assembly
process proceeds normally after the warning has been printed.
This directive has no effect on the exit code of the assembler, unless you
use the assembler option --warnings-as-errors. In that case the
assembler exits with exit code 1 (an error).
Example
.WARNING 'parameter too large'
Related information
.FAIL (Programmer Generated Error),
.MESSAGE (Programmer Generated Message)
TriCore Assembly Language 3-61
.WEAK
Syntax
.WEAK symbol[,symbol]...
Description
With the .WEAK directive you mark one of more symbols as 'weak'. The
symbol can be defined in the same module with the .GLOBAL directive or
the .EXTERN directive. If the symbol does not already exist, it will be
created.
Only program labels and symbols defined with EQU can be made weak.
Example
LOOPA .EQU 1 ; definition of symbol LOOPA
.GLOBAL LOOPA ; LOOPA will be globally
; accessible by other modules
.WEAK LOOPA ; mark LOOPA as weak
Related information
-
• • • • • • • •
3-62 TriCore Reference Manual
.WORD/.HALF
Syntax
[label] .WORD argument[,argument]...
Description
With the .WORD or .HALF directive the assembler allocates and initializes
one word (32 bits) or a halfword (16 bits) of memory for each argument.
If you specify label, it gets the value of the location counter at the start of
the directive processing.
Examples
WRD: .WORD 14,1635,0x34266243,'ABCD'
With the .BYTE directive you can obain exactly the same effect:
WRD: .BYTE 14,0,0,0,1635%256,6,0,0,
0x43,0x62,0x26,0x34,'D','C','B','A'
Related information
.SPACE (Define storage)
• • • • • • • •
3-64 TriCore Reference Manual
Function Description
$LIST ON / OFF Generation of assembly list file temporary ON/OFF
$LIST "flags" Exclude / include lines in assembly list file
$PAGE Generate formfeed in assembly list file
$PAGE settings Define page layout for assemly list file
$PRCTL Send control string to printer
$STITLE Set program subtitle in header of assembly list file
$TITLE Set program title in headerof assembly list file
Function Description
$CASE ON / OFF Case sensitive user names ON/OFF
$DEBUG ON / OFF Generation of symbolic debug ON/OFF
$DEBUG "flags" Select debug information
$FPU Allow single precision floating-point instructions
$HW_ONLY Prevent substitution of assembly instructions by
smaller or faster instructions
$IDENT LOCAL / Assembler treats labels by default as local or global
GLOBAL
$MMU Allow memory management instructions
$OBJECT Alternative name for the generated object file
$TCdefect ON / OFF Enable/disable assembler check for specified
functional problem
$TC2 Allow TriCore 2 instructions
$WARNING OFF [num] Suppress all or some warnings
TriCore Assembly Language 3-65
• • • • • • • •
3-66 TriCore Reference Manual
$CASE ON / OFF
Syntax
$CASE ON (default)
$CASE OFF
Description
With the $CASE ON and $CASE OFF controls you specify whether the
assembler operates in case sensitive mode or not. By default the assembler
operates in case sensitive mode. This means that all user-defined symbols
and labels are treated case sensitive, so LAB and Lab are distinct. Note that
instruction mnemonics, register names, directives and controls are always
treated case insensitive.
Example
;begin of source
$CASE OFF ; assembler in case insensitive mode
ASSEMBLY LANGUAGE
Related option
Assembler option -c (Switch to case insensitive mode) in section 5.2,
Assembler Options, of Chapter Tool Options.
Related information
-
TriCore Assembly Language 3-67
$DEBUG ON / OFF
Syntax
$DEBUG ON
$DEBUG OFF
$DEBUG "flags"
Description
With the $DEBUG ON and $DEBUG OFF controls you turn the generation
of debug infomation on or off. ($DEBUG ON is similar to the assembler
option -gl).
If you use $DEBUG control with flags, you can set the following flags:
You cannot use these two types of debug information both. So,
$DEBUG "ah" is not allowed.
Example
;begin of source
$DEBUG ON ; generate local symbols debug information
Related option
Assembler option -g (Select debug information) in section 5.2, Assembler
Options, of Chapter Tool Options.
Related information
-
• • • • • • • •
3-68 TriCore Reference Manual
$FPU
Syntax
$FPU
Description
With the $FPU control you instruct the assembler to accept and encode
single precision floating-point instructions in the assembly source file.
When you use this control, the define __FPU__ is set to 1. By default the
define __FPU__ is set to 0 which tells the assembler not to accept single
precision floating-point instructions.
Example
;begin of source
$FPU ; the use of single precision FPU instructions
; in this source is allowed.
ASSEMBLY LANGUAGE
Related option
Assembler option --fpu-present (Allow the use of single precision
floating-point instructions) in section 5.2, Assembler Options, of Chapter
Tool Options.
Related information
-
TriCore Assembly Language 3-69
$HW_ONLY
Syntax
$HW_ONLY
Description
Normally the assembler replaces instructions by other, smaller or faster
instructions. For example, the instruction jeq d0,#0,label1 is replaced
by jz d0,label1.
With the $HW_ONLY control you instruct the assembler to encode all
instruction as they are. The assembler does not substitute instructions with
other, faster or smaller instructions.
Example
;begin of source
$HW_ONLY ; the assembler does not substitute
; instructions with other, smaller or
; faster instructions.
Related option
Assembler option -Og (Allow generic instructions) in section 5.2,
Assembler Options, of Chapter Tool Options.
Related information
-
• • • • • • • •
3-70 TriCore Reference Manual
$IDENT
Syntax
$IDENT LOCAL
$IDENT GLOBAL
Description
With the controls $IDENT LOCAL and $IDENT GLOBAL you tell the
assembler how to treat symbols that you have not specified explicitly as
local or global with the assembler directives .LOCAL or .GLOBAL.
By default the assembler treats all symbols as local symbols unless you
have defined them explicitly as global.
Example
;begin of source
$IDENT GLOBAL ; assembly labels are global by default
ASSEMBLY LANGUAGE
Related option
Assembler option -i (Treat labels by default local / global) in section 5.2,
Assembler Options, of Chapter Tool Options.
Related information
Assembler directive .LOCAL (Local symbol declaration)
Assembler directive .GLOBAL (Global symbol declaration)
TriCore Assembly Language 3-71
$LIST ON / OFF
Syntax
$LIST ON
.
. ; assembly source lines
.
$LIST OFF
Description
If you generate a list file with the assembler option -l, you can use the
$LIST ON and $LIST OFF controls to specify which source lines the
assembler must write to the list file. Without the command line option -l,
the $LIST ON and $LIST OFF controls have no effect.
The listing still would not be disabled until another $LIST OFF control
was issued.
Example
Suppose you assemble the following assembly source with the assembler
option -l:
.SDECL ".text",CODE
.SECT ".text"
... ; source line in list file
$LIST OFF
... ; source line not in list file
$LIST ON
... ; source line also in list file
.END
• • • • • • • •
3-72 TriCore Reference Manual
Related option
Assembler option -l (Generate list file) in section 5.2, Assembler Options,
of Chapter Tool Options.
Related information
Assembler control $LIST (Exclude / include lines in assembly list file)
$LIST flags
Syntax
Begin of assembly file
$LIST "flags"
Description
If you generate a list file with the assembler option -l, you can use the
$LIST controls to specify which type of source lines the assembler must
exclude from the list file. Without the command line option -l, the $LIST
control has no effect.
If you do not specify this control or the assembler option -Lflag, the
assembler uses the default: -LcDEGilMnPqrVWXy.
Example
To exclude assembly files with controls from the list file:
;begin of source
$LIST "c"
• • • • • • • •
3-74 TriCore Reference Manual
Related option
Assembler option -L (List file formatting options) in section 5.2, Assembler
Options, of Chapter Tool Options.
Related information
Assembler control $LIST ON / OFF (Assembly list file ON / OFF)
$MMU
Syntax
$MMU
Description
With the $MMU control you instruct the assembler to accept and encode
memory management instructions in the assembly source file.
Example
;begin of source
$MMU ; the use of memory management instructions
; in this source is allowed.
Related option
Assembler option --mmu-present (Allow the use of memory
management instructions) in section 5.2, Assembler Options, of Chapter
Tool Options.
Related information
-
• • • • • • • •
3-76 TriCore Reference Manual
$OBJECT
Syntax
$OBJECT "file"
$OBJECT OFF
Description
With the $OBJECT control you can specify an alternative name for the
generated object file. With the $OBJECT OFF control, the assembler does
not generate an object file at all.
Example
;Begin of source
$object "x1.o" ; generate object file x1.o
Related option
Assembler option -o (Define output filename) in section 5.2, Assembler
ASSEMBLY LANGUAGE
Related information
-
TriCore Assembly Language 3-77
$PAGE
Syntax
$PAGE [width,length,blanktop,blankbtm,blankleft]
Description
If you generate a list file with the assembler option -l, you can use the
$PAGE control to format the generated list file.
If you use the $PAGE control without arguments, it causes a 'formfeed': the
next source line is printed on the next page in the list file. The $PAGE
control itself is not printed.
Example
$PAGE ; formfeed, the next source line is printed
; on the next page in the list file.
Related option
-
• • • • • • • •
3-78 TriCore Reference Manual
Related information
Assembler control $STITLE (Set program subtitle in header of list file)
Assembler control $TITLE (Set program title in header of list file)
$PRCTL
Syntax
$PRCTL exp|string[,exp|string]...
Description
If you generate a list file with the assembler option -l, you can use the
$PRCTL control to send control strings to the printer.
The $PRCTL control simply concatenates its arguments and sends them to
the listing file (the control line itself is not printed unless there is an error).
The $PRCTL control can appear anywhere in the source file; the assembler
sends out the control string at the corresponding place in the listing file.
If a $PRCTL control is the last line in the last input file to be processed,
the assembler insures that all error summaries, symbol tables, and
cross-references have been printed before sending out the control string.
In this manner, you can use a PRCTL control to restore a printer to a
previous mode after printing is done.
Similarly, if the $PRCTL control appears as the first line in the first input
file, the assembler sends out the control string before page headings or
titles.
Example
$PRCTL $1B,'E' ; Reset HP LaserJet printer
Related option
-
Related information
Assembler option -l (Generate list file) in Section 5.2, Assembler Options,
of Chapter Tool Options.
• • • • • • • •
3-80 TriCore Reference Manual
$STITLE
Syntax
$STITLE "title"
Description
If you generate a list file with the assembler option -l, you can use the
$STITLE control to specify the program subtitle which is printed at the
top of all succeeding pages in the assembler list file below the title.
The specified subtitle is valid until the assembler encouters a new STITLE
control. By default, the subtitle is empty.
The $STITLE control itself will not be printed in the source listing.
If the page width is too small for the title to fit in the header, it will be
truncated.
Example
ASSEMBLY LANGUAGE
The header of the second page in the list file will now be:
TASKING TriCore Assembler vx.yrz Build nnn SN 00000000
This is the title Page 2
This is the subtitle
Related option
-
Related information
Assembler control $TITLE (Set program title in header of list file)
$TC
Syntax
$TCdefect ON
$TCdefect OFF
Description
With this control you can enable or disable specific CPU functional
problem checks.
To enable the assembler checks for all TriCore CPU TC112 problems
(respectively TC113 problems) at once, use the control $TC112_DEFECTS
(respectively $TC113_DEFECTS ).
Example
$TC112_COR1 ON ; enable assembler check for CPU
functional problem TC112_COR1
Related option
Assembler option --silicon-bug (Check on CPU functional defect) in
section 5.2, Assembler Options, of Chapter Tool Options.
Related information
See Chapter 9, CPU Functional Problems, for more information about the
individual problems.
• • • • • • • •
3-82 TriCore Reference Manual
$TC2
Syntax
$TC2
Description
With the $TC2 control you instruct the assembler to accept and encode
TriCore 2 instructions in the assembly source file.
Example
;begin of source
$TC2 ; the use of TriCore 2 instructions
; in this source is allowed.
Related option
Assembler option --is-tricore2 (Allow the use of TriCore 2 instructions)
ASSEMBLY LANGUAGE
Related information
-
TriCore Assembly Language 3-83
$TITLE
Syntax
$TITLE "title"
Description
If you generate a list file with the assembler option -l, you can use the
$TITLE control to specify the program title which is printed at the top of
each page in the assembler list file.
If the page width is too small for the title to fit in the header, it will be
truncated.
Example
$TITLE 'This is the title'
Related option
-
Related information
STITLE (Set program subtitle in header of assembly list file)
• • • • • • • •
3-84 TriCore Reference Manual
$WARNING OFF
Syntax
$WARNING OFF
$WARNING OFF number
Description
With the $WARNING OFF control you can suppresses all warning
messages or specific warning messages.
• By default, all warnings are reported.
• If you specify this option but without numbers, all warnings are
suppressed.
• If you specify this option with a number, only the specified warning is
suppressed.
Example
$WARNING OFF ; all warning messages are suppressed
ASSEMBLY LANGUAGE
Related option
Assembler option -w (Suppress some or all warnings) in section 5.2,
Assembler Options, of Chapter Tool Options.
Related information
-
CHAPTER
RUN-TIME
ENVIRONMENT
4
4-2 TriCore Reference Manual
CHAPTER
4
RUN-TIME
Run-time Environment 4-3
4.1 INTRODUCTION
This chapter describes the startup code used by the TASKING TriCore C
compiler, the stack layout and the heap; and the floating-point arithmetic.
If the default run-time startup code does not match your configuration,
you need to modify the startup code accordingly.
See also section 7.6, Linking the C Startup Code in Chapter Using the Linker
of the User's Manual.
The entry point of the startup code (power-on vector) is label _START.
This global label should not be removed, since the C compiler refers to it.
It is also used as the default start address of the application.
Initialization code
The following initialization actions are executed before the application
starts:
1. Re-enable and reset the call depth counter and make A0, A1, A8, A9
write-able. It is required for CrossView Pro that these RESET values are
restored for each time the startup code is executed.
2. Initialize the user stack pointer. The user stack pointer is loaded into
memory by the stack address, located at _lc_ue_ustack . This label is
defined in the Linker Script File. See section 4.3, Stack Usage for
detailed information on the stack.
• • • • • • • •
4-4 TriCore Reference Manual
4. Setup the context save area lists. Tables with start/end addresses go in
a separate 'csa_areas' section.
10. Copy initialized sections from ROM to RAM, using a linker generated
table (also known as the 'copy table') and a run-time library function
_c_init.
12. Call the entry point of your application with a call to function main().
Exit code
RUN-TIME
See also section 3.9.2, Interrupt and Trap Functions in Chapter TriCore C
Language of the User's Manual.
Now you can specify all your startup settings in the pages Startup Code,
Boot Memory and Memory Control.
• • • • • • • •
4-6 TriCore Reference Manual
-Didentifier[=replacement]).
Define Description
External Boot Memory Configuration (BOOTCFG)
_BOOTCFG_VALUE Boot memory Offset Address + 0x4
Memory Control (PMUCON/DMUCON)
_PMU_CON_VALUE If defined, value of PMU Control register
_PMU_EIFCON_VALUE If defined, value of PMU External Instruction
Fetch Control register
_DMU_CON_DCAON If defined, Enable data cache
Startup
_NO_BTV_INIT If defined, Base Address of Trap Vector Table is
not initialized with trap table start address
(trap_tab).
_NO_BIV_INIT If defined, Base Address of Interrupt Vector
Table is not initialized with interrupt table start
address (_lc_u_int_tab).
_NO_ISP_INIT If defined, Interrupt Stack Pointer is not initialized
with end address of interrupt stack
RUN-TIME
(_lc_ue_istack).
_NO_USP_INIT If defined, User Stack Pointer is not initialized
with end address of user stack (_lc_ue_istack).
_NO_PCX_RESET If defined, the Previous Context is not explicitly
cleared.
_NO_PSW_RESET If defined, the Call Depth Counter is not explicitly
cleared.
Run-time Environment 4-7
Define Description
_NO_A0A1_ADDRESSING If defined, global address register A0/A1 is not
initialized with start address of the _a0/_a1
addressable area (_lc_gb_a0/1).
_NO_A8A9_ADDRESSING If defined, global address register A8/A9 is not
initialized with start address of the _a8/_a9
addressable area (_lc_gb_a8/9).
_NO_CSA_INIT If defined, Context Save Area lists are not
initialized.
_NO_WATCHDOG_INIT If defined, Watchdog timer disabled.
_NO_BUS_CONF If defined, bus configuration registers are not
initialized.
_NO_C_INIT If defined, C variables are not initialized.
_NO_ARG_INIT If defined, disable initialization of argc and argv[].
_NO_EXIT If defined, C library function exit() or abort() not
supported.
_USERDEFINED_TRAP_n If defined, the default trap vector n is disabled.
Miscellaneous
_CALL_INIT Can be set to a function to be called before
main. This function cannot have a return or
arguments. This function can be used, for
example, to initialize the serial port before main
is called. This is useful for building programs
without making any modifications to the original
source.
_CALL_ENDINIT Can be set to a function to be called before the
ENDINIT instruction is executed. Like the
CALLINIT function, it cannot not have a return
value or arguments.
CPU functional bypasses
_TC112_XXX If defined, TC112 CPU functional defect XXX is
bypassed and/or checked.
_TC113_XXX If defined, TC113 CPU functional defect XXX is
bypassed and/or checked. See Chapter 9 CPU
Functional Problems for a complete list of these
macros.
• • • • • • • •
4-8 TriCore Reference Manual
The following table shows the linker labels used in the startup code.
Define Description
_START start label, mentioned in LSL file (tc_arch.lsl)
_c_init label copy table init function
main start label user C program
exit start label of exit() function
_exit exit() function jumps to this place
_CALL_ENDINIT label called before ENDINIT
_CALL_INIT _CALL_INIT label called before main()
_lc_gb_a0 linker label start of A0 addressable area
_lc_gb_a1 linker label start of A1 addressable area
_lc_gb_a8 linker label start of A8 addressable area
_lc_gb_a9 linker label start of A9 addressable area
_lc_u_int_tab linker label interrupt table
_lc_ub_csa linker label context save area begin
_lc_ue_csa linker label context save area end
_lc_ue_istack linker label interrupt stack end
_lc_ue_ustack linker label user stack end
high memory
incoming
stack
ÉÉÉÉÉÉ
parameters
ÉÉÉÉÉÉ
sp
grows down
on entry
local variables
framesize
outgoing
parameters
sp
low memory
($sp)
during execution
The linker defined label _lc_ue_ustack refers to the top of the user
stack area and is used in the file cstart.asm to initialize the user stack
pointer register (SP). The linker defined label _lc_ue_istack refers to
the top of the interrupt stack area and is used in the file cstart.asm to
initialize the interrupt stack pointer register (ISP)
As long as the user program does not change the IS bit in the program
status word (PSW), only the user stack is used. Refer to the TriCore
Architecture (v1.3) Manual for the implications of an IS bit change.
• • • • • • • •
4-10 TriCore Reference Manual
A special section called heap is used for the allocation of the heap area.
The size of the heap is defined in the linker script file (tc_arch.lsl in
directory include.lsl) with the macro HEAP, which results in a section
called heap. The linker defined labels _lc_bh and _lc_eh (begin and
end of heap) are used by the library function sbrk(), which is called by
malloc() when memory is needed from the heap.
The special heap section is only allocated when its linker labels are used
in the program.
The compiler ctc supports both single and double precision floating-point
operations using the ISO C types float and double respectively. To
optimize for speed, also a non-trapping library is included.
• • • • • • • •
4-12 TriCore Reference Manual
Both EDE and the control program cctc automatically select the
appropriate libraries depending on the specified TriCore derivative. By
specifying the --fp-trap option to the control program cctc, the trapping
type floating-point library is linked into your application. By specifying
the --fpu-present option to the control program cctc, a floating-point
library with single precision FPU instructions is linked into your
application. If these options are not specified, the floating-point library
without trapping mechanism and without FPU instructions is used.
• • • • • • • •
4-14 TriCore Reference Manual
In EDE you can specify to use the trapping type floating-point library as
follows:
Example:
#include <float.h>
#include <signal.h>
raise( SIGFPE );
/*
* now continue the program
* with the unaltered result
*/
}
A pair of functions to get or set the mask which controls which type of
floating-point arithmetic exceptions are either ignored or passed on to the
trap handler. The types of possible exception flag bits are defined as:
EFINVOP
EFDIVZ
EFOVFL
EFUNFL
EFINEXCT
while,
EFALL
is the OR of all possible flags. See below for an explanation of each flag.
• • • • • • • •
4-16 TriCore Reference Manual
#include <float.h>
exception
operation
_OP_LARGER_THAN
_OP_MULTIPLICATION
_OP_DIVISION
_OP_CONVERSION
source_format
destination_format
Run-time Environment 4-17
These three are of the following type, to receive and return a value
of arbitrary type:
typedef union _fp_value_union_t
{
char c;
unsigned char uc;
short s;
unsigned short us;
int i;
unsigned int ui;
long l;
unsigned long ul;
float f;
#if ! _SINGLE_FP
double d;
#endif
}
_fp_value_union_t;
The member d is not present when specifying the -F option (treat double
as float) to the C compiler.
• • • • • • • •
4-18 TriCore Reference Manual
The following table lists all the exception code flags, the corresponding
error description and result:
To ensure all exception types are specified, you can specify EFALL to a
function, which is the binary OR of all above enlisted flags.
RUN-TIME
CHAPTER
TOOL OPTIONS
5
5-2 TriCore Reference Manual
CHAPTER
5
TOOL OPTIONS
Tool Options - Compiler 5-3
Be aware that some command line options are not useful in EDE or just
do not have any effect. For example, the option -n sends output to stdout
instead of a file and has no effect in EDE.
When you do not specify an option, a default value may become active.
• • • • • • • •
5-4 TriCore Reference Manual
-? (--help)
EDE
-
--help[=item]
Description
Displays an overview of all command line options. When you specify an
argument you can list extended information such as a list of intrinsic
functions, pragmas or option descriptions.
Example
The following invocations all display a list of the available command line
options:
ctc -?
ctc --help
TOOL OPTIONS
ctc
Related information
-
Tool Options - Compiler 5-5
-A (--language)
EDE
1. From the Project menu, select Project Options...
3. Enable or disable the options Allow C++ style comments in ISO C90
mode and Allow relaxed const check for string literals.
--language=[flags]
Default
-Apx
Description
With this option you control the language extensions the compiler can
accept. Default the TriCore C compiler allows all language extensions.
With -Ap you tell the compiler to allow C++ style comments (//) in ISO
C90 mode (option -c90). In ISO C99 mode this style of comments is
always accepted.
With -Ax you tell the compiler not to check for assignments of a constant
string to a non-constant string pointer. With this option the following
example does not produces a warning:
char *p;
void main( void ) { p = "hello"; }
• • • • • • • •
5-6 TriCore Reference Manual
Example
ctc -APx -c90 test.c
ctc --language=-comments,+strings --iso=90 test.c
Related information
Compiler option -c (ISO C standard)
TOOL OPTIONS
Tool Options - Compiler 5-7
--align
EDE
1. From the Project menu, select Project Options...
Default
--align=1
Description
By default the TriCore compiler aligns objects to the minimum alignment
required by the architecture. With this option you can increase this
alignment for objects of four bytes or larger. The value must be a power of
two.
Example
To align all objects of four bytes or larger on a 4-byte boundary, enter:
ctc --align=4 test.c
Instead of this option you can also specify the following pragma in your C
source:
#pragma align 4
With #pragma align restore you can return to the previous alignment
setting.
Related information
Section 3.7, Controlling the Compiler: Pragmas, in Chapter TriCore C
Language of the TriCore User's Manual.
• • • • • • • •
5-8 TriCore Reference Manual
-C (--cpu)
EDE
1. From the Project menu, select Project Options...
--cpu=cpu
Description
With this option you define the target processor for which you create your
application. Default the control program generates an object file for the
TC11IB.
The compiler always includes the register file regcpu.sfr, unless you
disable the option Automatic inclusion of '.sfr' file on the Preprocessing
TOOL OPTIONS
Example
To compile the file test.c for the TC11IB processor and use the SFR file
regtc11ib.sfr :
To avoid conflicts, make sure you specify the same target processor to the
assembler.
Tool Options - Compiler 5-9
Related information
Compiler option --no-tasking-sfr (Do not include SFR file)
Section 5.4, Calling the Compiler, in Chapter Using the Compiler of the
User's Manual.
• • • • • • • •
5-10 TriCore Reference Manual
-c (--iso)
EDE
1. From the Project menu, select Project Options...
--iso={90|99}
Default
-c99
Description
With this option you select the ISO C standard. C90 is also referred to as
the "ANSI C standard". C99 refers to the newer ISO/IEC 9899:1999 (E)
standard. C99 is the default.
Example
To select the ISO C90 standard on the command line:
TOOL OPTIONS
Related information
Compiler option -A (Language extensions)
Tool Options - Compiler 5-11
--check
EDE
1. In the project window, select the file you want to check.
Description
With this option you can check the source code for syntax errors, without
generating code. This saves time in developing your application.
Example
To check for syntax errors, without generating code:
ctc --check test.c
Related information
Assembler option --check (Check syntax)
• • • • • • • •
5-12 TriCore Reference Manual
--cse-all-addresses
EDE
1. From the Project menu, select Project Options...
Description
With this option you tell the compiler to make all addresses available for
common subexpression evaluation.
Normally the compiler ignores __near and __ax addresses for common
subexpressions. However, depending on the use of address registers and
whether stack and/or addressed memory are internal or external, it might
be wise to consider them for CSE.
Example
ctc --cse-all-addresses -Oc test.c
evaluation.
Related information
Compiler option -Oc (Common subexpression elimination)
Tool Options - Compiler 5-13
-D (--define)
EDE
1. From the Project menu, select Project Options...
--define=macro_name[=macro_definition]
Description
With this option you can define a macro and specify it to the preprocessor.
If you only specify a macro name (no macro definition), the macro
expands as '1'.
You can specify as many macros as you like. In EDE, use commas to
separate multiple macro definitions. On the command line, use the
option -D multiple times. If the command line exceeds the limit of the
operating system, you can define the macros in an option file which you
then must specify to the compiler with the option -f file.
Defining macros with this option (instead of in the C source) is, for
example, useful to compile conditional C source as shown in the example
below.
• • • • • • • •
5-14 TriCore Reference Manual
Example
Consider the following C program with conditional code to compile a
demo program and a real program:
void main( void )
{
#if DEMO
demo_func(); /* compile for the demo program */
#else
real_func(); /* compile for the real program */
#endif
}
You can now use a macro definition to set the DEMO flag:
ctc -DDEMO test.c
ctc -DDEMO=1 test.c
The next example shows how to define a macro with arguments. Note that
the macro name and definition are placed between double quotes because
otherwise the spaces would indicate a new option.
ctc -D"MAX(A,B)=((A) > (B) ? (A) : (B))"
Related information
TOOL OPTIONS
--diag
EDE
1. In the Help menu, enable the option Show Help on Tool Errors.
Optionally, you can use one of the following display formats (format):
Description
With this option the compiler displays a description and explanation of the
specified error message(s) on stdout (usually the screen). The compiler
does not compile any files.
To create a file with the descriptions, you must redirect the output.
With the suboption all, the descriptions of all error messages are given. If
you want the description of one or more selected error messages, you can
specify the error message numbers, separated by commas.
With this option the compiler does not compile any files.
Example
To display an explanation of message number 282, enter:
ctc --diag=282
• • • • • • • •
5-16 TriCore Reference Manual
Related information
Section 5.8, C Compiler Error Messages, in Chapter Using the Compiler of
the User's Manual.
TOOL OPTIONS
Tool Options - Compiler 5-17
-E (--preprocess)
EDE
1. From the Project menu, select Project Options...
--preprocess[=flags]
You can set the following flags (when you specify -E without flags, the
default is -ECMP):
Description
With this option you tell the compiler to preprocess the C source. EDE
stores the preprocess output in the file name.pre (where name is the
name of the C source file to compile). EDE also compiles the C source.
On the command line, the compiler sends the preprocessed file to stdout.
To capture the information in a file, specify an output file with the
option -o.
With -Ec you tell the preprocessor to keep the comments from the C
source file in the preprocessed output.
With -Em the compiler will generate dependency lines that can be used
in a Makefile. The preprocessor output is discarded.
With -Ep you tell the preprocessor to strip the #line source position
information (lines starting with #line). These lines are normally
processed by the assembler and not needed in the preprocessed output.
When you leave these lines out, the output is easier to read.
• • • • • • • •
5-18 TriCore Reference Manual
Example
ctc -EcMP test.c -o test.pre
The compiler preprocesses the file test.c and sends the output to the
file test.pre. Comments are included but no dependencies are
generated and the line source position information is not stripped from the
output file.
Related information
-
TOOL OPTIONS
Tool Options - Compiler 5-19
--error-file
EDE
-
Description
With this option the compiler redirects error messages to a file.
If you do not specify a filename, the error file will be named after the
input file with extension .err.
Example
To write errors to errors.err instead of stderr, enter:
ctc --error-file=errors.err test.c
Related information
Compiler option --warnings-as-errors (Treat warnings as errors)
• • • • • • • •
5-20 TriCore Reference Manual
-F (--no-double)
EDE
1. From the Project menu, select Project Options...
--no-double
Description
With this option you tell the compiler to treat variables of the type double
as float. Because the float type takes less space, execution speed
increases and code size decreases, both at the cost of less precision.
Example
ctc -F test.c
The file test.c is compiled where variables of the type double are
treated as float.
TOOL OPTIONS
Related information
-
Tool Options - Compiler 5-21
-f (--option-file)
EDE
1. From the Project menu, select Project Options...
In EDE you can save your options in a file and restore them to call the
compiler with those options:
• From the Project menu, select Save Options... or Load Options...
Be aware that when you specify the option -f in the Additional options
field, the options are added to the compiler options you have set in the
Project Options dialog. Only in extraordinary cases you may want to use
them in combination.
--option-file=file,...
Description
Instead of typing all options on the command line, you can create an
option file which contains all options and files you want to specify. With
this option you specify the option file to the compiler.
Use an option file when the length of the command line would exceed the
limits of the operating system, or just to store options and save typing.
• • • • • • • •
5-22 TriCore Reference Manual
Example
Suppose the file myoptions contains the following lines:
-Ctc11ib
-s
test.c
TOOL OPTIONS
Related information
-
Tool Options - Compiler 5-23
--fpu-present
EDE
1. From the Project menu, select Project Options...
Description
With this option the compiler can generate single precision floating-point
instructions in the assembly file. When you select this option, the macro
__FPU__ is defined in the C source file.
Example
To allow the use of floating-point unit (FPU) instructions in the assembly
code, enter:
ctc --fpu-present test.c
Related information
Compiler option --is-tricore2 (Tricore2 instructions allowed)
• • • • • • • •
5-24 TriCore Reference Manual
-g (--debug-info)
EDE
1. From the Project menu, select Project Options...
--debug-info
Description
With this option you tell the compiler to add directives to the output file
for including symbolic information. This facilitates high level debugging
but increases code size. For the final application, compile your C files
without debug information.
When you specify a high optimization level, the debug comfort may
decrease. Therefore, the compiler issues warning W555 if the debug
comfort would be decreased as a result of the chosen optimizations.
Example
TOOL OPTIONS
Related information
-
Tool Options - Compiler 5-25
-H (--include-file)
EDE
1. From the Project menu, select Project Options...
3. Enter the name of the file in the Include this file before source field.
--include-file=file,...
Description
With this option you include one extra file at the beginning of each C
source file, before other includes. This is the same as specifying #include
"file" at the beginning of each of your C sources.
Example
ctc -Hstdio.h test1.c test2.c
Related information
Compiler option -I (Add directory to include file search path)
Section 5.5, How the Compiler Searches Include Files, in Chapter Using the
Compiler of the User's Manual.
• • • • • • • •
5-26 TriCore Reference Manual
-I (--include-directory)
EDE
1. From the Project menu, select Directories...
2. Enter one or more search paths in the Include Files Path field.
--include-directory=path,...
Description
With this option you can specify the path where your include files are
located. A relative path will be relative to the current directory.
The order in which the compiler searches for include files is:
1. The pathname in the C source file and the directory of the C source
(only for #include files that are enclosed in "")
Example
Suppose that the C source file test.c contains the following lines:
#include <stdio.h>
#include "myinc.h"
First the compiler looks for the file stdio.h in the directory myinclude
relative to the current directory. If it was not found, the compiler searches
in the environment variable and then in the default include directory.
Tool Options - Compiler 5-27
The compiler now looks for the file myinc.h in the directory where
test.c is located. If the file is not there the compiler searches in the
directory myinclude. If it was still not found, the compiler searches in the
environment variable and then in the default include directory.
Related information
Compiler option -H (Include file at the start of a compilation)
Section 5.5, How the Compiler Searches Include Files, in Chapter Using the
Compiler of the User's Manual.
• • • • • • • •
5-28 TriCore Reference Manual
--indirect
EDE
1. From the Project menu, select Project Options...
Description
With this option you tell the compiler to generate code for indirect
function calling.
Example
ctc --indirect test.c
Instead of this option you can also specify the following pragma in your C
source:
#pragma indirect
TOOL OPTIONS
Related information
Compiler option --indirect-runtime
--indirect-runtime
EDE
1. From the Project menu, select Project Options...
Description
With this option you tell the compiler to generate code for indirect calls to
run-time functions. Use this option if you locate the entire run-time library
in far memory.
Example
ctc --indirect-runtime test.c
Instead of this option you can also specify the following pragma in your C
source:
#pragma indirect_runtime
Related information
Compiler option --indirect
• • • • • • • •
5-30 TriCore Reference Manual
--inline
EDE
-
Description
With this option you instruct the compiler to inline all functions, regardless
whether they have the keyword inline or not. This option has the same
effect as a #pragma inline at the start of the source file.
This option can be useful to increase the possibilities for code compaction
(option -Or).
Example
To inline all functions:
ctc --inline test.c
Related information
Compiler option -Or (Optimization: code compaction)
TOOL OPTIONS
Tool Options - Compiler 5-31
--inline-max-incr /
--inline-max-size
EDE
-
--inline-max-size=threshold
Default
--inline-max-incr=25
--inline-max-size=10
Description
With these options you can control the function inlining optimization
process of the compiler. These options have only effect when you have
enabled the inlining optimization (option -Oi).
With the option --inline-max-size you can specify the maximum size of
functions that the compiler inlines as part of the optimization process. The
compiler always inlines all functions that are smaller than the specified
threshold. The threshold is measured in compiler internal units and the
compiler uses this measure to decide which functions are small enough to
inline. The default threshold is 10.
After the compiler has inlined all functions that have the function qualifier
inline and all functions that are smaller than the specified threshold, the
compiler looks whether it can inline more functions without increasing the
code size too much. With the option --inline-max-incr you can specify
how much the code size is allowed to increase. Default, this is 25% which
means that the compiler continues inlining functions until the resulting
code size is 25% larger than the original size.
• • • • • • • •
5-32 TriCore Reference Manual
Example
ctc --inline-max-incr=40 --inline-max-size=15 test.c
The compiler first inlines all functions with the function qualifier inline
and all functions that are smaller than the specified threshold of 15. If the
code size has still not increased with 40%, the compiler decides which
other functions it can inline.
Related information
Compiler option -O (Specify optimization level)
--integer-enumeration
EDE
1. From the Project menu, select Project Options...
Description
With this option you tell the compiler to use (32-bit) integers for
enumerations. Without this option, the treats small enumerated types as a
smaller integer, a char or even a __bit type to reduce code size.
Example
To treat enumerated types always as 32-bit integer, enter:
ctc --integer-enumeration test.c
Related information
-
• • • • • • • •
5-34 TriCore Reference Manual
--is-tricore2
EDE
1. From the Project menu, select Project Options...
Description
With this option the compiler can generate TriCore 2 instructions in the
assembly file. When you select this option, the macro __TC2__ is defined
in the C source file.
Example
To allow the use of TriCore 2 instructions in the assembly code, enter:
TOOL OPTIONS
Related information
Compiler option --fpu-present (Use hardware floating-point
instructions)
Assembler option --mmu-present (Allow use of MMU instructions)
-k (--keep-output-files)
EDE
EDE always removes the .src file when errors occur during compilation.
--keep-output-files
Description
If an error occurs during compilation, the resulting .src file may be
incomplete or incorrect. With this option you keep the generated output
file (.src) when an error occurs.
By default the compiler removes the generated output file (.src) when an
error occurs. This is useful when you use the make utility mktc. If the
erroneous files are not removed, the make utility may process corrupt files
on a subsequent invocation.
Use this option when you still want to inspect the generated assembly
source. Even if it is incomplete or incorrect.
Example
ctc -k test.c
Related information
Compiler option --warnings-as-errors (Treat warnings as errors)
• • • • • • • •
5-36 TriCore Reference Manual
--misrac
EDE
1. From the Project menu, select Project Options...
Description
With this option you specify to the compiler which MISRA C rules must be
checked. With the option --misrac=all the compiler checks for all
supported MISRA C rules.
Example
ctc --misrac=9-13 test.c
The compiler generates an error for each MISRA C rule 9, 10, 11, 12 or 13
violation in file test.c.
TOOL OPTIONS
Related information
See Chapter 10 MISRA C Rules for a list of all supported MISRA C rules.
-N (--default-near-size)
EDE
1. From the Project menu, select Project Options...
--default-near-size[=threshold]
Default
-N8
Description
With this option you can specify a threshold value for __near allocation.
If you do not specify __near or __far in the declaration of an object, the
compiler chooses where to place the object. The compiler allocates objects
smaller or equal to the threshold in __near sections. Larger objects are
allocated in __a0, __a1 or __far sections.
Example
ctc -N12 test.c
• • • • • • • •
5-38 TriCore Reference Manual
Related information
Compiler option -Y (maximum size in bytes for data elements that are
default located in __a1 sections)
Compiler option -Z (maximum size in bytes for data elements that are
default located in __a0 sections)
-n (--stdout)
EDE
-
--stdout
Description
With this option you tell the compiler to send the output to stdout (usually
your screen). No files are created.
Example
ctc -n test.c
The compiler sends the output (normally test.src) to stdout and does
not create the file test.src.
Related information
-
• • • • • • • •
5-40 TriCore Reference Manual
--no-tasking-sfr
EDE
1. From the Project menu, select Project Options...
Description
Normally, the compiler includes a special function register (SFR) file before
compiling. The compiler automatically selects the SFR file belonging to the
target you select on the Processor definition page of the Processor
options (compiler option -C).
With this option the compiler does not include the register file
regcpu.sfr as based on the selected target processor.
Use this option if you want to use your own set of SFR files.
Example
ctc -Ctc11ib --no-tasking-sfr test.c
TOOL OPTIONS
Related information
Compiler option -C (Use SFR definitions for CPU)
Tool Options - Compiler 5-41
-O (--optimize)
EDE
1. From the Project menu, select Project Options...
• • • • • • • •
5-42 TriCore Reference Manual
Default
-O2
Description
TOOL OPTIONS
With this option you can control the level of optimization. If you do not
use this option, the default optimization level is medium optimization
(option -O2 or -O or -OacefgIklMopsvwy).
When you use this option to specify a set of optimizations, you can
overrule these settings in your C source file with
#pragma optimize flag and #pragma endoptimize.
In addition to the option -O, you can specify the option -t. With this
option you specify whether the used optimizations should optimize for
more speed (regardless of code size) or for smaller code size (regardless of
speed).
Tool Options - Compiler 5-43
Example
The following invocations are equivalent and result all in the default
medium optimization set:
ctc test.c
ctc -O test.c
ctc --optimize test.c
Related information
Compiler option -t (Trade off between speed (-t0) and size (-t4))
#pragma optimize flag
#pragma endoptimize
• • • • • • • •
5-44 TriCore Reference Manual
-o (--output)
EDE
-
--output=file
Description
With this option you can specify another filename for the output file of the
compiler. Without this option the basename of the C source file is used
with extension .src.
EDE names the output file always after the C source file.
Example
ctc -o output.src test.c
ctc --output=output.src test.c
The compiler creates the file output.src for the compiled file test.c.
Without the option -o, like EDE, the compiler uses the names of the input
file and creates test.src.
Related information
TOOL OPTIONS
-
Tool Options - Compiler 5-45
--object-comment
EDE
-
Description
With this option the compiler generates a .comment section at the end of
the assembly file. The section contains the comment specified with this
option. After assembling, this text is included in the .o object and .elf
files. Place the comment between double quotes.
Example
ctc --object-comment="Created by TASKING" test.c
The compiler creates the file test.src with a .comment section at the
end of the file. After assembling this file, the text "Created by TASKING" is
incorporated in the generated object file.
Instead of this option you can also specify the following pragma in your C
source:
#pragma object_comment comment
Related information
-
• • • • • • • •
5-46 TriCore Reference Manual
-R (--rename-sections)
EDE
1. From the Project menu, select Project Options...
--rename-sections[=name]
Description
The compiler defaults to a section naming convention, using a prefix
indicating the section type, the module name and a symbol name:
section_type_pref.module_name.symbol_name
When you use -R without a value, the compiler uses the default section
naming.
Example
To generate the section name section_type_pref.NEW instead of the
default section name section_type_pref.module_name.symbol_name, enter:
ctc -RNEW test.c
ctc -R" " test.c (note the space between the quotes)
Tool Options - Compiler 5-47
Related information
Section 3.10, Compiler Generated Sections, in Chapter TriCore C Language
of the User's Manual.
• • • • • • • •
5-48 TriCore Reference Manual
-s (--source)
EDE
1. From the Project menu, select Project Options...
--source
Description
With this option you tell the compiler to merge C source code with
generated assembly code in the output file. The C source lines are
included as comments.
Example
ctc -s test.c
Related information
-
Tool Options - Compiler 5-49
--section-per-data-object
EDE
1. From the Project menu, select Project Options...
Description
Normally the compiler generates one section for each data type in a
module (such as .data, .rodata, .bss, .zdata, ...).
With this option you force the compiler to generate a separate section for
each data object. This provides more control about allocation during the
linking process.
Example
ctc --section-per-data-object test.c
For each data object in test.c the compiler generates a separate section.
Related information
-
• • • • • • • •
5-50 TriCore Reference Manual
--silicon-bug
EDE
1. From the Project menu, select Project Options...
Description
With this option you tell the compiler to use software workarounds for
some CPU functional problems.
Example
ctc --silicon-bug=cpu5,cpu9 test.c
The compiler uses workarounds for TC113 problems CPU5 and CPU9.
Related information
See Chapter 9, CPU Functional Problems, for more information about the
individual problems and workarounds.
#pragma CPU_functional_problem
#pragma TC112_functional_problem
#pragma TC113_functional_problem
• • • • • • • •
5-52 TriCore Reference Manual
--static
EDE
-
Description
With this option, the compiler treats external definitions at file scope
(except for main) as if they were declared static. As a result, unused
functions will be eliminated, and the alias checking algorithm assumes that
objects with static storage cannot be referenced from functions outside the
current module.
This option only makes sense when you specify all modules of an
application on the command line.
Example
ctc --static module1.c module2.c module3.c
Related information
-
TOOL OPTIONS
Tool Options - Compiler 5-53
--switch
EDE
1. From the Project menu, select Project Options...
Default
--switch=auto
Description
With this option you tell the compiler which code must be generated for a
switch statement: a jump chain (linear switch), a jump table or a lookup
table. By default, the compiler will automatically choose the most efficient
switch implementation based on code and data size and execution speed.
Example
ctc --switch=jumptab test.c
The compiler uses a table filled with target addresses for each possible
switch value.
Instead of this option you can also specify the following pragma in your C
source:
#pragma switch jumptab
• • • • • • • •
5-54 TriCore Reference Manual
Related information
See also section 3.11, Switch Statement, in Chapter TriCore C Language of
the User's Manual.
TOOL OPTIONS
Tool Options - Compiler 5-55
-t (--tradeoff)
EDE
1. From the Project menu, select Project Options...
--tradeoff={0|1|2|3|4}
Default
-t2
Description
If the compiler uses certain optimizations (option -O), you can use this
option to specify whether the used optizations should opimize for more
speed (regardless of code size) or for smaller code size (regardless of
speed).
Default the compiler balances speed and size while optimizing (-t0).
If you have not used the option -O, the compiler uses default medium
optimization, so you can still specify the option -t.
Example
To set the trade-off level for the used optimizations:
ctc -t4 test.c
ctc --tradeoff=4 test.c
The compiler uses the default medium optimization level and optimizes
for code size rather than for speed.
Related information
Compiler option -O (Specify optimization level)
• • • • • • • •
5-56 TriCore Reference Manual
-U (--undefine)
EDE
1. From the Project menu, select Project Options...
--undefine=macro_name
Description
With this option you can undefine an earlier defined macro as with
#undef. The TriCore compiler predefines the following macros:
#define __TASKING__ 1
#define __CTC__ compiler_version_nr
Example
To undefine the predefined macro __TASKING__:
ctc -U__TASKING__ test.c
ctc --undefine=__TASKING__ test.c
Tool Options - Compiler 5-57
Related information
Compiler option -D (Define macro)
Section 3.8, Predefined Macros, in Chapter Using the Compiler of the User's
Manual.
• • • • • • • •
5-58 TriCore Reference Manual
-u (--uchar)
EDE
1. From the Project menu, select Project Options...
--uchar
Description
Treat 'character' type variables as 'unsigned character' variables. By default
char is the same as specifying signed char. With -u char is the same
as unsigned char.
Example
With the following command char is treated as unsigned char:
ctc -u test.c
ctc --uchar test.c
TOOL OPTIONS
Related information
-
Tool Options - Compiler 5-59
-V (--version)
EDE
-
--version
Description
Display version information. The compiler ignores all other options or
input files.
Example
ctc -v
ctc --version
The compiler does not compile any files but displays the following version
information:
TASKING TriCore VX-toolset C compiler vxx.yrz Build 000
Copyright 2002-2004 Altium BV Serial# 00000000
Related information
-
• • • • • • • •
5-60 TriCore Reference Manual
-w (--no-warnings)
EDE
1. From the Project menu, select Project Options...
--no-warnings[=nr]
Description
With this option you can suppresses all warning messages or specific
warning messages.
• If you do not specify this option, all warnings are reported.
• If you specify this option but without numbers, all warnings are
TOOL OPTIONS
suppressed.
• If you specify this option with a number, only the specified warning is
suppressed. You can specify the option -w multiple times.
Example
To suppress all warnings:
ctc test.c -w
ctc test.c --no-warnings
Related information
Compiler option --warnings-as-errors (Treat warnings as errors)
• • • • • • • •
5-62 TriCore Reference Manual
--warnings-as-errors
EDE
1. From the Project menu, select Project Options...
Description
With this option you tell the compiler to treat warnings as errors.
Example
ctc --warnings-as-errors test.c
Related information
Compiler option -w (suppress some or all warnings)
TOOL OPTIONS
Tool Options - Compiler 5-63
-Y (--default-a1-size)
EDE
1. From the Project menu, select Project Options...
--default-a1-size[=threshold]
Default
-Y0
Description
With this option you can specify a threshold value for __a0 allocation. If
you do not specify a memory qualifier such as __near or __far in the
declaration of an object, the compiler chooses where to place the object
based on the size of the object.
First, the size of the object is checked against the -N threshold, according
to the description of the -N option. If the size is larger than the -N
threshold, but lower or equal to the -Y threshold, the object is allocated in
__a1 memory. Larger objects, arrays and strings will be allocated __far.
The default -Y threshold is zero, which means that the compiler will never
use __a1 memory unless you specify the -Y option. When you use the
-Y option without a threshold value, all objects not allocated __near,
including arrays and string constants, will be allocated in __a1 memory.
Instead of this option you can also use #pragma default_a1_size in the C
source.
• • • • • • • •
5-64 TriCore Reference Manual
Example
ctc -Y12 test.c
Related information
Compiler option -Z (max size (in bytes) for rodata elements located in
__a1 sections)
Compiler option -N (maximum size in bytes for data elements that are
default located in __near sections)
-Z (--default-a0-size)
EDE
1. From the Project menu, select Project Options...
--default-a0-size[=threshold]
Default
-Z0
Description
With this option you can specify a threshold value for __a0 allocation. If
you do not specify a memory qualifier such as __near or __far in the
declaration of an object, the compiler chooses where to place the object
based on the size of the object.
First, the size of the object is checked against the -N threshold, according
to the description of the -N option. If the size is larger than the -N
threshold, but lower or equal to the -Z threshold, the object is allocated in
__a0 memory. Larger objects, arrays and strings will be allocated __far.
The default -Z threshold is zero, which means that the compiler will never
use __a0 memory unless you specify the -Z option. When you use the -Z
option without a threshold value, all objects not allocated __near,
including arrays and string constants, will be allocated in __a0 memory.
Instead of this option you can also use #pragma default_a0_size in the C
source.
• • • • • • • •
5-66 TriCore Reference Manual
Example
ctc -Z12 test.c
Related information
Compiler option -Y (max size (in bytes) for data elements located in __a0
sections)
Compiler option -N (maximum size in bytes for data elements that are
default located in __near sections)
Be aware that some command line options are not useful in EDE or just
do not have any effect. For example, the option -V displays version
header information and has no effect in EDE.
When you do not specify an option, a default value may become active.
• • • • • • • •
5-68 TriCore Reference Manual
-? (--help)
EDE
-
--help[=options]
Description
Displays an overview of all command line options. When you specify the
options argument, a list with option descriptions is displayed.
Example
The following invocations all display a list of the available command line
options:
astc -?
astc --help
astc
Related information
TOOL OPTIONS
-
Tool Options - Assembler 5-69
-C (--cpu)
EDE
1. From the Project menu, select Project Options...
--cpu=cpu
Description
With this option you define the target processor for which you create your
application.
Example
In EDE, the target CPU has the following settings:
• Target processor: TC11IB
To define this on the command line:
astc -Ctc11ib test.src
astc --cpu=tc11ib test.src
• • • • • • • •
5-70 TriCore Reference Manual
To avoid conflicts, make sure you specify the same target processor as you
did for the compiler.
Related information
Assembler option --no-tasking-sfr (Do not include .def file)
Section 6.4, Calling the Assembler, in Chapter Using the Assembler of the
User's Manual.
TOOL OPTIONS
Tool Options - Assembler 5-71
-c (--case-insensitive)
EDE
1. From the Project menu, select Project Options...
--case-insensitive
Description
With this option you tell the assembler not to distinguish between upper
and lower case characters. By default the assembler considers upper and
lower case characters in labels and user-defined symbols as different
characters. Note that instruction mnemonics, register names, directives and
controls are always treated case insensitive.
Assembly source files that are generated by the compiler must always be
assembled case sensitive. When you are writing your own assembly code,
you may want to specify the case insensitive mode.
Example
To assemble case insensitive:
astc -c test.src
astc --case-insensitive test.src
The assembler considers upper and lower case characters as being the
same. So, for example, the label LabelName is the same label as
labelname.
Related information
Linker option --case-sensitive (Link case insensitive)
• • • • • • • •
5-72 TriCore Reference Manual
--check
EDE
1. In the project window, select the file you want to check.
Description
With this option you can check the source code for syntax errors, without
generating code. This saves time in developing your application.
Example
To check for syntax errors, without generating code:
astc --check test.src
Related information
Compiler option --check (Check syntax)
TOOL OPTIONS
Tool Options - Assembler 5-73
-D (--define)
EDE
1. From the Project menu, select Project Options...
--define=macro_name[=macro_definition]
Description
With this option you can define a macro and specify it to the assembler
preprocessor. If you only specify a macro name (no macro definition), the
macro expands as '1'.
You can specify as many macros as you like. In EDE, use commas to
separate multiple macro definitions. On the command line you can use the
option -D multiple times. If the command line exceeds the limit of the
operating system, you can define the macros in an option file which you
then must specify to the assembler with the option -ffile.
Defining macros with this option (instead of in the assembly source) is, for
example, useful in combination with conditional assembly as shown in the
example below.
This option has the same effect as defining symbols via the .SET, and
.EQU directives. (similar to #define in the C language). With the .MACRO
directive you can define more complex macros.
• • • • • • • •
5-74 TriCore Reference Manual
Example
Consider the following C program with conditional code to compile a
demo program and a real program:
.IF DEMO == 1
... ; instructions for demo application
.ELSE
... ; instructions for the real application
.ENDIF
You can now use a macro definition to set the DEMO flag:
astc -DDEMO test.src
astc -DDEMO=1 test.src
Related information
Assembler option -f (Specify an option file)
--diag
EDE
1. In the Help menu, enable the option Show Help on Tool Errors.
Optionally, you can use one of the following display formats (format):
Description
With this option you can ask for an extended description of error
messages in the format you choose. The output is directed to stdout
(normally your screen) and in the format you specify.
To create a file with the descriptions, you must redirect the output.
With the suboption all, the descriptions of all error messages are given. If
you want the description of one or more selected error messages, you can
specify the error message numbers, separated by commas.
With this option the assembler does not assemble any files.
Example
To display an explanation of message number 241, enter:
astc --diag=241
• • • • • • • •
5-76 TriCore Reference Manual
Related information
Section 6.7, Assembler Error Messages, in Chapter Using the Assembler of
the User's Manual.
TOOL OPTIONS
Tool Options - Assembler 5-77
--emit-locals
EDE
-
Description
With this option the assembler also emits local symbols to the object file's
symbol table. Normally, only global symbols are emitted.
Example
To emit local symbols, enter:
astc --emit-locals test.src
Related information
-
• • • • • • • •
5-78 TriCore Reference Manual
--error-file
EDE
-
Description
With this option the assembler redirects error messages to a file.
If you do not specify a filename, the error file will be named after the
input file with extension .ers.
Example
To write errors to errors.ers instead of stderr, enter:
astc --error-file=errors.ers test.src
Related information
Assembler option --warnings-as-errors (Treat warnings as errors)
TOOL OPTIONS
Tool Options - Assembler 5-79
-f (--option-file)
EDE
1. From the Project menu, select Project Options...
In EDE you can save your options in a file and restore them to call the
assembler with those options:
Be aware that when you specify the option -f in the Additional options
field, the options are added to the assembler options you have set in the
Project Options dialog. Only in extraordinary cases you may want to use
them in combination.
--option-file=file,...
Description
Instead of typing all options on the command line, you can create an
option file which contains all options and files you want to specify. With
this option you specify the option file to the assembler.
Use an option file when the length of the command line would exceed the
limits of the operating system, or just to store options and save typing.
• • • • • • • •
5-80 TriCore Reference Manual
Example
Suppose the file myoptions contains the following lines:
-Ctc11ib
test.src
TOOL OPTIONS
Related information
-
Tool Options - Assembler 5-81
--fpu-present
EDE
1. From the Project menu, select Project Options...
Description
With this option you can use single precision floating-point instructions in
the assembly code. When you select this option, the define __FPU__ is set
to 1. By default the define __FPU__ is set to 0.
Example
To allow the use of floating-point unit (FPU) instructions in the assembly
code, enter:
astc --fpu-present test.src
Related information
Assembler option -C (Select CPU)
• • • • • • • •
5-82 TriCore Reference Manual
-g (--debug-info)
EDE
1. From the Project menu, select Project Options...
You cannot use Assembly source line information and Pass HLL
debug information simultaneously.
--debug-info[=flag]
Default
-gs
TOOL OPTIONS
Description
With this option you tell the assembler to generate debug information. If
you do not use this option or if you specify -g without any flags, the
default is -gs.
You cannot specify -gah. Either the assembler generates assembly source
line information, or it passes HLL debug information.
When you specify -gs, the assembler selects which flags to use. If high
level language information is available in the source file, the assembler
passes this information (same as -gAhL). If not, the assembler generates
assembly source line information and local symbols debug information
(same as -gaHl).
Tool Options - Assembler 5-83
With -gAHLS the assembler does not generate any debug information.
Example
To disable symbolic debug information, turn all flags off:
astc -gAHLS test.src
astc --debug-info=-asm,-hll,-local,-smart test.src
Related information
-
• • • • • • • •
5-84 TriCore Reference Manual
-H (--include-file)
EDE
1. From the Project menu, select Project Options...
3. Enter the name of the file in the Include this file before source field.
--include-file=file,...
Description
With this option you include one extra file at the beginning of the
assembly source file, before other includes. This is the same as specifying
.INCLUDE 'file' at the beginning of your assembly sources.
Example
astc -Hmyinc.inc test1.src
astc --include-file=myinc.inc test1.src
Related information
Assembler option -I (Add directory to include file search path)
Section 6.5, How the Assembler Searches Include Files, in Chapter Using the
Assembler of the User's Manual.
Tool Options - Assembler 5-85
-I (--include-directory)
EDE
1. From the Project menu, select Directories...
2. Enter one or more search paths in the Include Files Path field.
--include-directory=path,...
Description
With this option you can specify the path where your include files are
located. A relative path will be relative to the current directory.
The order in which the assembler searches for include files is:
Example
Suppose that your assembly source file test.src contains the following
line:
.INCLUDE 'myinc.inc'
• • • • • • • •
5-86 TriCore Reference Manual
First the assembler looks in the directory where test.src is located for
the file myinc.inc. If it does not find the file, it looks in the directory
c:\proj\include for the file myinc.inc (this option).
Related information
Section 6.5, How the Assembler Searches Include Files, in Chapter Using the
Assembler of the User's Manual.
-i (--symbol-scope)
EDE
1. From the Project menu, select Project Options...
--symbol-scope={global|local}
Default
-il
Description
With this option you tell the assembler how to treat symbols that you have
not specified explicitly as global or local.
By default the assembler treats all symbols as local symbols unless you
have defined them explicitly as global.
Example
astc -ig test.src
astc --symbol-scope=global test.src
The assembler treats all symbols as global symbols unless they are defined
as local symbols in the assembly source file.
Related information
-
• • • • • • • •
5-88 TriCore Reference Manual
--is-tricore2
EDE
1. From the Project menu, select Project Options...
Description
With this option you can use TriCore 2 instructions in the assembly code.
When you select this option, the define __TC2__ is set to 1.
Example
To allow the use of TriCore 2 instructions in the assembly code, enter:
astc --is-tricore2 test.src
Related information
Assembler option -C (Select CPU)
TOOL OPTIONS
Tool Options - Assembler 5-89
-k (--keep-output-files)
EDE
EDE always removes the .o file when errors occur during assembly.
--keep-output-files
Description
If an error occurs during assembly, the resulting .o file may be incomplete
or incorrect. With this option you keep the generated object file (.o)
when an error occurs.
By default the assembler removes the generated object file (.o) when an
error occurs. This is useful when you use the make utility mktc. If the
erroneous files are not removed, the make utility may process corrupt files
on a subsequent invocation.
Use this option when you still want to use the generated object. For
example when you know that a particular error does not result in a
corrupt object file.
Example
astc -k test.src
When an error occurs during assembly, the generated output file test.o
will not be removed.
Related information
Assembler option --warnings-as-errors (Treat warnings as errors)
• • • • • • • •
5-90 TriCore Reference Manual
-L (--list-format)
EDE
1. From the Project menu, select Project Options...
--list-format=flags
0 same as -LCDEGILMNPQRVWXY
1 same as -Lcdegilmnpqrvwxy
Default
-LcDEGilMnPqrVWXy
Tool Options - Assembler 5-91
Description
With this option you specify which information you want to include in the
list file. Use this option in combination with the option -l (--list-file).
If you do not specify this option, the assembler uses the default:
-LcDEGilMnPqrVWXy.
With option -tl, the assembler also writes section information to the list
file.
Example
astc -l -Ldm test.src
astc --list-file --list-format=+section,+macro
test.src
The assembler generates a list file that includes all default information plus
section directives and macro definitions.
Related information
Assembler option -l (Generate list file)
Assembler option -tl (Display section information in list file)
Section 6.1, Assembler List File Format, in Chapter List File Formats.
• • • • • • • •
5-92 TriCore Reference Manual
-l (--list-file)
EDE
1. From the Project menu, select Project Options...
--list-file
Description
With this option you tell the assembler to generate a list file. A list file
shows the generated object code and the relative addresses. Note that the
assembler generates a relocatable object file with relative addresses.
Example
To generate a list file with the name test.lst, enter:
astc -l test.src
astc --list-file test.src
TOOL OPTIONS
Related information
Assembler option -L (List file formatting options)
Section 6.1, Assembler List File Format, in Chapter List File Formats.
Tool Options - Assembler 5-93
-m (--preprocessor-type)
EDE
1. From the Project menu, select Project Options...
--preprocessor-type={none|tasking}
Default
-mt
Description
With this option you select the preprocessor that the assembler will use.
By default, the assembler uses the TASKING preprocessor.
When the assembly source file does not contain any preprocessor
symbols, you can specify the assembler not to use a preprocessor.
Example
astc test.src
astc -mt test.src
astc --preprocessor=tasking test.src
These invocations have the same effect: the assembler preprocesses the
file test.src with the TASKING preprocessor.
Related information
-
• • • • • • • •
5-94 TriCore Reference Manual
--mmu-present
EDE
1. From the Project menu, select Project Options...
This option is only available (and relevant) for specific target processors.
See option -C (--cpu) to select a target processor.
Description
With this option you can use memory management instructions in the
assembly code. When you select this option, the define __MMU__ is set to
1.
Example
To allow the use of memory management unit (MMU) instructions in the
TOOL OPTIONS
Related information
Assembler option -C (Select CPU)
Tool Options - Assembler 5-95
--no-tasking-sfr
EDE
1. From the Project menu, select Project Options...
Description
Normally, the assembler includes a special function register (SFR) file
before compiling. The assembler automatically selects the SFR file
belonging to the target you select on the Processor definition page of
the Processor options (assembler option -C).
With this option the assembler does not include the register file
regcpu.def as based on the selected target processor.
Use this option if you want to use your own set of SFR '.def' files.
Example
astc -Ctc11ib --no-tasking-sfr test.src
The register file regtc11ib.def is not included, but the assembler allows
the use of MMU instructions due to -C.
Related information
Assembler option -C (Select CPU)
• • • • • • • •
5-96 TriCore Reference Manual
-O (--optimize)
EDE
1. From the Project menu, select Project Options...
--optimize=flags
Default
-Ogs
Description
With this option you can control the level of optimization. If you do not
use this option, -Ogs is the default.
TOOL OPTIONS
Example
The following invocations are equivalent and result all in the default
optimizations:
astc test.src
astc -Ogs test.src
astc --optimize=+generics,+instr-size test.src
Related information
Section 6.3, Assembler Optimizations, in Chapter Using the Assembler of the
User's Manual.
Tool Options - Assembler 5-97
-o (--output)
EDE
-
--output=file
Description
With this option you can specify another filename for the output file of the
assembler. Without this option, the basename of the assembly source file is
used with extension .o.
EDE names the output file always after the assembly source file.
Example
astc -o relobj.o asm.src
astc --output=relobj.o asm.src
The assembler creates the file relobj.o for the assembled file asm.src.
Without the option -o, like EDE, the assembler uses the name of the input
file and creates asm.o.
Related information
-
• • • • • • • •
5-98 TriCore Reference Manual
--silicon-bug
EDE
1. From the Project menu, select Project Options...
Description
With this option you tell the assembler to check for some CPU functional
problems. The assembles gives a warning when the specified problem is
present.
Example
astc --silicon-bug=cpu5,cpu9 test.src
The assembler checks for TC113 problems CPU5 and CPU9 and gives a
warning when the problem is present.
Related information
See Chapter 9, CPU Functional Problems, for more information about the
individual problems.
• • • • • • • •
5-100 TriCore Reference Manual
-t (--section-info)
EDE
1. From the Project menu, select Project Options...
--section-info=flags
Description
With this option you tell the assembler to display section information. For
each section its memory space, size, total cycle counts and name is listed
TOOL OPTIONS
The cycle count consists of two parts: the total accumulated count for the
section and the total accumulated count for all repeated instructions. In the
case of nested loops it is possible that the total supersedes the section
total.
With -tl, the assembler writes the section information to the list file. You
must specify this option in combination with the option -l (generate list
file).
Tool Options - Assembler 5-101
Example
astc -l -tcl test.src
astc -l --section-info=+console,+list test.src
The assembler generates a list file and writes the section information to
this file. The section information is also displayed on stdout.
Section summary:
REL 4 .zbss_clr_test1
REL 46 .text_test1
REL 4 .zdata_rom_test1
Related information
Assembler option -l (Generate list file)
• • • • • • • •
5-102 TriCore Reference Manual
-V (--version)
EDE
-
--version
Description
Display version information. The assembler ignores all other options or
input files.
Example
astc -V
astc --version
The assembler does not assemble any files but displays the following
version information:
TASKING TriCore VX-toolset Assembler vxx.yrz Build nnn
Copyright years Altium BV Serial# 00000000
Related information
-
TOOL OPTIONS
Tool Options - Assembler 5-103
-w (--no-warnings)
EDE
1. From the Project menu, select Project Options...
--no-warnings[=nr,...]
Description
With this option you can suppresses all warning messages or specific
warning messages.
• If you do not specify this option, all warnings are reported.
• If you specify this option but without numbers, all warnings are
suppressed.
• If you specify this option with a number, only the specified warning is
suppressed. You can specify the option -w multiple times.
Example
To suppress all warnings:
astc -w test.src
astc --no-warnings test.src
• • • • • • • •
5-104 TriCore Reference Manual
Related information
Assembler option --warnings-as-errors (Treat warnings as errors)
TOOL OPTIONS
Tool Options - Assembler 5-105
--warnings-as-errors
EDE
1. From the Project menu, select Project Options...
Description
With this option you tell the assembler to treat warnings as errors.
Example
astc --warnings-as-errors test.src
Related information
Assembler option -w (suppress some or all warnings)
• • • • • • • •
5-106 TriCore Reference Manual
Because EDE uses the control program, EDE automatically precedes the
option with -Wl to pass the option via the control program directly to the
linker.
Be aware that some options are not useful in EDE or just will not have any
effect. For example, the option -k keeps files after an error occurred.
When you specify this option in EDE, it will have no effect because EDE
always removes the output file after an error had occurred.
When you do not specify an option, a default value may become active.
• • • • • • • •
5-108 TriCore Reference Manual
-? (--help)
EDE
-
Description
Displays an overview of all command line options.
Example
The following invocations all display a list of the available command line
options:
ltc -?
ltc --help
ltc
Related information
-
TOOL OPTIONS
Tool Options - Linker 5-109
-c (--chip-output)
EDE
1. From the Project menu, select Project Options...
--chip-output=[basename]:format[:addr_size],...
The addr_size specifies the size of the addresses in bytes (record length).
For Intel Hex you can use the values: 1, 2 and 4 (default). For Motorola S
you can specify: 2 (S1 records), 3 (S2 records, default) or 4 bytes (S3
records).
Description
With this option you specify the Intel Hex or Motorola S-record output
format for loading into a PROM-programmer. The linker generates a file
for each ROM memory defined in the LSL file, where sections are located:
memory memname
{ type=rom; }
The name of the file is the name of the EDE project or, on the command
line, the name of the memory space that was emitted with extension .hex
or .sre. Optionally you can specify a basename which prepends the
generated file name.
• • • • • • • •
5-110 TriCore Reference Manual
Examples
To generate Intel Hex output files for each defined memory, enter the
following on the command line:
ltc -cmyfile:IHEX test1.o
ltc --chip-output=myfile:IHEX test1.o
Related information
Linker option -o (output file),
Section 7.2, Motorola S-Record Format,
Section 7.3, Intel Hex Record Format, in Chapter Object File Formats.
TOOL OPTIONS
Tool Options - Linker 5-111
--case-insensitive
EDE
1. From the Project menu, select Project Options...
Description
With this option you tell the linker not to distinguish between upper and
lower case characters. By default the linker considers upper and lower
case characters as different characters.
Disabling the option Link case sensitive in EDE is the same as specifying
the option --case-insensitive on the command line.
Assembly source files that are generated by the compiler must always be
assembled and thus linked case sensitive. When you have written your
own assembly code and specified to assemble it case insensitive, you must
also link the .o file case insensitive.
Example
To link case insensitive:
ltc --case-insensitive test.o
The linker considers upper and lower case characters as being the same.
So, for example, the label LabelName is considered the same label as
labelname.
Related information
Assembler option -c (Assemble case insensitive)
• • • • • • • •
5-112 TriCore Reference Manual
-D (--define)
EDE
1. From the Project menu, select Project Options...
--define=macro_name[=macro_definition]
Description
With this option you can define a macro and specify it to the linker
preprocessor. If you only specify a macro name (no macro definition), the
macro expands as '1'.
You can specify as many macros as you like: you can use the option -D
multiple times. If the command line exceeds the limit of the operating
system, you can define the macros in an option file which you then must
specify to the linker with the option -ffile.
Example
To define the RESET vector, interrupt table start address and trap table start
address which is used in the linker script file tc1v1_3.lsl, enter:
ltc test.o -otest.elf -dtc1v1_3.lsl -DRESET=0xa0000000
-DINTTAB=0xa00f0000 --define=TRAPTAB=0xa00f2000
Related information
Linker option -f (Name of invocation file)
Tool Options - Linker 5-113
-d (--lsl-file)
EDE
1. From the Project menu, select Project Options...
3. Select Use project specific memory and section LSL file and specify
a name.
Description
With this option you specify a linker script file to the linker. If you do not
specify this option, the linker uses a default script file. You can specify the
existing file target.lsl or the name of a manually created linker script
file. You can use this option multiple times. The linker processes the LSL
files in the order in which they appear on the command line.
The linker script file contains vital information about the core for the
locating phase of the linker. A linker script file is coded in LSL and
contains the following types of information:
• the architecture definition describes the core's hardware architecture.
• the memory definition describes the physical memory in the system.
• the section layout definition describes how to locate sections in
memory.
Example
To read linker script file information from file tc1v1_3.lsl:
ltc -dtc1v1_3.lsl test.o
ltc --lsl-file=tc1v1_3.lsl test.o
• • • • • • • •
5-114 TriCore Reference Manual
Related information
Linker option --lsl-check (Check LSL file(s) and exit)
Section 7.7, Controlling the Linker with a Script in Chapter Linker of the
User's Manual.
TOOL OPTIONS
Tool Options - Linker 5-115
--diag
EDE
1. In the Help menu, enable the option Show Help on Tool Errors.
Optionally, you can use one of the following display formats (format):
Description
With this option you can ask for an extended description of error
messages in the format you choose. The output is directed to stdout
(normally your screen) and in the format you specify.
To create a file with the descriptions, you must redirect the output.
With the suboption all, the descriptions of all error messages are given. If
you want the description of one or more selected error messages, you can
specify the error message numbers, separated by commas.
With this option the linker does not link any files.
Example
To display an explanation of message number 106, enter:
ltc --diag=106
• • • • • • • •
5-116 TriCore Reference Manual
Related information
Section 7.10, Linker Error Messages, in Chapter Using the Linker of the
User's Manual.
TOOL OPTIONS
Tool Options - Linker 5-117
-e (--extern)
EDE
1. From the Project menu, select Project Options...
Description
With this option you force the linker to consider the given symbol as an
undefined reference. The linker tries to resolve this symbol by extracting
the corresponding symbol definition from a library. If the symbol is
defined in an object file, this option has no influence on the link process.
Suppose you are linking from a library. Because the library itself already
has been compiled and assembled, the linker does not find any
unresolved symbols. Hence, the linker will not extract any module from
the library. When you force a symbol to be undefined, the linker extracts
those modules that contain the symbol.
This option is, for example, useful if the startup code is part of a library.
Because your own application does not refer to the startup code, you can
force the startup code to be extracted by specifying the symbol _START as
an unresolved external.
Example:
Consider the following invocation:
ltc mylib.a
Nothing is linked and no output file will be produced, because there are
no unresolved symbols when the linker searches through mylib.a.
ltc -e _START mylib.a
ltc --extern=_START mylib.a
• • • • • • • •
5-118 TriCore Reference Manual
In this case the linker searches for the symbol _START in the library and
(if found) extracts the object that contains _START, the startup code. If this
module contains new unresolved symbols, the linker looks again in
mylib.a. This process repeats until no new unresolved symbols are
found.
Related information
Section 7.4.1, Specifying Libraries to the Linker, in Chapter Using the Linker
of the User's Manual.
TOOL OPTIONS
Tool Options - Linker 5-119
--error-file
EDE
-
Description
With this option the linker redirects error messages to a file.
Example
ltc --error-file=my.elk test.o
The linker writes error messages to the file my.elk instead of stderr.
Related information
Linker option --warnings-as-errors (Treat warnings as errors)
• • • • • • • •
5-120 TriCore Reference Manual
-f (--option-file)
EDE
1. From the Project menu, select Project Options...
In EDE you can save your options in a file and restore them to call the
linker with those options:
Be aware that when you specify the option -f in the Additional options
field, the options are added to the linker options you have set in the
Project Options dialog. Only in extraordinary cases you may want to use
them in combination.
Description
Instead of typing all options on the command line, you can create an
TOOL OPTIONS
option file which contains all options and files you want to specify. With
this option you specify the option file to the linker.
Use an option file when the length of the command line would exceed the
limits of the operating system, or just to store options and save typing.
Example
Suppose the file myoptions contains the following lines:
Related information
-
• • • • • • • •
5-122 TriCore Reference Manual
--first-library first
EDE
-
Description
When the linker processes a library it searches for symbols that are
referenced by the objects and libraries processed so far. If the library
contains a definition for an unresolved reference the linker extracts the
object that contains the definition from the library.
By default the linker processes object files and libraries in the order in
which they appear on the command line. If you specify the option
--first-library-first the linker always tries to take the symbol definition
from the library that appears first on the command line before scanning
subsequent libraries.
This is for example useful when you are working with a newer version of
a library that partially overlaps the older version. Because they do not
contain exactly the same functions, you have to link them both. However,
when a function is present in both libraries, you may want the linker to
extract the most recent function.
With this option, you tell the linker to scan the libraries from left to right,
TOOL OPTIONS
and extract the symbol from the first library where the linker finds it.
Example:
ltc --first-library-first a.a test.o b.a
If the file test.o calls a function which is both present in a.a and b.a,
normally the function in b.a would be extracted. With this option the
linker first tries to extract the symbol from the first library a.a.
Related information
Linker option --no-rescan (Do not rescan libraries)
Tool Options - Linker 5-123
-I (--include-directory)
EDE
-
--include-directory=path,...
Description
With this option you can specify the path where your LSL include files are
located. A relative path will be relative to the current directory.
The order in which the linker searches for LSL include files is:
1. The pathname in the LSL file and the directory where the LSL files are
located (only for #include files that are enclosed in "")
Example
Suppose that the LSL file lslfile.lsl contains the following lines:
#include "mypart.lsl"
ltc --include-directory=myinclude
--lsl-file=lslfile.lsl test.o
First the linker looks in the directory where lslfile.lsl is located for
the file mypart.lsl. If it does not find the file, it looks in myinclude
subdirectory relative to the current directory for the file mypart.lsl (this
option). Finally it looks in the directory ..\include.lsl .
Related information
Linker option -d (Linker script file)
• • • • • • • •
5-124 TriCore Reference Manual
-i
(--user-provided-initialization-co
de)
EDE
1. From the Project menu, select Project Options...
--user-provided-initialization-code
Description
It is possible to use your own initialization code, for example, to save
ROM space. With this option you tell the linker not to generate a copy
table for initialize/clear sections. Use linker labels in your source code to
access the positions of the sections when located.
both.
Example:
To link with your own startup code:
ltc -i test.o
ltc --user-provided-initialization-code test.o
Related information
-
Tool Options - Linker 5-125
-k (--keep-output-files)
EDE
EDE always removes the output files when errors occurred.
Description
If an error occurs during linking, the resulting output file may be
incomplete or incorrect. With this option you keep the generated output
files when an error occurs.
By default the linker removes the generated output files when an error
occurs. This is useful when you use the make utility mktc. If the
erroneous files are not removed, the make utility may process corrupt files
on a subsequent invocation.
Use this option when you still want to use the generated file. For example
when you know that the error(s) do not result in a corrupt output file, or
when you want to inspect the output file, or send it to Altium support.
Example
ltc -k test.o
ltc --keep-output-files test.o
When an error occurs during linking, the generated output file test.elf
will not be removed.
Related information
-
• • • • • • • •
5-126 TriCore Reference Manual
-L (--library-directory /
--ignore-default-library-path)
EDE
1. From the Project menu, select Directories...
3. In the Library Files Path field, add the pathnames of the directories
where the linker should look for library files.
-L
--ignore-default-library-path
Description
With this option you can specify the path(s) where your system libraries,
specified with the -l option, are located. If you want to specify multiple
paths, use the option -L for each separate path.
TOOL OPTIONS
The priority order in which the linker searches for system libraries
specified with the -l option is:
Example
Suppose you call the linker as follows:
ltc test.o -Lc:\mylibs -lc
First the linker looks in the directory c:\mylibs for library libc.a (this
option).
If it does not find the requested libraries, it looks in the directory that is set
with the environment variable LIBTC1V1_2, LIBTC1V1_3 or LIBTC2.
Related information
Linker option -l (Link system library)
Section 7.4.2, How the Linker Searches Libraries, in Chapter Using the
Linker of the User's Manual.
• • • • • • • •
5-128 TriCore Reference Manual
-l (--library)
EDE
1. From the Project menu, select Project Options...
Description
With this option you tell the linker to search also in system library
libname.a, where name is a string. The linker first searches for system
libraries in any directories specified with -Lpath, then in the directories
specified with the environment variable LIBTC1V1_2, LIBTC1V1_3 or
LIBTC2, unless you used the option -L without a directory.
If you use the libc.a library, you must always link the libfp.a library
as well. Remember that the order of the specified libraries is important!
Example
To search in the system library libfp.a (floating-point library):
TOOL OPTIONS
The linker links the file test.o and first looks in mylib.a (in the current
directory only), then in the system library libfp.a to resolve unresolved
symbols.
Related information
Linker option -L (Additional search path for system libraries)
Section 7.4.1, Specifying Libraries to the Linker, in Chapter Using the Linker
of the User's Manual.
Tool Options - Linker 5-129
--link-only
EDE
-
Description
With this option you suppress the locating phase. The linker stops after
linking. The linker complains if any unresolved references are left.
Example:
ltc --link-only hello.o
The linker checks for unresolved symbols and creates the file taks1.out.
Related information
Control program option -cl (Stop after linking)
• • • • • • • •
5-130 TriCore Reference Manual
--lsl-check
EDE
-
Description
With this option the linker just checks the syntax of the LSL file(s) and
exits. No linking or locating is performed.
Example:
To check the LSL file(s) and exit:
ltc --lsl-check --lsl-file=mylslfile.lsl
Related information
Linker option -d (Linker script file)
--lsl-dump
EDE
1. From the Project menu, select Project Options...
3. Enable the option Dump processor and memory info from LSL
file.
Description
With this option you tell the linker to dump the LSL part of the map file in
a separate file, independent of the -M (generate map file) option. If you
do not specify a filename, the file ltc.ldf is used.
Example
ltc --lsl-dump=mydump.ldf test.o
The linker dumps the processor and memory info from the LSL file in the
file mydump.ldf.
Related information
Linker option -m (Map file formatting options)
• • • • • • • •
5-132 TriCore Reference Manual
-M (--map-file)
EDE
1. From the Project menu, select Project Options...
Description
With this option you tell the linker to generate a linker map file. If you do
not specify a filename, the linker uses the same basename as the output
file with the extension .map.
A linker map file is a text file that shows how the linker has mapped the
sections and symbols from the various object files (.o) to the linked object
file. A locate part shows the absolute position of each section. External
symbols are listed per space with their absolute address, both sorted on
symbol and sorted on address.
With the option -m (map file formatting) you can specify which parts you
TOOL OPTIONS
Example
To generate a map file (test.map):
ltc -Mtest.map test.o
ltc --map-file=test.map test.o
The control program by default tells the linker to generate a map file.
Related information
Linker option -m (Map file formatting options)
Section 6.2, Linker Map File Format, in Chapter List File Formats.
Tool Options - Linker 5-133
-m (--map-file-format)
EDE
1. From the Project menu, select Project Options...
--map-file-format=flags
Default
-mCfklMORSU
Description
With this option you specify which information you want to include in the
map file. Use this option in combination with the option -M
(--map-file). If you do not specify this option, the linker uses the
default: -mCfklMORSU
• • • • • • • •
5-134 TriCore Reference Manual
Example
ltc -Mtest.map -mFr test.o
ltc --map-file=test.map
--map-file-format=+crossref,-files test.o
The linker generates the map file test.map that includes all default
information plus the cross reference part, but not the processed files part.
Related information
Linker option -M (Generate map file)
Section 6.2, Linker Map File Format, in Chapter List File Formats.
TOOL OPTIONS
Tool Options - Linker 5-135
--misra-c-report
EDE
1. From the Project menu, select Project Options...
Description
With this option you tell the linker to create a MISRA C Quality Assurance
report. This report lists the various modules in the project with the
respective MISRA C settings at the time of compilation. If you do not
specify a filename, the file name.mcr is used.
Example
ltc --misra-c-report test.o
Related information
Compiler option --misrac
• • • • • • • •
5-136 TriCore Reference Manual
--munch
EDE
1. From the Project menu, select Project Options...
Description
With this option you tell the linker to activate the muncher in the
pre-locate phase.
The data sections are initialized when the application is downloaded. The
data sections are not re-initialized when the application is restarted.
Example
ltc --munch test.o
The linker activates the muncher in the pre-locate phase while linking the
file test.o.
TOOL OPTIONS
Related information
-
Tool Options - Linker 5-137
-N (--no-rom-copy)
EDE
1. From the Project menu, select Project Options...
Description
With this option the linker will not generate a ROM copy for data sections.
A copy table is generated and contains entries to clear BSS sections.
However, no entries to copy data sections from ROM to RAM are placed in
the copy table.
The data sections are initialized when the application is downloaded. The
data sections are not re-initialized when the application is restarted.
Example
ltc -N test.o
ltc --no-rom-copy test.o
Related information
-
• • • • • • • •
5-138 TriCore Reference Manual
--no-rescan
EDE
1. From the Project menu, select Project Options...
Description
When the linker processes a library, it searches for symbol definitions that
are referenced by the objects and libraries processed so far. If the library
contains a definition for an unresolved reference, the linker extracts the
object that contains the definition from the library. The linker processes
object files and libraries in the order in which they appear on the
command line.
When all objects and libraries are processed the linker checks if there are
unresolved symbols left. If so, the default behavior of the linker is to
rescan all libraries in the order given on the command line. The linker
stops rescanning the libraries when all symbols are resolved, or when the
linker could not resolve any symbol(s) during the rescan of all libraries.
TOOL OPTIONS
Notice that resolving one symbol may introduce new unresolved symbols.
With this option, you tell the linker to scan the object files and libraries
only once. When the linker has not resolved all symbols after the first
scan, it reports which symbols are still unresolved. This option is useful if
you are building your own libraries. The libraries are most efficiently
organized if the linker needs only one pass to resolve all symbols.
Example:
To scan the libraries only once:
ltc --no-rescan test.o a.a b.a
The linker resolves all unresolved symbols while scanning the object files
and libraries and reports all remaining unresolved symbols after this scan.
Tool Options - Linker 5-139
Related information
Linker option --first-library-first (Scan libraries in the specified order)
• • • • • • • •
5-140 TriCore Reference Manual
--non-romable
EDE
1. From the Project menu, select Project Options...
Description
With this option you tell the linker that the application is not romable. The
linker will locate all ROM sections in RAM. A copy table is generated and
is located in RAM. When the application is started, that data and BSS
sections are re-initialized.
Example
ltc --non-romable test.o
Related information
TOOL OPTIONS
-
Tool Options - Linker 5-141
-O (--optimize)
EDE
1. From the Project menu, select Project Options...
--optimize=flags
c/C (+/-delete-unreferenced-code-sections)
Delete unreferenced code sections from the output file
(no effect on sources compiled with debug information)
d/D (+/-delete-unreferenced-data-sections)
Delete unreferenced data sections from the output file
(no effect on sources compiled with debug information)
l/L (+/-first-fit-decreasing)
Use a 'first fit decreasing' algorithm to locate
unrestricted sections in memory.
s/S (+/-delete-unreferenced-symbols)
Delete unreferenced symbols from the output file
t/T (+/-copytable-compression)
Locate (unrestricted) sections in such a way that
the size of the copy table is as small as possible.
x/X (+/-delete-duplicate-code)
Delete duplicate code from the output file
y/Y (+/-delete-duplicate-data)
Delete duplicate constant data from the output file
• • • • • • • •
5-142 TriCore Reference Manual
Default
-O1
Description
With this option you can control the level of optimization. If you do not
use this option, -OCDLStXY (-O1) is the default.
Example
The following invocations are equivalent and result all in the default
optimizations.
ltc test.o
ltc -O test.o
ltc -O1 test.o
ltc -OCDLStXY test.o
ltc --optimize=-delete-unreferenced-code-sections,
-delete-unreferenced-code-sections,
-first-fit-decreasing,+copytable-compression,
-delete-duplicate-code,-delete-duplicate-data test.o
Related information
Section 7.2.3, Linker Optimizations, in Chapter Using the Linker of the
User's Manual.
Tool Options - Linker 5-143
-o (--output-file)
EDE
1. From the Project menu, select Project Options...
EDE and the control program name the output file always after the first
input file with the extension .elf.
--output=[filename][:format[:addr_size][,space_name]]...
ELF ELF/DWARF
IEEE IEEE-695
IHEX Intel Hex
SREC Motorola S-records
Description
By default, the linker generates an output file in ELF/DWARF format, with
the name task1.elf.
With this option you can specify an alternative filename, and an alternative
output format. The default output format is the format of the first input
file.
You can use the -o option multiple times. This useful to generate multiple
output formats or to link multiple address spaces. With the first occurrence
of the -o option you must specify the filename without extension. If you
do not specify a filename, or you do not specify the -o option at all, the
linker uses the default basename taskn.
• • • • • • • •
5-144 TriCore Reference Manual
With the argument space_name you can specify the name of the address
space. The name of the output file will be filename with the extension
.hex or .sre and contains the specified space. (Remember to use the -o
option multiple times to link multiple address spaces.)
Example
To create the output file myfile.hex of the address space named
linear:
Related information
Linker option -c (Generate an output file for each chip)
TOOL OPTIONS
-r (--incremental)
EDE
1. From the Project menu, select Project Options...
Description
Normally the linker links and locates the specified object files. With this
option you tell the linker only to link the specified files. The linker creates
a linker output file .out. You then can link this file again with other
object files until you have reached the final linker output file that is ready
for locating.
In the last pass, you call the linker without this option with the final linker
output file .out. The linker will now locate the file.
Example
In this example, the files test1.o, test2.o and test3.o are
incrementally linked:
Related information
Section 7.5, Incremental Linking, in Chapter Using the Linker of the User's
Manual.
• • • • • • • •
5-146 TriCore Reference Manual
-S (--strip-debug)
EDE
1. From the Project menu, select Project Options...
--strip-debug
Description
With this option you specify not to include symbolic debug information in
the resulting output file.
Example
ltc -S test.o -otest.elf
ltc --strip-debug test.o --output=test.elf
The linker generates the object file test.elf without symbolic debug
TOOL OPTIONS
information.
Tool Options - Linker 5-147
-V (--version)
EDE
-
Description
Display version information. The linker ignores all other options or input
files.
Example
ltc -V
ltc --version
The linker does not link any files but displays the following version
information:
TASKING TriCore VX-toolset object linker vx.yrz Build 000
Copyright years Altium BV Serial# 00000000
Related information
-
• • • • • • • •
5-148 TriCore Reference Manual
-v (--verbose)
EDE
1. From the Project menu, select Project Options...
Description
With this option you put the linker in verbose mode. The linker prints the
filenames and the link passes while it processes the files. It also shows
which objects are extracted from libraries. With this option you can
monitor the current status of the linker.
Example
ltc test.o -lc -lfp -lrt -v
The linker links the file test.o and displays the steps it performs.
ltc I405: activating pre link phase
ltc I406: activating link phase
ltc I401: start linking task "task1"
TOOL OPTIONS
Related information
-
Tool Options - Linker 5-149
-w (--no-warnings)
EDE
1. From the Project menu, select Project Options...
Description
With this option you can suppresses all warning messages or specific
warning messages.
• If you do not specify this option, all warnings are reported.
• If you specify this option but without numbers, all warnings are
suppressed.
• If you specify this option with a number, only the specified warnings
are suppressed. Separate multiple warnings by commas.
Example:
To suppress all warnings:
ltc -w test.o
ltc --no-warnings test.o
• • • • • • • •
5-150 TriCore Reference Manual
Related information
Linker option --warnings-as-errors (Treat warnings as errors)
TOOL OPTIONS
Tool Options - Linker 5-151
--warnings-as-errors
EDE
1. From the Project menu, select Project Options...
Description
With this option you tell the linker to treat warnings as errors.
When the linker detects an error, it tries to continue the link process and
reports other errors and warnings. However, the linker will exit with an
exit status not equal zero (!= 0) and will not produce any output files.
Example
ltc --warnings-as-errors test.o
Related information
Linker option -w (Suppress some or all warnings)
• • • • • • • •
5-152 TriCore Reference Manual
For the linker options in EDE, EDE invokes the linker via the control
program. Therefore, it uses the syntax of the control program to pass
options and files to the linker. See section 5.3, Linker Options, for an
overview of the EDE linker options and the corresponding command line
linker options.
Some options are interpreted by the control program itself; other options
are passed to those programs in the toolchain that accept the option.
-? (--help)
Command line syntax
-?[options]
--help[=options]
Description
Displays an overview of all command line options. When you specify the
suboption options, you receive extended information.
Example
The following invocations all display a list of the available command line
options:
cctc -?
cctc
Related information
-
• • • • • • • •
5-154 TriCore Reference Manual
-A (--language)
Command line syntax
-A[flags]
--language[=flags]
Default
-Apx
Description
With this option you control the language extensions the compiler can
accept. Default the C compiler allows all language extensions.
With -Ap you tell the compiler to allow C++ style comments (//) in ISO
C90 mode (option -c90). In ISO C99 mode this style of comments is
always accepted.
With -Ax you tell the compiler not to check for assignments of a constant
string to a non-constant string pointer. With this option the following
TOOL OPTIONS
Example
ctc -APx test.c
ctc --language=-comments,+strings test.c
The control program calls the compiler in such a way that it accepts
assignments of a constant string to a non-constant string pointer but
ignores C++ style comments.
Tool Options - Control Program 5-155
Related information
Compiler option -A (Control language extensions)
• • • • • • • •
5-156 TriCore Reference Manual
--address-size
Command line syntax
--address-size=addr_size
Description
If you specify IHEX or SREC with the control option --format, you can
additionally specify the record length and the address space to be emitted
in the output files.
With this option you can specify the size of addresses in bytes (record
length). For Intel Hex you can use the values: 1, 2, and 4 (default). For
Motorola S-records you can specify: 2 (S1 records), 3 (S2 records, default)
or 4 bytes (S3 records).
Example
To create the SREC file test.s with S1 records, type:
cctc --format=SREC --address-size=2
Related information
Control program option --format (Set linker output format)
Control program option --space (Set linker output space name)
-C (--cpu)
Command line syntax
-Ccpu
Description
With this option you define the target processor for which you create your
application. Default the control program generates an object file for the
TC11IB.
Example
To generate the file test.elf for the TC11IB processor:
cctc -Ctc11ib test.c
cctc --cpu=tc11ib test.c
Related information
Compiler option -C (Use SFR definitions for CPU)
Section 5.4, Calling the Compiler, in Chapter Using the Compiler of the
User's Manual.
• • • • • • • •
5-158 TriCore Reference Manual
--case-insensitive
Command line syntax
--case-insensitive
Description
With this option you tell the control progam not to distinguish between
upper and lower case characters. By default upper and lower case
characters are considered as different characters. Note that in assembly
instruction mnemonics, register names, directives and controls are always
treated case insensitive.
Assembly source files that are generated by the compiler must always be
assembled and linked case sensitive. When you are writing your own
assembly code, you may want to specify the case insensitive mode.
Example
To create the file test.elf with case insensitive assembling and linking:
cctc -c test.c
cctc --case-insensitive test.c
The assembler and linker now consider upper and lower case characters
as being the same. So, for example, the label LabelName is the same label
as labelname.
Related information
TOOL OPTIONS
-cc/-cs/-co/-cl
Command line syntax
-cc
--create=c
-cs
--create=assembly
-co
--create=object
-cl
--create=relocatable
Description
Normally the control program generates an absolute object file of the
specified output format from the file you supplied as input.
With this option you tell the control program to stop after a certain
number of phases.
-cc Stop after C++ files are compiled to intermediate C files (.ic)
-cs Stop after C files are compiled to assembly (.src)
-co Stop after the files are assembled to object files (.obj)
-cl Stop after the files are linked to a linker object file (.eln)
The control program stops after the file is assembled. It does not link nor
locate the generated output.
Related information
-
• • • • • • • •
5-160 TriCore Reference Manual
--check
Command line syntax
--check
Description
With this option you can check the source code for syntax errors, without
generating code. This saves time in developing your application.
Example
To check for syntax errors, without generating code:
cctc --check test.c
Related information
Compiler option --check (Check syntax)
-D (--define)
Command line syntax
-Dmacro_name[=macro_definition]
--define=macro_name[=macro_definition]
Description
With this option you can define a macro and specify it to the preprocessor.
If you only specify a macro name (no macro definition), the macro
expands as '1'.
You can specify as many macros as you like. On the command line, use
the option -D multiple times. If the command line exceeds the length limit
of the operating system, you can define the macros in an option file which
you then must specify to the control program with the option -f file.
Defining macros with this option (instead of in the C source) is, for
example, useful to compile or assemble conditional source as shown in
the example below.
The control program passes the option -D (--define) to the compiler and
the assembler.
Example
Consider the following C program with conditional code to compile a
demo program and a real program:
void main( void )
{
#if DEMO == 1
demo_func(); /* compile for the demo program */
#else
real_func(); /* compile for the real program */
#endif
}
You can now use a macro definition to set the DEMO flag. With the
control program this looks as follows:
cctc -DDEMO test.c
cctc -DDEMO=1 test.c
• • • • • • • •
5-162 TriCore Reference Manual
The next example shows how to define a macro with arguments. Note that
the macro name and definition are placed between double quotes because
otherwise the spaces would indicate a new option.
cctc -D"MAX(A,B)=((A) > (B) ? (A) : (B))"
cctc --define="MAX(A,B)=((A) > (B) ? (A) : (B))"
Related information
Control program option -U (Undefine preprocessor macro)
Control program option -f (Read options from file)
TOOL OPTIONS
Tool Options - Control Program 5-163
-d (--lsl-file)
Command line syntax
-dfile
--lsl-file=file
Description
A linker script file contains vital information about the core for the locating
phase of the linker. A linker script file is coded in LSL and contains the
following types of information:
• the architecture and derivative definition describe the core's hardware
architecture and its internal memory.
• the board specification describes the physical memory available in the
system.
• the section layout definition describes how to locate sections in
memory.
With this option you specify a linker script file via the control program to
the linker. If you do not specify this option, the linker does not use a
script file. You can specify the existing file tctarget.lsl or the name of
a manually written linker script file. You can use this option multiple
times. The linker processes the LSL files in the order in which they appear
on the command line.
Example
To read linker script file information from file mylslfile.lsl :
cctc -dmylslfile.lsl test.obj
cctc --lsl-file=mylslfile.lsl test.obj
Related information
Section 7.7, Controlling the Linker with a Script, in the User's Manual.
• • • • • • • •
5-164 TriCore Reference Manual
--diag
Command line syntax
--diag=[format:]{all|nr,...]
Description
With this option you can ask for an extended description of error
messages in the format you choose. The output is directed to stdout
(normally your screen) and in the format you specify. You can specify the
following formats: html, rtf or text (default). To create a file with the
descriptions, you must redirect the output.
With the suboption all, the descriptions of all error messages are given. If
you want the description of one or more selected error messages, you can
specify the error message numbers, separated by commas.
With this option the control program does not process any files.
Example
To display an explanation of message number 103 , enter:
cctc --diag=103
Related information
-
Tool Options - Control Program 5-165
-E (--preprocess)
Command line syntax
-E[flags]
--preprocess=[flags]
Description
With this option you tell the control program to preprocess the C source.
With -Ec you tell the preprocessor to keep the comments from the C
source file in the preprocessed output.
With -Ep you tell the preprocessor to strip the #line source position
information (lines starting with #line). These lines are normally
processed by the assembler and not needed in the preprocessed output.
When you leave these lines out, the output is more orderly to read.
Example
cctc -EcP test.c -o test.pre
cctc --preprocess +comments,-noline test.c
--output=test.pre
The compiler preprocesses the file test.c and sends the output to the
file test.pre. Comments are included but the line source position
information is not stripped from the output file.
Related information
-
• • • • • • • •
5-166 TriCore Reference Manual
--error-file
Command line syntax
--error-file[=file]
Description
With this option the control program redirects error messages to a file.
If you do not specify a filename, the error file will be named after the
input file with extension .err.
Example
To write errors to errors.err instead of stderr, enter:
cctc --error-file=errors.err test.c
Related information
Control program option --warnings-as-errors (Warnings as errors)
TOOL OPTIONS
Tool Options - Control Program 5-167
--exceptions
Command line syntax
--exceptions
Description
With this option you enable support for exception handling in the C++
compiler.
Example
To enable exception handling, enter:
cctc --exceptions test.cc
Related information
-
• • • • • • • •
5-168 TriCore Reference Manual
-F (--no-double)
Command line syntax
-F
--no-double
Description
With this option you tell the control program to treat variables of the type
double as float. Because the float type takes less space, execution speed
increases and code size decreases, both at the cost of less precision.
Example
cctc -F test.c
cctc --no-double test.c
The file test.c is processed where variables of the type double are
treated as float in the compilation phase.
Related information
-
TOOL OPTIONS
Tool Options - Control Program 5-169
-f (--option-file)
Command line syntax
-f file
--option-file=file
Description
Instead of typing all options on the command line, you can create a option
file which contains all options and file you want to specify. With this
option you specify the option file to the control program.
Use an option file when the length of the command line would exceed the
limits of the operating system, or just to store options and save typing.
• • • • • • • •
5-170 TriCore Reference Manual
Example
Suppose the file myoptions contains the following lines:
-g
-k
test.c
Related information
-
TOOL OPTIONS
Tool Options - Control Program 5-171
--force-c
Command line syntax
--force-c
Description
With this option you tell the control program to treat all .cc files as C files
instead of C++ files. This means that the control program does not call the
C++ compiler and forces the linker to link C libraries.
Example
cctc --force-c test.cc
Related information
Control program option --force-c++ (Force C++ compilation and linking)
• • • • • • • •
5-172 TriCore Reference Manual
--force-c++
Command line syntax
--force-c++
Description
With this option you tell the control program to treat all .c files as C++
files instead of C files. This means that the control program calls the C++
compiler prior to the C compiler and forces the linker to link C++ libraries.
Example
cctc --force-c++ test.c
Related information
Control program option --force-c (Treat C++ files as C files)
TOOL OPTIONS
Tool Options - Control Program 5-173
--force-munch
Command line syntax
--force-munch
Description
With this option you force the control program to activate the muncher in
the pre-locate phase.
Example
To force the muncher phase in the pre-locate phase, type:
cctc --force-munch test.cc
Related information
-
• • • • • • • •
5-174 TriCore Reference Manual
--force-prelink
Command line syntax
--force-prelink
Description
With this option you force the control program to invoke the C++
pre-linker.
Example
cctc --force-prelink test.cc
The control program always invokes the C++ pre-linker when generating
test.elf.
Related information
-
TOOL OPTIONS
Tool Options - Control Program 5-175
--format
Command line syntax
--format=format
ELF ELF/DWARF
IEEE IEEE-695
IHEX Intel Hex
SREC Motorola S-records
Description
With this option you specify the output format for the resulting (absolute)
object file. The default output format is ELF/DWARF, which can directly be
used by the CrossView Pro debugger.
If you choose IHEX or SREC, you can additionally specify the address size
of the chosen format (option --address-size) and the address space to
be emitted (option --space).
Example
To generate an IEEE output file:
cctc --format=IEEE test1.c test2.c --output=test.abs
Related information
Control program option --address-size (For linker IHEX./SREC files)
Control program option --space (Set linker output space name)
• • • • • • • •
5-176 TriCore Reference Manual
--fp-trap
Command line syntax
--fp-trap
Description
Default the control program uses the non-trapping floating-point library
(libfp.a). With this option you tell the control program to use the
trapping floating-point library (libfpt.a).
Example
cctc --fp-trap test.c
Link the trapping floating-point library when generating the object file
test.elf.
Related information
-
TOOL OPTIONS
Tool Options - Control Program 5-177
--fpu-present
Command line syntax
--fpu-present
Description
With this option the compiler can generate single precision floating-point
instructions in the assembly file. When you select this option, the macro
__FPU__ is defined in the C source file.
Example
To allow the use of floating-point unit (FPU) instructions in the assembly
code, enter:
ctc --fpu-present test.c
Related information
Compiler option -C (Use SFR definitions for CPU)
• • • • • • • •
5-178 TriCore Reference Manual
-g (--debug-info)
Command line syntax
-g
--debug-info
Description
With this option you tell the control program to include debug information
in the generated object file.
Example
cctc -g test.c
cctc --debug-info test.c
Related information
-
TOOL OPTIONS
Tool Options - Control Program 5-179
-I (--include-directory)
Command line syntax
-Ipath
--include-directory=path
Description
With this option you can specify the path where your include files are
located. A relative path will be relative to the current directory.
Example
Suppose that the C source file test.c contains the following lines:
#include <stdio.h>
#include "myinc.h"
First the compiler looks for the file stdio.h in the directory myinclude
relative to the current directory. If it was not found, the compiler searches
in the environment variable and then in the default include directory.
The compiler now looks for the file myinc.h in the directory where
test.c is located. If the file is not there the compiler searches in the
directory myinclude. If it was still not found, the compiler searches in the
environment variable and then in the default include directory.
Related information
Compiler option -I (Add directory to include file search path)
Compiler option -H (Include file at the start of a compilation)
• • • • • • • •
5-180 TriCore Reference Manual
--instantiate
Command line syntax
--instantiate=mode
Description
Normally, when a file is compiled, no template entities are instantiated
(except those assigned to the file by automatic instantiation). The overall
instantiation mode can, however, be changed with this option. You can
specify the following modes:
Example
To specify instantiation mode used, type
cctc --instantiate=used test.cc
Tool Options - Control Program 5-181
Related information
-
• • • • • • • •
5-182 TriCore Reference Manual
--instantiation-dir
Command line syntax
--instantiation-dir=dir
Description
With this option the C++ compiler generates additional files for template
instantiations in the specified directory.
If you do not specify this option, files are created in the current directory.
Example
To specify the directory for instantiation files, type
cctc --instantiation-dir=instant test.cc
Related information
Control program option --no-one-instantiation-per-object
TOOL OPTIONS
Tool Options - Control Program 5-183
--instantiation-file
Command line syntax
--instantiation-file=file
Description
With this option the C++ compiler generates a list of all generated template
instantiation files and writes it to the specified file. You can use this file for
example to use as an option file for the archiver artc.
Example
To create a file with a list of all generated instantiation files, type
cctc --instantiation-file=instlist.ii test.cc
Related information
-
• • • • • • • •
5-184 TriCore Reference Manual
--is-tricore2
Command line syntax
--is-tricore2
Description
With this option you allow the control program to use TriCore 2
instructions in the generated output file.
Example
To allow the use of TriCore 2 instructions in the assembly code, enter:
cctc --is-tricore2 test.c
Related information
Compiler option -C (Use SFR definitions for CPU)
TOOL OPTIONS
Tool Options - Control Program 5-185
--iso
Command line syntax
--iso={90|99}
Description
With this option you specify to the control program against which ISO
standard it should check your C source. C90 is also referred to as the
"ANSI C standard". C99 refers to the newer ISO/IEC 9899:1999 (E) standard
and is the default.
Independent of the chosen ISO standard, the control program always links
libraries with C99 support.
Example
To compile the file test.c conform the ISO C90 standard:
cctc --iso=90 test.c
Related information
Compiler option -c (ISO C standard)
• • • • • • • •
5-186 TriCore Reference Manual
-k (--keep-output-files)
Command line syntax
-k
--keep-output-files
Description
If an error occurs during the compilation, assembling or linking process,
the resulting output file may be incomplete or incorrect. With this option
you keep the generated output files when an error occurs.
Use this option when you still want to use the generated files. For
example when you know that a particular error does not result in a
corrupt file, or when you want to inspect the output file, or send it to
Altium support.
Example
cctc -k test.c
cctc --keep-output-files test.c
Related information
-
Tool Options - Control Program 5-187
-L (--library-directory /
--ignore-default-library-path)
Command line syntax
-Lpath
--library-directory=path
-L
--ignore-default-library-path
Description
With this option you can specify the path(s) where your system libraries,
specified with the -l option, are located. If you want to specify multiple
paths, use the option -L for each separate path.
The priority order in which the linker searches for system libraries
specified with the -l option is:
Example
Suppose you call the control program as follows:
cctc test.c -Lc:\mylibs -lcs
cctc test.c --library-directory=c:\mylibs -lcs
First the linker looks in the directory c:\mylibs for library libc.a (this
option).
• • • • • • • •
5-188 TriCore Reference Manual
If it does not find the requested libraries, it looks in the directory that is set
with the environment variables LIBTC1V1_2, LIBTC1V1_3 or LIBTC2.
Related information
Linker option -l (Search also in system library libname)
TOOL OPTIONS
Tool Options - Control Program 5-189
-l (--library)
Command line syntax
-lname
--library=name
Description
With this option you tell the linker via the control program to search also
in system library libname.a, where name is a string. The linker first
searches for system libraries in any directories specified with -Lpath, then
in the directories specified with the environment variables LIBTC1V1_2,
LIBTC1V1_3 or LIBTC2, unless you used the option -L without a directory.
Example
To search in the system library libfp.a (floating-point library):
cctc test.obj mylib.a -lfp
cctc test.obj mylib.a --library=fp
The linker links the file test.obj and first looks in mylib.a (in the
current directory only), then in the system library libfp.a to resolve
unresolved symbols.
Related information
Control program option -L (Add library directory)
• • • • • • • •
5-190 TriCore Reference Manual
--list-object-files
Command line syntax
--list-object-files
Description
With this option the list of object files that are handled by the prelinker, is
displayed at stdout. The list is shown when it is changed by the
prelinker.
Example
To show the list of object files handled by the prelinker, enter:
cctc --list-object-files test.cc
Related information
-
TOOL OPTIONS
Tool Options - Control Program 5-191
--mmu-present
Command line syntax
--mmu-present
Description
With this option you can use memory management instructions in the
assembly code. When you select this option, the define __MMU__ is set
to 1.
Example
To allow the use of memory management unit (MMU) instructions in the
assembly code, enter:
cctc --mmu-present test.c
Related information
Assembler option -C (Select CPU)
• • • • • • • •
5-192 TriCore Reference Manual
-n (--dry-run)
Command line syntax
-n
--dry-run
Description
With this option you put the control program verbose mode. The control
program prints the invocations of the tools it would use to process the
files.
Example
To see how the control program will invoke the tools it needs to process
the file test.c:
cctc -n test.c
cctc --dry-run test.c
The control program only displays the invocations of the tools it would
use to create the final object file but does not actually perform the steps.
Related information
Control program option -v (Verbose output)
TOOL OPTIONS
Tool Options - Control Program 5-193
--no-auto-instantiation
Command line syntax
--no-auto-instantiation
Description
Default, the c++ compiler automatically instantiates templates. With this
option automatic instantiation of templates is disabled.
Example
To disable automatic instantiation, type
cctc --no-auto-instantiation test.cc
Related information
For an extensive description of automatic insantiation, refer to section
2.6.1, Automatic Instantiation, in the TriCore C++ Compiler User's Manual.
• • • • • • • •
5-194 TriCore Reference Manual
--no-default-libraries
Command line syntax
--no-default-libraries
Description
Default the control program specifies the standard C libraries and run-time
library to the linker.
With this option you tell the control program not to specify the standard C
libraries and run-time library to the linker.
In this case you must specify the libraries you want to link to the linker
with the option -llibrary_name. The control program recognizes the
option -l as an option for the linker.
Example
cctc --no-default-libraries test.c
The control program does not specify any libraries to the linker. In normal
cases this would result in unresoved externals.
Related information
TOOL OPTIONS
--no-map-file
Command line syntax
--no-map-file
Description
By default the control program generates a linker map file (.map).
A linker map file is a text file that shows how the linker has mapped the
sections and symbols from the various object files (.obj) to the linked
object file. A locate part shows the absolute position of each section.
External symbols are listed per space with their absolute address, both
sorted on symbol and sorted on address.
Example
To prevent the generation of the linker map file test.map:
cctc --no-map-file test.c
Related information
Linker option -M (Generate map file)
• • • • • • • •
5-196 TriCore Reference Manual
--no-one-instantiation-per-object
Command line syntax
--no-one-instantiation-per-object
Description
With this option, the C++ compiler writes template instantiations into a
single object file. If you do not specify this option, the C++ compiler
creates multiple files. In that case you can specify a directory for those files
with the control program option --instantiation-dir.
Example
To create a file with a list of all generated instantiation files, type
cctc --no-one-instantiation-per-object test.cc
Related information
Control program option --instantiation-dir
TOOL OPTIONS
Tool Options - Control Program 5-197
--no-tasking-sfr
Command line syntax
--no-tasking-sfr
Description
Normally, the compiler and assembler include a special function register
(SFR) file before compiling. This file is automatically selected based on the
target you select on the Processor definition page of the Processor
options (compiler option -C).
With this option the compiler and assembler do not automatically include
a register file.
Use this option if you want to use your own set of SFR files.
Example
cctc -Ctc11ib --no-tasking-sfr test.c
Related information
Compiler option -C (Use SFR definitions for CPU)
• • • • • • • •
5-198 TriCore Reference Manual
-o (--output)
Command line syntax
-ofile
--output=file
Description
By default, the control program generates a file with the same basename
as the first specified input file. With this option you specify another name
for the resulting absolute object file.
Example
cctc test.c prog.c
Related information
-
TOOL OPTIONS
Tool Options - Control Program 5-199
--prelink-copy-if-non-local
Command line syntax
--prelink-copy-if-non-local
Description
If a file must be recompiled and it is not in the current directory, with this
option the C++ prelinker copies the prelink file (.ii) to the current
directory and rewrites that .ii file so it can find its associated .cc file. As a
result, the .cc file is recompiled in the current directory.
With this option you prevent that previously compiled files are overwritten
during recompilation.
Example
To copy all files for recompilation to the current directory:
cctc --prelink-copy-if-non-local test.cc
Related information
-
• • • • • • • •
5-200 TriCore Reference Manual
--prelink-local-only
Command line syntax
--prelink-local-only
Description
With this option the C++ prelinker ignores all files that are outside the
current directory.
Example
To prelink only files in the current directory:
cctc --prelink-local-only test.cc
Related information
-
TOOL OPTIONS
Tool Options - Control Program 5-201
--prelink-remove-instantiation-flags
Command line syntax
--prelink-remove-instantiation-flags
Description
With this option the C++ prelinker removes all instantiation flags from the
generated object files.
Example
To remove instantiation flags from the generated object files:
cctc --prelink-remove-instantiation-flags test.cc
Related information
-
• • • • • • • •
5-202 TriCore Reference Manual
--show-c++-warnings
Command line syntax
--show-c++-warnings
Description
The C++ compiler may generate a compiled C++ file (.ic) that causes
warnings during compilation or assembling. With this option you tell the
control program to show these warnings. Default C++ warnings are
suppressed.
Example
cctc --show-c++-warnings test.cc
The control program calls the C++ compiler which generates the C file
(test.ic). If this file causes warnings during compilation or assembling,
these warnings are shown.
Related information
-
TOOL OPTIONS
Tool Options - Control Program 5-203
--silicon-bug
EDE
1. From the Project menu, select Project Options...
• • • • • • • •
5-204 TriCore Reference Manual
Description
With this option the control program tells the compiler/assembler/linker to
use software workarounds for some CPU functional problems.
Example
cctc --silicon-bug=cpu5,cpu9 test.c
The compiler uses workarounds for TC113 problems CPU5 and CPU9.
Related information
See Chapter 9, CPU Functional Problems, for more information about the
individual problems and workarounds.
TOOL OPTIONS
Tool Options - Control Program 5-205
--space
Command line syntax
--space=space_name
Description
If you specify IHEX or SREC with the control option --format, you can
additionally specify the record length and the address space to be emitted
in the output files.
With this option you can specify which address space must be emitted.
With the argument space_name you can specify the name of the address
space. The name of the output file will be filename with the extension
.hex or .s.
Example
To create the IHEX file test.hex, type:
cctc --format=IHEX --space=far test.c
If the specified memory space does not exist, the control program emits
the default space name and reflects this in the output file name.
Related information
Control program option --format (Set linker output format)
• • • • • • • •
5-206 TriCore Reference Manual
--static
Command line syntax
--static
Description
This option is directly passed to the compiler.
With this option, the compiler treats external definitions at file scope
(except for main) as if they were declared static. As a result, unused
functions will be eliminated, and the alias checking algorithm assumes that
objects with static storage cannot be referenced from functions outside the
current module.
This option only makes sense when you specify all modules of an
application on the command line.
Example
cctc --static module1.c module2.c module3.c
Related information
-
TOOL OPTIONS
Tool Options - Control Program 5-207
-t (--keep-temporary-files)
Command line syntax
-t
--keep-temporary-files
Description
By default, the control program removes intermediate files like the .src
file (result of the compiler phase) and the .eln file (result of the linking
phase).
With this option you tell the control program to keep temporary files it
generates during the creation of the absolute object file.
Example
To keep all temporary files:
cctc -t test.c
cctc --keep-temporary-files test.c
The control program keeps all intermediate files it generates while creating
the absolute object file test.elf.
Related information
-
• • • • • • • •
5-208 TriCore Reference Manual
-U (--undefine)
Command line syntax
-Umacro_name
--undefine=macro_name
Description
With this option you can undefine an earlier defined macro as with
#undef.
Example
To undefine the predefined macro __TASKING__:
cctc -U__TASKING__ test.c
TOOL OPTIONS
Related information
Control Pogram option -D (Define preprocessor macro)
Tool Options - Control Program 5-209
-V (--version)
Command line syntax
-V
--version
Description
Display version information. The control program ignores all other options
or input files.
Example
cctc -V
cctc --version
The control program does not call any tools but displays the following
version information:
TASKING TriCore VX-toolset control program vx.yrz Build nnn
Copyright 2003-year Altium BV Serial# 00000000
Related information
-
• • • • • • • •
5-210 TriCore Reference Manual
-v (--verbose)
Command line syntax
-v
--verbose
Description
With this option you put the control program in verbose mode. With the
option -v the control program performs it tasks while it prints the steps it
performs to stdout.
Example
cctc -v test.c
cctc --verbose test.c
The control program processes the file test.c and displays the
invocations of the tools it uses to create the final object file
Related information
Control program option -n (Verbose output and suppress execution)
TOOL OPTIONS
Tool Options - Control Program 5-211
-Wtool (--pass)
Command line syntax
Description
With this option you tell the control program to call a tool with the
specified option. The control program does not use the option itself, but
specifies it directly to the tool which the control program calls.
Example
cctc -Wl-r test.c
The control program does not use the option -r but calls the linker with
the option -r (ltc -r).
Related information
-
• • • • • • • •
5-212 TriCore Reference Manual
-w (--no-warnings)
Command line syntax
-w[nr]
--no-warnings[=nr]
Description
With this option suppresses all warning messages or a specific warning. If
you do not specify this option, all warnings are reported.
Example
To suppress all warnings:
cctc -w test.c
cctc --no-warnings test.c
Related information
Control program option --warnings-as-errors (Warnings as errors)
TOOL OPTIONS
Tool Options - Control Program 5-213
--warnings-as-errors
Command line syntax
--warnings-as-errors
Description
With this option you tell the control program to treat warnings as errors.
Example
cctc --warnings-as-errors test.c
Related information
Control program option -w (Suppress all warnings)
• • • • • • • •
5-214 TriCore Reference Manual
This section describes all options for the make utility. The make utility is a
command line tool so there are no equivalent options in EDE.
TOOL OPTIONS
Tool Options - Make Utility 5-215
Defining Macros
Command line syntax
macro=definition
Description
With this argument you can define a macro and specify it to the make
utility.
You can specify as many macros as you like. If the command line exceeds
the limit of the operating system, you can define the macros in an option
file which you then must specify to the compiler with the option -m file.
Example
Consider the following makefile with conditional rules to build a demo
program and a real program:
ifdef DEMO # the value of DEMO is of no importance
real.out : demo.o
ltc demo.o main.o -lc -lfp -lrt
else
real.out : real.o
ltc real.o main.o -lc -lfp -lrt
endif
real.elf : real.out
ltc -FELF -oreal.elf real.out
You can now use a macro definition to set the DEMO flag:
mktc real.elf DEMO=1
In both cases the absolute obect file real.elf is created but depending
on the DEMO flag it is linked with demo.o or with real.o.
• • • • • • • •
5-216 TriCore Reference Manual
Related information
Make utility option -e (Environment variables override macro definitions)
Make utility option -m (Name of invocation file)
TOOL OPTIONS
Tool Options - Make Utility 5-217
-?
Command line syntax
-?
Description
Displays an overview of all command line options.
Example
The following invocation displays a list of the available command line
options:
mktc -?
Related information
-
• • • • • • • •
5-218 TriCore Reference Manual
-a
Command line syntax
-a
Description
Normally the make utility rebuilds only those files that are out of date.
With this option you tell the make utility to rebuild all files, without
checking whether they are out of date.
Example
mktc -a
Rebuilds all your files, regardless of whether they are out of date or not.
Related information
-
TOOL OPTIONS
Tool Options - Make Utility 5-219
-c
Command line syntax
-c
Description
EDE uses this option for the graphical version of make when you create
sub-projects. In this case make calls another instance of make for the
sub-project. With the option -c, the make utility runs as a child process of
the current make.
Example
The following command runs the make utility as a child process:
mktc -c
Related information
Make utility option -err (Redirect error message to file)
• • • • • • • •
5-220 TriCore Reference Manual
-D/-DD
Command line syntax
-D
-DD
Description
With the option -D the make utility prints every line of the makefile to
standard output as it is read by mktc.
With the option -DD not only the lines of the makefile are printed but
also the lines of the mktc.mk file (implicit rules).
Example
mktc -D
Each line of the makefile that is read by the make utility is printed to
standard output (usually your screen).
Related information
-
TOOL OPTIONS
Tool Options - Make Utility 5-221
-d/-dd
Command line syntax
-d
-dd
Description
With the option -d the make utility shows which files are out of date and
thus need to be rebuild. The option -dd gives more detail than the option
-d.
Example
mktc -d
Related information
-
• • • • • • • •
5-222 TriCore Reference Manual
-e
Command line syntax
-e
Description
If you use macro definitions, they may overrule the settings of the
environment variables.
With the option -e, the settings of the environment variables are used
even if macros define otherwise.
Example
mktc -e
The make utility uses the settings of the environment variables regardless
of macro definitions.
Related information
-
TOOL OPTIONS
Tool Options - Make Utility 5-223
-err
Command line syntax
-err file
Description
With this option the make utility redirects error messages and verbose
messages to a specified file.
With the option -s the make utility only displays error messages.
Example
mktc -err error.txt
Related information
Make utility option -s (Do not print commands before execution)
• • • • • • • •
5-224 TriCore Reference Manual
-f
Command line syntax
-f my_makefile
Description
Default the make utility uses the file makefile to build your files.
With this option you tell the make utility to use the specified file instead of
the file makefile. Multiple -f options act as if all the makefiles were
concatenated in a left-to-right order.
Example
mktc mymake
The make utility uses the file mymake to build your files.
Related information
-
TOOL OPTIONS
Tool Options - Make Utility 5-225
-G
Command line syntax
-G path
Description
Normally you must call the make utility mktc from the directory where
your makefile and other files are stored.
With the option -G you can call the make utility from within another
directory. The path is the path to the directory where your makefile and
other files are stored and can be absolute or relative to your current
directory.
Example
Suppose your makefile and other files are stored in the directory
\currdir\myfiles . When your current directory is \currdir, you can
call the make utility as follows:
mktc -G myfiles
Related information
-
• • • • • • • •
5-226 TriCore Reference Manual
-i
Command line syntax
-i
Description
When an error occurs during the make process, the make utility exits with
a certain exit code.
With the option -i, the make utility exits without an error code, even
when errors occurred.
Example
mktc -i
The make utility exits without an error code, even when an error occurs.
Related information
-
TOOL OPTIONS
Tool Options - Make Utility 5-227
-K
Command line syntax
-K
Description
With this option the make utility keeps temporary files it creates during the
make process. The make utility stores temporary files in the directory that
you have specified with the environment variable TMPDIR or in the
default 'temp' directory of your system when the TMPDIR variable is not
specified.
Example
mktc -K
Related information
Section 1.3.2, Configuring the Command Line Environment, in Chapter
Software Installation of the User's Manual.
• • • • • • • •
5-228 TriCore Reference Manual
-k
Command line syntax
-k
Description
When during the make process the make utility encounters an error, it
stops rebuilding your files.
With the option -k, the make utility only stops building the target that
produced the error. All other targets defined in the makefile are built.
Example
mktc -k
If the make utility encounters an error, it stops building the current target
but proceeds with the other targets that are defined in the makefile.
Related information
Make utility option -S (Undo the effect of -k)
TOOL OPTIONS
Tool Options - Make Utility 5-229
-m
Command line syntax
-m file
Description
Instead of typing all options on the command line, you can create an
option file which contains all options and flags you want to specify. With
this option you specify the option file to the make utility.
Use an option file when the length of the command line would exceed the
limits of the operating system, or just to store options and save typing.
• • • • • • • •
5-230 TriCore Reference Manual
Example
Suppose the file myoptions contains the following lines:
-k
-err errors.txt
test.elf
Related information
-
TOOL OPTIONS
Tool Options - Make Utility 5-231
-n
Command line syntax
-n
Description
With this option you tell the make utility to perform a dry run. The make
utility shows what it would do but does not actually perform these tasks.
This option is for example useful to quickly inspect what would happen if
you call the make utility.
Example
mktc -n
The make utility does not perform any tasks but displays what it would do
if called without the option -n.
Related information
Make utility option -s (Do not print commands before execution)
• • • • • • • •
5-232 TriCore Reference Manual
-p
Command line syntax
-p
Description
Normally, if a command in a target rule in a makefile returns an error or
when the target construction is interrupted, the make utility removes that
target file. With this option you tell the make utility to make all target files
precious. This means that all dependency files are never removed.
Example
mktc -p
Related information
Special target .PRECIOUS in section 8.3.2, Writing a Makefile in Chapter
Using the Utilities of the Reference Manual.
TOOL OPTIONS
Tool Options - Make Utility 5-233
-q
Command line syntax
-q
Description
With this option the make utility does not perform any tasks but only
returns an error code. A zero status indicates that all target files are up to
date, a non-zero status indicates that some or all target files are out of
date.
Example
mktc -q
The make utility only returns an error code that indicates whether all target
files are up to date or not. It does not rebuild any files.
Related information
-
• • • • • • • •
5-234 TriCore Reference Manual
-r
Command line syntax
-r
Description
When you call the make utility, it first reads the implicit rules from the file
mktc.mk, then it reads the makefile with the rules to build your files. (The
file mktc.mk is located in the \etc directory of the TriCore toolchain.)
With this option you tell the make utility not to read mktc.mk and to rely
fully on the make rules in the makefile.
Example
mktc -r
The make utility does not read the implicit make rules in mktc.mk.
Related information
-
TOOL OPTIONS
Tool Options - Make Utility 5-235
-S
Command line syntax
-S
Description
With this option you cancel the effect of the option -k. This is never
necessary except in a recursive make where the option -k might be
inherited from the top-level make via MAKEFLAGS or if you set the option
-k in the environment variable MAKEFLAGS.
Example
mktc -S
The effect of the option -k is cancelled so the make utility stops with the
make process after it encounters an error.
The option -k in this example may have been set with the environment
variable MAKEFLAGS or in a recursive call to mktc in the makefile.
Related information
Make utility option -k (On error, abandon the work for the current target
only)
• • • • • • • •
5-236 TriCore Reference Manual
-s
Command line syntax
-s
Description
With this option you tell the make utility to perform its tasks without
printing the commands it executes. Error messages are normally printed.
Example
mktc -s
The make utility rebuilds your files but does not print the commands it
executes during the make process.
Related information
Make utility option -n (Perform a dry run)
TOOL OPTIONS
Tool Options - Make Utility 5-237
-t
Command line syntax
-t
Description
With this option you tell the make utility to touch the target files, bringing
them up to date, rather than performing the rules to rebuild them.
Example
mktc -t
The make utility updates out-of-date files by giving them a new date and
time stamp. The files are not actually rebuild.
Related information
-
• • • • • • • •
5-238 TriCore Reference Manual
-time
Command line syntax
-time
Description
With this option you tell the make utility to display the current date and
time on standard output.
Example
mktc -time
The make utility displays the current date and time and updates
out-of-date files.
Related information
-
TOOL OPTIONS
Tool Options - Make Utility 5-239
-V
Command line syntax
-V
Description
Display version information. The make utility ignores all other options or
input files.
Example
mktc -v
The make utility does not perform any tasks but displays the following
version information:
TASKING TriCore VX-toolset program builder vxx.yrz Build nnn
Copyright year Altium BV Serial# 00000000
Related information
-
• • • • • • • •
5-240 TriCore Reference Manual
-W
Command line syntax
-W target
Description
With this option the make utility considers the specified target file always
as up to date and will not rebuild it.
Example
mktc -W test.elf
The make utility rebuilds out of date targets in the makefile except the file
test.elf which is considered now as up to date.
Related information
-
TOOL OPTIONS
Tool Options - Make Utility 5-241
-w
Command line syntax
-w
Description
With this option the make utility sends error messages and verbose
messages to standard out. Without this option, the make utility sends these
messages to standard error.
Example
mktc -w
The make utility sends messages to standard out instead of standard error.
Related information
-
• • • • • • • •
5-242 TriCore Reference Manual
-x
Command line syntax
-x
Description
With this option the make utility shows extended error messages.
Extended error messages give more detailed information about the exit
status of the make utility after errors. EDE uses this option for the
graphical version of make.
Example
mktc -x
Related information
-
TOOL OPTIONS
Tool Options - Archiver 5-243
This section describes all options for the archiver. Some suboptions can
only be used in combination with certain key options. They are described
together. Suboptions that can always be used are described separately.
• • • • • • • •
5-244 TriCore Reference Manual
-?
Command line syntax
-?
Description
Displays an overview of all command line options.
Example
The following invocations display a list of the available command line
options:
artc -?
artc
Related information
-
TOOL OPTIONS
Tool Options - Archiver 5-245
-d
Command line syntax
-d [-v]
Description
Delete the specified object modules from a library. With the suboption -v
the archiver shows which files are removed.
Example
artc -d lib.a obj1.o obj2.o
The archiver deletes obj1.o and obj2.o from the library lib.a.
artc -d -v lib.a obj1.o obj2.o
The archiver deletes obj1.o and obj2.o from the library lib.a and
displays which files are removed.
Related information
-
• • • • • • • •
5-246 TriCore Reference Manual
-m
Command line syntax
-m [-a posname] [-b posname]
Description
Move the specified object modules to another position in the library.
Default, the specified members are moved to the end of the archive. Use
the suboptions -a or -b to move them to a specified place instead.
Example
Suppose the library lib.a contains the following objects (see option -t):
obj1.o
obj2.o
obj3.o
The library lib.a after these two invocations now looks like:
obj3.o
obj2.o
obj1.o
Related information
Archiver option -t (Print library contents)
Tool Options - Archiver 5-247
-p
Command line syntax
-p
Description
Print the specified object module(s) in the library to standard output.
This option is only useful when you redirect or pipe the output to other
files or tools that serve your own purposes. Normally you do not need this
option.
Example
artc -p lib.a obj1.o > file.o
Related information
-
• • • • • • • •
5-248 TriCore Reference Manual
-r
Command line syntax
-r [-a posname] [-b posname] [-c] [-u] [-v]
Description
You can use the option -r for several purposes:
• Adding new objects to the library
• Replacing objects in the library with the same object of a newer date
• Creating a new library
The option -r normally adds a new module to the library. However, if the
library already contains a module with the specified name, the existing
module is replaced. If you specify a library that does not exist, the archiver
creates a new library with the specified name.
Examples
Suppose the library lib.a contains the following objects (see option -t):
obj1.o
The library lib.a after these two invocations now looks like:
obj1.o
obj3.o
obj2.o
The archiver creates the library newlib.a and adds the object obj1.o to
it.
To create a new library file and overwrite an existing library, add an object
file and specify an existing library with the supoption -c:
artc -r -c obj1.o lib.a
The archiver overwrites the library lib.a and adds the object obj1.o to
it. The new library lib.a only contains obj1.o.
Related information
Archiver option -t (Print library contents)
• • • • • • • •
5-250 TriCore Reference Manual
-t
Command line syntax
-t [-s0|-s1]
Description
Print a table of contents of the library to standard out. With the
suboption -s you the archiver displays all symbols per object file.
Example
artc -t lib.a
The archiver prints a list of all object modules in the library lib.a.
artc -t -s0 lib.a
The archiver prints per object all symbols in the library. This looks like:
prolog.o
symbols:
lib.a:prolog.o:___Qabi_callee_save
lib.a:prolog.o:___Qabi_callee_restore
TOOL OPTIONS
div16.o
symbols:
lib.a:div16.o:___udiv16
lib.a:div16.o:___div16
lib.a:div16.o:___urem16
lib.a:div16.o:___rem16
Related information
-
Tool Options - Archiver 5-251
-V
Command line syntax
-V
Description
Display version information. The archiver ignores all other options or
input files.
Example
artc -V
The archiver does not perform any tasks but displays the following version
information:
TASKING TriCore VX-toolset ELF archiver vxx.yrz Build nnn
Copyright year Altium BV Serial# 00000000
Related information
-
• • • • • • • •
5-252 TriCore Reference Manual
-x
Command line syntax
-x [-o] [-v]
Description
Extract an existing module from the library.
Example
To extract the file obj.o from the library lib.a:
artc -x lib.a obj1.o
If you do not specify an object module, all object modules are extracted:
artc -x lib.a
Related information
-
TOOL OPTIONS
Tool Options - Archiver 5-253
-w
Command line syntax
-wlevel
Description
With this suboption you tell the archiver to suppress all warnings above
the specified level. The level is a number between 0 - 9.
Example
To suppresses warnings above level 5:
artc -x -w5 lib.a obj1.o
Related information
-
• • • • • • • •
5-254 TriCore Reference Manual
TOOL OPTIONS
CHAPTER
6
6-2 TriCore Reference Manual
CHAPTER
6
LIST FILE FORMATS
List File Formats 6-3
Page header
The page header consists of four lines:
TASKING TriCore VX-toolset Assembler vx.yrz Build nnn SN 00000000
This is the page header title Page 1
The first line contains information about the assembler name, version
number and serial number. The second line contains a title specified by
the TITLE (first page) assembler directive and a page number. The third
line is empty. The fourth line contains the heading of the source listing.
Source listing
The following is a sample part of a listing. An explanation of the different
columns follows below.
ADDR CODE CYCLES LINE SOURCE LINE
.
.
0002 85rFrrrr 1 2 27 ld.a a15,world
0006 F4AF 1 3 28 st16.a [a10],a15
0008 91r0rr4r 1 4 29 movh.a a4,#@his(_2_ini)
000C D944rrrr 1 5 30 lea a4,[a4]@los(_2_ini)
0010 1Drrrrrr 1 6 31 j printf
.
.
0000 44 buf: .space 4
| RESERVED
0003
• • • • • • • •
6-4 TriCore Reference Manual
SOURCE LINE This column contains the source text. This is a copy of
the source line from the assembly source file.
For the .SET and .EQU directives the ADDR and CODE columns do not
apply. The symbol value is listed instead.
LIST FILE FORMATS
Related information
See section 6.6, Generating a List File, in Chapter Using the Assembler of
the User's Manual for more information on how to generate a list file and
specify the amount of list file information.
List File Formats 6-5
With the linker option -m (map file formatting) you can specify which
parts of the map file you want to see.
* Processed files:
==================
* Section translation:
======================
[in] File | [in] Section | [in] Size | [out] Offset | [out] Section
---------------------------------------------------------------------------------------
hello.o | .text.hello.main | 0x00000014 | 0x00000000 | .text.hello.main
---------------------------------------------------------------------------------------
cstart.o | .text.libc | 0x000001fc | 0x00000000 | .text.libc
strcpy.o | .text.libc | 0x00000024 | 0x000001fc |
printf.o | .text.libc | 0x00000024 | 0x00000700 |
cinit.o | .text.libc | 0x0000004e | 0x00000d68 |
---------------------------------------------------------------------------------------
cstart.o | .text.libc.reset | 0x00000008 | 0x00000000 | .text.libc.reset
• • • • • • • •
6-6 TriCore Reference Manual
+ File "hello.o"
+ Scope "./hello.o"
* Defined symbols:
==================
* Undefined symbols:
====================
Symbol | Referenced in
---------------------------------------------------------------------------------------
_LITERAL_DATA_ | cstart.o
_SMALL_DATA_ | cstart.o
_lc_cp | cinit.o
symbol : _START
absolute: 0xa0000000
* Section translation:
======================
+ Space spe:tc:abs18
+ Space spe:tc:csa
+ Space spe:tc:linear
• • • • • • • •
6-8 TriCore Reference Manual
------------------------------------------------------------------------------------
spe:tc:abs18 | unrestricted | | .zrodata.hello..1.ini
spe:tc:abs18 | clustered | gaps(protected, not filled) | .zdata.hello.world
spe:tc:linear | post-action | ballooning | istack ustack
spe:tc:linear | absolute | 0xa0004000 | .text.libc
File Part
This part of the map file shows all processed files. This also includes
object files that are extracted from a library, with the symbol that led to the
extraction
By default this part is not shown in the map file. You have to turn this part
on manually with linker option -mc (call graph info).
List File Formats 6-9
[out] Offset The offset relative to the start of the output section.
By default this part is not shown in the map file. You have to turn this part
on manually with linker option -mq (module local symbols).
By default this part is not shown in the map file. You have to turn this part
on manually with linker option -mr (cross references info).
Overlay Part
This part of the map file shows how the static stack is organized. This part
is empty for the TriCore. This part also shows the locate overlay
information if you used overlay groups in the linker script file.
By default this part is not shown in the map file. You have to turn this part
on manually with linker option -mo (overlay info).
• • • • • • • •
6-10 TriCore Reference Manual
Chip addr The absolute offset of the section from the start of a
memory chip.
Memory Part
This part of the map file shows the memory usage in totals and
percentages for spaces and chips. The largest free block of memory per
space and per chip is also shown.
By default this part is not shown in the map file. You have to turn this part
on manually with linker option -mm (memory usage info).
By default this part is not shown in the map file. You have to turn this part
on manually with linker option -ms (processor and memory info). You
can print this information to a separate file with linker option
--lsl-dump.
• • • • • • • •
6-12 TriCore Reference Manual
By default this part is not shown in the map file. You have to turn this part
on manually with linker option -mu (locate rules).
Related information
Section 7.9, Generating a Map File, in Chapter Using the Linker of the
User's Manual.
LIST FILE FORMATS
7
7-2 TriCore Reference Manual
CHAPTER
7
OBJECT FORMATS
Object File Formats 7-3
The ELF/DWARF 2 Object Format for the TriCore toolchain follows the
convention as described in the TriCore Embedded Application Binary
Interface [2000, Infineon].
For a complete description of the ELF and DWARF formats, please refer to
the Tool Interface Standard (TIS).
• • • • • • • •
7-4 TriCore Reference Manual
S0 - record
'S' '0' <length_byte> <2 bytes 0> <comment> <checksum_byte>
A linker generated S-record file starts with a S0 record with the following
contents:
length_byte : 0x6
comment : ltc (TriCore linker)
checksum : 0xB6
l t c
S00600006C7463B6
S1 - record
With the linker option -ofilename:SREC:2, the actual program code and
data is supplied with S1 records, with the following layout:
Example:
S1130250F03EF04DF0ACE8A408A2A013EDFCDB00E6
| | | |_ checksum
| | |_ code
| |_ address
|_ length
The linker has an option that controls the length of the output buffer for
generating S1 records. The default buffer length is 32 code bytes.
S2 - record
With the linker option -ofilename:SREC:3, which is the default, the actual
program code and data is supplied with S2 records, with the following
layout:
Example:
S213FF002000232222754E00754F04AF4FAE4E22BF
| | | |_ checksum
| | |_ code
| |_ address
|_ length
The linker has an option that controls the length of the output buffer for
generating S2 records. The default buffer length is 32 code bytes.
S3 - record
With the linker option -ofilename:SREC:4, the actual program code and
data is supplied with S3 records, with the following layout:
• • • • • • • •
7-6 TriCore Reference Manual
Example:
S3070000FFFE6E6825
| | | |_ checksum
| | |_ code
| |_ address
|_ length
The linker has an option that controls the length of the output buffer for
generating S3 records.
S7 - record
With the linker option -ofilename:SREC:4, at the end of an S-record file,
the linker generates an S7 record, which contains the program start
address. S7 is the corresponding termination record for S3 records.
Layout:
Example:
S70500006E6824
| | |_checksum
OBJECT FORMATS
| |_ address
|_ length
S8 - record
With the linker option -ofilename:SREC:3, which is the default, at the end
of an S-record file, the linker generates an S8 record, which contains the
program start address.
Layout:
Example:
S804FF0003F9
| | |_checksum
| |_ address
|_ length
Object File Formats 7-7
S9 - record
With the linker option -ofilename:SREC:4, at the end of an S-record file,
the linker generates an S9 record, which contains the program start
address. S9 is the corresponding termination record for S1 records.
Layout:
Example:
S9030210EA
| | |_checksum
| |_ address
|_ length
• • • • • • • •
7-8 TriCore Reference Manual
ÁÁÁ
ÁÁÁÁ
ÁÁÁÁ
ÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁ
ÁÁÁÁ
ÁÁÁ
:
ÁÁÁÁ
ÁÁÁÁ ÁÁÁ
ÁÁÁÁ ÁÁÁÁÁ
ÁÁÁ ÁÁÁÁÁ
length
ÁÁÁÁÁ
ÁÁÁÁÁ
offset type content checksum
OBJECT FORMATS
Where:
type is the record type. This value occupies one byte (two
hexadecimal digits). The record types are:
Object File Formats 7-9
ÁÁÁ
ÁÁÁ
ÁÁÁÁ
ÁÁÁ
ÁÁÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁ
ÁÁÁ
ÁÁÁ ÁÁÁÁ
ÁÁÁ
:
ÁÁÁ
ÁÁÁÁ ÁÁÁÁÁÁÁ
ÁÁÁ ÁÁÁÁÁ
ÁÁÁÁÁÁÁ
02
ÁÁÁÁÁ
0000 04 upper_address checksum
where:
address is the base address, where the two most significant bytes are
the upper_address and the two least significant bytes are
zero.
index is the index of the data byte within the Data Record (0 for
the first byte).
• • • • • • • •
7-10 TriCore Reference Manual
Example:
:0200000400FFFB
| | | | |_ checksum
| | | |_ upper_address
| | |_ type
| |_ offset
|_ length
Data Record
The Data Record specifies the actual program code and data.
ÁÁÁ
ÁÁÁÁ
ÁÁÁÁ
ÁÁÁ
ÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁ
ÁÁÁÁ
ÁÁÁ
: ÁÁÁÁ
ÁÁÁÁ ÁÁÁ
ÁÁÁÁ ÁÁÁÁ
ÁÁÁ ÁÁÁÁÁ
ÁÁÁÁ
ÁÁÁÁÁ
length offset 00 data checksum
The length byte specifies the number of data bytes. The linker has an
option that controls the length of the output buffer for generating Data
records. The default buffer length is 32 bytes.
The offset is the 16-bit starting load offset. Together with the address
specified in the Extended Address Record it specifies an absolute address
in memory where the data is to be located when loaded by a tool.
Example:
OBJECT FORMATS
:0F00200000232222754E00754F04AF4FAE4E22C3
| | | | |_ checksum
| | | |_ data
| | |_ type
| |_ offset
|_ length
Object File Formats 7-11
Layout:
ÁÁÁ
ÁÁÁ
ÁÁÁÁ
ÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁ
ÁÁÁ
ÁÁÁ ÁÁÁÁ
ÁÁÁ
:
ÁÁÁ
ÁÁÁÁ ÁÁÁÁÁ
ÁÁÁ ÁÁÁÁÁ
04
ÁÁÁÁÁ
ÁÁÁÁÁ
0000 05 address checksum
Example:
:0400000500FF0003F5
| | | | |_ checksum
| | | |_ address
| | |_ type
| |_ offset
|_ length
• • • • • • • •
7-12 TriCore Reference Manual
OBJECT FORMATS
CHAPTER
LINKER SCRIPT
LANGUAGE
8
8-2
LINKER SCRIPT LANGUAGE
8
CHAPTER
TriCore Reference Manual
Linker Script Language 8-3
8.1 INTRODUCTION
To make full use of the linker, you can write a script with information
about the architecture of the target processor and locating information.
The language for the script is called the Linker Script Language (LSL). This
chapter first describes the structure of an LSL file. The next section
contains a summary of the LSL syntax. Finally, in the remaining sections,
the semantics of the Linker Script Language is explained.
LSL serves two purposes. First it enables you to specify the characteristics
(that are of interest to the linker) of your specific target board and of the
cores installed on the board. Second it enables you to specify how
sections should be located in memory.
• • • • • • • •
8-4 TriCore Reference Manual
is not (yet) supported by the TASKING tools, you may have to write a
derivative definition.
When you want to use multiple cores of the same type, you must
instantiate the cores in a derivative definition, since the linker
automatically instantiates only a single core for an unused architecture.
See section 8.7.3, Defining External Memory and Buses, for more
information on how to specify the external physical memory layout.
Internal memory for a processor should be defined in the derivative
definition for that processor.
Which object files (sections) constitute the task that will run on a given
core is specified on the command line when you invoke the linker. The
linker will link and locate all sections of all tasks simultaneously. From the
section layout definition the linker can deduce where a given section may
be located in memory, form the board specification the linker can deduce
which physical memory is (still) available while locating the section.
See section 8.8, Semantics of the Section Layout Definition,, for more
information on how to locate a section at a specific place in memory.
• • • • • • • •
8-6 TriCore Reference Manual
derivative derivative_name
{
derivative definition
}
processor processor_name
{
processor definition
}
section_layout space_name
{
section placement statements
}
LINKER SCRIPT LANGUAGE
8.3.1 PREPROCESSING
When the linker loads an LSL file, the linker processes it with a C-style
prepocessor. As such, it strips C and C++ comments. You can use the
standard ISO C preprocessor directives, such as #include, #define,
#if/#else/#endif .
For example:
#include "arch.lsl"
Preprocess and include the file arch.lsl at this point in the LSL file.
Linker Script Language 8-7
A ::= B = A is defined as B
A ::= B C = A is defined as B and C; B is followed by C
A ::= B | C = A is defined as B or C
<B>0|1 = zero or one occurrence of B
<B>>=0 = zero of more occurrences of B
<B>>=1 = one of more occurrences of B
Characters in bold are characters that occur literally. Words in italics are
higher order terms that are defined in the same or in one of the other
sections.
To write comments in LSL file, you can use the C style '/* */' or C++
style '//'.
8.3.3 IDENTIFIERS
arch_name ::= IDENTIFIER
bus_name ::= IDENTIFIER
core_name ::= IDENTIFIER
derivative_name ::= IDENTIFIER
file_name ::= DQSTRING
group_name ::= IDENTIFIER
mem_name ::= IDENTIFIER
proc_name ::= IDENTIFIER
section_name ::= DQSTRING
space_name ::= IDENTIFIER
stack_name ::= section_name
symbol_name ::= DQSTRING
• • • • • • • •
8-8 TriCore Reference Manual
8.3.4 EXPRESSIONS
The expressions and operators in this section work the same as in ANSI C.
number ::= OCT_NUM
| DEC_NUM
| HEX_NUM
| ~ // bitwise complement
| - // negative value
absolute()
addressof()
• • • • • • • •
8-10 TriCore Reference Manual
exists()
To check whether the section mysection exists in one of the object files
that is specified to the linker:
exists( "mysection" )
max()
LINKER SCRIPT LANGUAGE
Returns the value of the expression that has the largest value. To get the
highest value of two symbols:
max( "sym1" , "sym2")
min()
Returns the value of the expression hat has the smallest value. To get the
lowest value of two symbols:
min( "sym1" , "sym2")
sizeof()
Returns the size of the object (group, section or memory) the identifier
refers to. To get the size of the section "asection":
sizeof( sect: "asection" )
The group and sect arguments only works in assignments. The mem
argument can be used anywhere in section layouts.
Linker Script Language 8-11
• • • • • • • •
8-12 TriCore Reference Manual
• • • • • • • •
8-14 TriCore Reference Manual
• • • • • • • •
8-16 TriCore Reference Manual
simple_section_statement
::= assignment
| select_section_statement
| special_section_statement
assign_op ::= =
| :=
select_section_statement
::= select <section_name>0|1
<section_selections>0|1
• Either a section_name or at least one section_selection must
be defined.
section_selections
::= ( section_selection
<, section_selection>>=0 )
section_selection
::= attributes = < <+|-> attribute>>0
• +attribute means: select all sections that have this attribute.
• -attribute means: select all sections that do not have this
attribute.
• • • • • • • •
8-18 TriCore Reference Manual
special_section_statement
::= heap stack_name <size_spec>0|1
| stack stack_name <size_spec>0|1
| copytable
| reserved <section_name>0|1
<reserved_specs>0|1
• Special sections cannot be selected in load-time groups.
size_spec ::= ( size = expr )
| alloc_allowed = absolute
• If a reserved section has attributes r, rw, x, rx or rwx, and no fill
pattern is defined, the section is filled with zeros. If no attributes are
set, the section is created as a scratch section (attributes ws, no
image).
aggregate_section_statement
::= { <section_statement>>=0 }
| group_descr
| if_statement
| section_creation_statement
group_load_address
::= load_addr <= load_or_run_addr>0|1
• • • • • • • •
8-20 TriCore Reference Manual
section_creation_statement
::= section section_name
( <section_spec>0|1 )
{ <select_section_statement ;>>=0 }
LINKER SCRIPT LANGUAGE
All expressions are evaluated with 64-bit precision integer arithmetic. The
result of an expression can be absolute or relocatable. A symbol you
assign is created as an absolute symbol.
Linker Script Language 8-21
map
dest bus space
dest_dbits
dest_offset
size
src_dbits
src_offset
• • • • • • • •
8-22 TriCore Reference Manual
• • • • • • • •
8-24 TriCore Reference Manual
• The page_size field sets the page size in MAUs for the address space.
It must be a power of 2. The default page size is 1. See also the page
keyword in subsection Locating a group in section 8.8.2, Creating and
Locating Groups of Sections.
• The map keyword specifies how this address space maps onto an
internal bus or onto another address space. Mappings are described in
section 8.5.4, Mappings.
direction in which the stack grows (grows). This can be either from
low_to_high addresses (stack grows upwards, this is the default) or
from high_to_low addresses (stack grows downwards). The
min_size is required.
By default, the linker tries to maximize the size of the stacks and heaps.
After locating all sections, the largest remaining gap in the space is
used completely for the stacks and heaps. If you specify the keyword
fixed, you can disable this so-called 'balloon behavior'. The size is
also fixed if you used a stack or heap in the software layout definition
in a restricted way. For example when you override a stack with
another size or select a stack in an ordered group with other sections.
Optionally you can specify an alignment for the stack with the
argument align. This alignment must be equal or larger than the
alignment that you specify for the address space itself.
• The heap keyword defines a heap in the address space and assigns a
name to it. The definition of a heap is similar to the definition of a
stack. See also the heap keyword in section 8.8.3, Creating or
Modifying Special Sections.
Copy tables
• The copytable keyword defines a copy table in the address space.
The content of the copy table is created by the linker and contains the
start address and size of all sections that should be initialized by the
startup code. If the architecture definition contains more than one
address space, you must define exactly one copy table in one of the
address spaces. If the architecture definition contains only one address
space, the copy table definition is optional.
Optionally you can specify an alignment for the copy table with the
argument align. This alignment must be equal or larger than the
alignment that you specify for the address space itself. If smaller, the
alignment for the address space is used.
The dest argument specifies the destination address space that the
code uses for the copy table. The linker uses this information to
generate the correct addresses in the copy table. The memory into
where the sections must be copied at run-time, must be accessible
from this destination space.
Start address
• The start_address keyword specifies the start address for the
position where the C startup code is located. When a processor is reset,
it initializes its program counter to a certain start address, sometimes
called the reset vector. In the architecture definition, you must specify
this start address in the correct address space in combination with the
name of the label in the application code which must be located here.
The run_addr argument specifies the start address (reset vector). If the
core starts executing using an entry from a vector table, and directly
jumps to the start label, you should omit this argument.
• • • • • • • •
8-26 TriCore Reference Manual
space space_name
{
id = 1;
mau = 8;
align = 8;
page_size = 1;
stack name (min_size = 1k, grows = low_to_high);
start_address ( run_addr = 0x0000,
symbol = "start_label" )
map ( map_description );
}
8.5.4 MAPPINGS
You can use a mapping when you define a space, bus or memory. With
LINKER SCRIPT LANGUAGE
the map field you specify how addresses from the source (space, bus or
memory) are translated to addresses of a destination (space, bus). The
following mappings are possible:
• space => space
• space => bus
• bus => bus
• memory => bus
With a mapping you specify a range of source addresses you want to map
(specified by a source offset and a size), the destination to which you
want to map them (a bus or another address space), and the offset address
in the destination.
• The dest argument specifies the destination. This can be a bus or
another address space (only for a space to space mapping). This
argument is required.
• The src_offset argument specifies the offset of the source addresses.
In combination with size, this specifies the range of address that are
mapped. Default the source offset is 0x0000.
• The size argument specifies the number of addresses that are
mapped. This argument is required.
• The dest_offset argument specifies the position in the destination to
which the specified range of addresses is mapped. Default the
destination offset is 0x0000.
Linker Script Language 8-27
If you are mapping a bus to another bus, the number of data lines of each
bus may differ. In this case you have to specify a range of source data
lines you want to map (src_dbits = begin..end) and the range of
destination data lines you want to map them to (dest_dbits =
first..last).
• The src_dbits argument specifies a range of data lines of the source
bus. Default all data lines are mapped.
• The dest_dbits argument specifies a range of data lines of the
destination bus. Default, all data lines from the source bus are mapped
on the data lines of the destination bus (starting with line 0).
• • • • • • • •
8-28 TriCore Reference Manual
architecture mycore
{
bus i_bus
{
mau = 4;
}
space i_space
{
map (dest=bus:i_bus, size=256);
}
}
bus e_bus
{
mau = 16;
LINKER SCRIPT LANGUAGE
width = 16;
map (dest = bus:mycore:i_bus,
src_dbits = 0..7, dest_dbits = 0..7 )
}
map
dest bus space
dest_dbits
dest_offset
size
src_dbits
src_offset
• • • • • • • •
8-30 TriCore Reference Manual
If you are defining multiple derivatives that show great resemblance, you
can define the common features in a parent derivative and extend this
with a child derivative that contains specific features. The child inherits all
features of the parent (cores and memories). With the keyword extends
you create a child derivative:
derivative name_child_deriv extends name_parent_deriv
{
definitions
}
core mycore_2
{
architecture = mycorearch;
}
Linker Script Language 8-31
• • • • • • • •
8-32 TriCore Reference Manual
memory mem_name
{
type = rom;
mau = 8;
size = 64k;
speed = 2;
map ( map_description );
}
With the bus keyword you define a bus in a derivative definition. Buses
are described in section 8.5.2, Defining Internal Buses.
LINKER SCRIPT LANGUAGE
Linker Script Language 8-33
map
dest bus space
dest_dbits
dest_offset
size
src_dbits
src_offset
If you use processors that all have a unique derivative, you may omit the
processor definitions. In this case the linker assumes that for each
derivative definition in the LSL file there is one processor. The linker uses
the derivative name also for the processor.
• • • • • • • •
8-34 TriCore Reference Manual
With the keyword processor you define a processor. You can freely
choose the processor name. The name is used to refer to it at other places
in the LSL file:
processor proc_name
{
processor definition
}
For examples, if you have two processors on your target board (called
myproc_1 and myproc_2) that have the same derivative (called
myderiv), you must instantiate both processors as follows:
processor myproc_1
{
derivative = myderiv;
}
processor myproc_2
{
derivative = myderiv;
}
With the keyword memory you define physical memory that is present on
the target board. The memory name is used to identify the memory and
does not conflict with other identifiers. If you define memory parts in the
LSL file, only the memory defined in these parts is used for placing
sections.
If no external memory is defined in the LSL file and if the linker option to
allocate memory on demand is set then the linker will assume that all
virtual addresses are mapped on physical memory. You can override this
behavior by specifying one or more memory definitions.
memory mem_name
{
type = rom;
mau = 8;
size = 64k;
speed = 2;
map ( map_description );
}
With the keyword bus you define a bus (the combination of data and
corresponding address bus). The bus name is used to identify a bus and
does not conflict with other identifiers. Bus descriptions at the global
scope (outside any definition) define external buses. These are buses that
are present on the target board.
bus bus_name
{
mau = 8;
width = 8;
map ( map_description );
}
• • • • • • • •
8-36 TriCore Reference Manual
You can connect off-chip memory to any derivative: you need to map the
off-chip memory to a bus and map that bus on the internal bus of the
derivative you want to connect it to.
LINKER SCRIPT LANGUAGE
Linker Script Language 8-37
if
else
• • • • • • • •
8-38 TriCore Reference Manual
You can define one or more section definitions. Each section definition
arranges the sections in one address space. You can precede the address
space name with a processor name and/or core name, separated by
colons. You can omit the processor name and/or the core name if only
one processor is defined and/or only one core is present in the processor.
A reference to a space in the only core of the only processor in the system
would look like "::my_space". A reference to a space of the only core
on a specific processor in the system could be "my_chip::my_space ".
The next example shows a section definition for sections in the my_space
LINKER SCRIPT LANGUAGE
With the optional keyword direction you specify whether the linker
starts locating sections from low_to_high (default) or from
high_to_low . In the second case the linker starts locating sections at the
highest addresses in the address space but preserves the order of sections
when necessary (one processor and core in this example).
section_layout ::my_space ( direction = high_to_low )
{
section statements
}
If you do not explicitly tell the linker how to locate a section, the linker
decides on the basis of the section attributes in the object file and the
information in the architecture definition and memory parts where to
locate the section.
Linker Script Language 8-39
Instead of selecting sections, you can also modify special sections like
stack and heap or create a reserved section. This is described in section
8.8.3, Creating or Modifying Special Sections.
With the group_specifications you actually locate the sections in the group.
This is described in subsection Locating a group.
The first select statement selects the section with the name ".mysection".
The second select statement selects all sections that were not selected
yet.
• • • • • • • •
8-40 TriCore Reference Manual
Keep in mind that all section selections are restricted to the address space
of the section layout in which this group definition occurs.
Locating a group
group group_name ( group_specifications )
{
section_statements
}
With the group_specifications you actually define how the linker must
locate the group. You can roughly define three things: 1) assign properties
to the group like alignment and read/write attributes, 2) define the mutual
order in the address space for sections in the group and 3) restrict the
possible addresses for the sections in a group.
Linker Script Language 8-41
The linker creates labels that allow you to refer to the begin and end
address of a group from within the application software. Labels
_lc_gb_group_name and _lc_ge_group_name mark the begin and end
of the group respectively, where the begin is the lowest address used
within this group and the end is the highest address used. Notice that a
group not necessarily occupies all memory between begin and end
address. The given label refers to where the section is located at run-time
(versus load-time).
• • • • • • • •
8-42 TriCore Reference Manual
When you define a group that is both ordered and contiguous, this
is called a sequential group. In a sequential group the linker places
sections in the same order in the address space as they appear in the
group and it occupies a contiguous range of memory.
• The clustered keyword tells the linker to locate the sections in the
group in a number of contiguous blocks. It tries to keep the number of
these blocks to a minimum. If enough memory is available, the group
will be located as if it was specified as contiguous. Otherwise, it gets
split into two or more blocks.
If a contiguous or clustered group contains alignment gaps, the linker
can locate sections that are not part of the group in these gaps. To
prevent this, you can use the fill keyword. If the group is located in
RAM, the gaps are treated as reserved (scratch) space. If the group is
located in ROM, the alignment gaps are filled with zeros by default.
LINKER SCRIPT LANGUAGE
You can however change the fill pattern by specifying a bit pattern.
The result of the expression, or list of expressions, is used as values to
write to memory, each in MAU.
• The overlay keyword tells the linker to overlay the sections in the
group. The linker places all sections in the address space using a
contiguous range of addresses. (Thus an overlay group is automatically
also a contiguous group.) To overlay the sections, all sections in the
overlay group share the same run-time address.
For each input section within the overlay the linker automatically
defines two symbols. The symbol _lc_cb_section_name is defined
as the load-time start address of the section. The symbol
_lc_ce_section_name is defined as the load-time end address of
the section. C (or assembly) code may be used to copy the overlaid
sections.
It may be possible that one of the sections in the overlay group already
has been defined in another group where it received a load-time
address. In this case the linker does not overrule this load-time address
and excludes the section from the overlay group.
You can use the '[offset]' variant to locate the group at the given
absolute offset in memory:
group (run_addr = mem:A[0x1000])
• • • • • • • •
8-44 TriCore Reference Manual
You can use the '|' to specify an address range of more than one
physical memory device:
group (run_addr = mem:A | mem:B)
• The load_addr keyword changes the meaning of the section selection
in the group: the linker selects the load-time ROM copy of the named
section(s) instead of the regular sections. Just like run_addr you can
specify an absolute address or an address range.
The load_addr keyword itself (without an assignment) specifies that
the group's position in the LSL file defines its load-time address.
group (load_addr)
select "mydata"; // select ROM copy of mydata:
LINKER SCRIPT LANGUAGE
// "[mydata]"
Stack
• The stack keyword tells the linker to reserve memory for the stack.
The name for the stack section refers to the stack as defined in the
architecture definition. If no name was specified in the architecture
definition, the default name is stack.
With the keyword size you can specify the size for the stack. If the
size is not specified, the linker uses the size given by the min_size
argument as defined for the stack in the architecture definition.
Normally the linker automatically tries to maximize the size, unless you
specified the fixed keyword.
group ( ... )
{
stack "mystack" ( size = 2k );
}
The linker creates two labels to mark the begin and end of the stack,
_lc_ub_stack_name for the begin of the stack and
_lc_ue_stack_name for the end of the stack. The linker allocates
space for the stack when there is a reference to either of the labels.
See also the stack keyword in section 8.5.3, Defining Address Spaces.
• • • • • • • •
8-46 TriCore Reference Manual
Heap
• The heap keyword tells the linker to reserve a dynamic memory range
for the malloc() function. Optionally you can assign a name to the
heap section. With the keyword size you can change the size for the
heap. If the size is not specified, the linker uses the size given by the
min_size argument as defined for the heap in the architecture
definition. Normally the linker automatically tries to maximize the size,
unless you specified the fixed keyword.
group ( ... )
{
heap "myheap" ( size = 2k );
}
The linker creates two labels to mark the begin and end of the heap,
_lc_ub_heap_name for the begin of the heap and
LINKER SCRIPT LANGUAGE
Reserved section
• The reserved keyword tells the linker to create an area or section of
a given size. The linker will not locate any other sections in the
memory occupied by a reserved section, with some exceptions.
Optionally you can assign a name to a reserved section. With the
keyword size you can specify a size for a given reserved area or
section.
group ( ... )
{
reserved "myreserved" ( size = 2k );
}
The optional fill field contains a bit pattern that the linker writes to
all memory addresses that remain unoccupied during the locate
process. The result of the expression, or list of expressions, is used as
values to write to memory, each in MAU. The first MAU of the fill
pattern is always the first MAU in the section.
With the attributes field you can set the access type of the reserved
section. The linker locates the reserved section in its space with the
restrictions that follow from the used attributes, r, w or x or a valid
combination of them. The allowed attributes are shown in the
following table. A value between < and > in the table means this value
is set automatically by the linker.
group ( ... )
{
reserved "myreserved" ( size = 2k,
attributes = rw, fill = 0xaa );
}
If you do not specify any attributes, the linker will reserve the given
number of maus, no matter what type of memory lies beneath. If you
do not specify a fill pattern, no section is generated.
The linker creates two labels to mark the begin and end of the section,
_lc_ub_name for the start, and __lc_ue_name for the end of the
reserved section.
Output sections
• The section keyword tells the linker to accumulate sections obtained
from object files ("input sections") into an output section of a fixed size
in the locate phase. You can select the input sections with select
statements. With the keyword size you specify the size of the output
section.
• • • • • • • •
8-48 TriCore Reference Manual
The fill field contains a bit pattern that the linker writes to all unused
space in the output section. When all input sections have an image
(code/data) you must specify a fill pattern. If you do not specify a fill
pattern, all input sections must be scratch sections. The fill pattern is
aligned at the start of the output section.
As with a reserved section you can use the attributes field to set the
access type of the output section.
group ( ... )
{
section "myoutput" ( size = 4k, attributes = rw,
fill = 0xaa )
{
select "myinput1";
select "myinput2";
LINKER SCRIPT LANGUAGE
}
}
The linker creates two labels to mark the begin and end of the section,
_lc_ub_name for the start, and __lc_ue_name for the end of the
output section.
Copy table
• The copytable keyword tells the linker to select a section that is used
as copy-table. The content of the copy-table is created by the linker. It
contains the start address and length of all sections that should be
initialized by the startup code.
The linker creates two labels to mark the begin and end of the section,
_lc_ub_table for the start, and __lc_ue_table for the end of the
copy table. The linker generates a copy table when a reference to
either of the section labels exists in one of the input object files.
The expression that represents the value to assign to the symbol may
contain references to other symbols. If such a referred symbol is a special
section symbol, creation of the symbol in the left hand side of the
assignment will cause creation of the special section.
section_layout
{
"_lc_bs" := "_lc_ub_stack";
// when the symbol _lc_bs occurs in the object
// file, the linker allocates space for the stack
}
• • • • • • • •
8-50 TriCore Reference Manual
LINKER SCRIPT LANGUAGE
CHAPTER
CPU FUNCTIONAL
PROBLEMS
9
9-2
CPU FUNCTIONAL PROBLEMS
9
CHAPTER
TriCore Reference Manual
CPU Functional Problems 9-3
9.1 INTRODUCTION
Infineon Technologies regularly publishes microcontroller errata sheets
reporting functional problems and deviations from the electrical
specifications and timing specifications.
Please refer to the Infineon errata sheets for the TriCore architecture
revision-step of your particular device, to check the need for applying any
of these bypasses. Also refer to the Infineon errata sheets for a complete
description of the CPU functional problems, as the workarounds listed
below do not describe the functional problem itself.
To enable the compiler bypasses and assembler checks for all TriCore CPU
TC112 problems (respectively TC113 problems) at once, use the command
line option --silicon-bug=all-tc112 (respectively
--silicon-bug=all-tc113)
• • • • • • • •
9-4 TriCore Reference Manual
CPU_TC.013
Compiler and assembler option:
--silicon-bug=cpu-tc013
Assembler control:
$CPU_TC013 {on|off}
CPU FUNCTIONAL PROBLEMS
Assembler macro:
The assembler macro __CPU_TC013__ is defined if you specify option
--silicon-bug=cpu-tc013.
Compiler bypass:
To bypass this CPU functional problem, the C compiler generates a NOP16
instruction if a 16-bit load/store address register instruction (instructions:
LD16.A en ST16.A) is followed by a lower context load/store instruction
(instructions: LDLCX and STLCX).
Assembler check:
The assembler gives a warning if a 16-bit load/store address register
instruction (instructions: LD16.A en ST16.A) is followed by a lower context
load/store instruction (instructions: LDLCX and STLCX).
Wnum: suspicious instruction concerning CPU functional
defect TC013
CPU_TC.030
Compiler and assembler option:
--silicon-bug=cpu-tc030
Assembler control:
$CPU_TC030 {on|off}
Assembler macro:
The assembler macro __CPU_TC030__ is defined if you specify option
--silicon-bug=cpu-tc030.
Compiler bypass:
To bypass this CPU functional problem, the C compiler generates an
ISYNC instruction prior to the LOOP instruction if the last instruction in the
loop is a DVSTEP or a DVSTEP.U.
Assembler check:
The assembler gives a warning for loops where the last instruction is a
DVSTEP or a DVSTEP.U:
Wnum: suspicious instruction concerning CPU functional
defect TC030
• • • • • • • •
9-6 TriCore Reference Manual
CPU_TC.031
Compiler and assembler option:
--silicon-bug=cpu-tc031
Assembler control:
$CPU_TC031 {on|off}
Assembler macro:
The assembler macro __CPU_TC031__ is defined if you specify option
--silicon-bug=cpu-tc031.
CPU FUNCTIONAL PROBLEMS
Compiler bypass:
To bypass this CPU functional problem, the C compiler generates an
ISYNC instruction prior to the LOOP instruction.
Assembler check:
The assembler gives a warning if the LOOP instruction is not preceded by
an ISYNC instruction:
Wnum: suspicious instruction concerning CPU functional
defect TC031
CPU_TC.034
Compiler and assembler option:
--silicon-bug=cpu-tc034
Assembler control:
$CPU_TC034 {on|off}
Assembler macro:
The assembler macro __CPU_TC034__ is defined if you specify option
--silicon-bug=cpu-tc034.
Compiler bypass:
To bypass this CPU functional problem, the C compiler generates an
ISYNC instruction after each DSYNC instruction.
Assembler check:
The assembler gives a warning if a DSYNC instruction is not followed by
an ISYNC instruction:
Wnum: suspicious instruction concerning CPU functional
defect TC034
• • • • • • • •
9-8 TriCore Reference Manual
CPU_TC.043
Linker option:
-D__CPU_TC043__
Linker bypass:
To bypass this CPU functional problem, a preprocessor define is used in
the tc*.lsl linker script files. The linker will not use the last 16 bytes of
a segment.
CPU FUNCTIONAL PROBLEMS
CPU Functional Problems 9-9
CPU_TC.048
Compiler and assembler option:
--silicon-bug=cpu-tc048
Assembler control:
$CPU_TC048 {on|off}
Assembler macro:
The assembler macro __CPU_TC048__ is defined if you specify option
--silicon-bug=cpu-tc048.
Compiler bypass:
To bypass this CPU functional problem, the C compiler generates a NOP
instruction before a JI or CALLI instruction when this instruction is not
directly preceded by either a NOP instruction or an integer instruction or a
MAC instruction. The compiler also generates a NOP instruction before a
RET and RET16 instruction if there is no or just one instruction before RET,
starting from the function entry point.
Assembler check:
The assembler gives a warning when a JI or CALLI instruction is not
directly preceded by a NOP instruction. The assembler also gives a
warning when there is no or just one instruction (not a NOP instruction)
between label and RET or RET16:
Wnum: suspicious instruction concerning CPU functional
defect TC048
• • • • • • • •
9-10 TriCore Reference Manual
CPU_TC.050
Compiler and assembler option:
--silicon-bug=cpu-tc050
Assembler control:
$CPU_TC050 {on|off}
Assembler macro:
The assembler macro __CPU_TC050__ is defined if you specify option
--silicon-bug=cpu-tc050.
CPU FUNCTIONAL PROBLEMS
Compiler bypass:
To bypass this CPU functional problem, the C compiler generates a NOP
instruction between a multi-cycle integer instruction and a load
instruction.
Assembler check:
The assembler gives a warning if a multi-cycle integer instruction is
directly followed by a load instruction.:
Wnum: suspicious instruction concerning CPU functional
defect TC050
CPU_TC051
Linker option:
-D__CPU_TC051__
Linker bypass:
To bypass this CPU functional problem, a preprocessor define is used in
the tc*.lsl linker script files. The linker will use more than one section
for context stores if the required CSA area exceeds the 4k. Each section
will have a maximum size of 4k and will start on an 8k boundary.
• • • • • • • •
9-12 TriCore Reference Manual
CPU_TC.060
Compiler and assembler option:
--silicon-bug=cpu-tc060
Assembler control:
$CPU_TC060 {on|off}
Assembler macro:
The assembler macro __CPU_TC060__ is defined if you specify option
--silicon-bug=cpu-tc060.
CPU FUNCTIONAL PROBLEMS
Compiler bypass:
To bypass this CPU functional problem, the C compiler generates a NOP
instruction between an LD.A / LD.DA instruction and a following LD.W /
LD.D instruction, even if an integer instruction occurs in between.
Assembler check:
The assembler gives a warning when an LD.A / LD.DA instruction is
directly followed by an LD.W / LD.D instruction, or when only an integer
instruction is in between.
Wnum: suspicious instruction concerning CPU functional
defect TC060
TC112_COR1
Compiler and assembler option:
--silicon-bug=cor1
Assembler control:
$TC112_COR1 {on|off}
Assembler macro:
The assembler macro __TC112_COR1__ is defined if you specify the
option --silicon-bug=cor1.
Compiler bypass:
To bypass this CPU functional problem, the C compiler generates an
ISYNC instruction before each LOOP, LOOP16 and LOOPU instruction.
Assembler check:
The assembler gives a warning when the preceding instruction of a LOOP,
LOOP16 or LOOPU instruction is not an ISYNC instruction:
Wnum: suspicious instruction concerning CPU functional
defect TC112_COR1
• • • • • • • •
9-14 TriCore Reference Manual
TC112_COR3
Linker option:
-D__TC112_COR3__
Linker bypass:
To bypass this CPU functional problem, a preprocessor define is used in
the tc*.lsl linker script files to restrict the size in the CSA absolute
address mapping to 32Kb scratch pad RAM on the DMU.
CPU FUNCTIONAL PROBLEMS
CPU Functional Problems 9-15
TC112_COR4
Compiler and assembler option:
--silicon-bug=cor4
Assembler control:
$TC112_COR4 {on|off}
Assembler macro:
The assembler macro __TC112_COR4__ is defined if you specify the
option --silicon-bug=cor4.
Compiler bypass:
To bypass this CPU functional problem, the C compiler generates a NOP
instruction between a (target) label and the instruction following it This is
done when the instruction directly uses an An register for either an
effective address calculation or as the target of an indirect branch.
Optionally an integer instruction may directly follow the label.
B_label:
add d0, d1 ; integer instruction
ji a4
Assembler check:
The assembler gives a warning for an instruction using an An register for
either an effective address calculation or as the target of an indirect branch
that is located directly after a (target) label, optionally with an integer
instruction in between:
Wnum: suspicious instruction concerning CPU functional
defect TC112_COR4
• • • • • • • •
9-16 TriCore Reference Manual
TC112_COR6
Assembler option:
--silicon-bug=cor6
Assembler control:
$TC112_COR6 {on|off}
Assembler macro:
The assembler macro __TC112_COR6__ is defined if you specify the
option --silicon-bug=cor6.
CPU FUNCTIONAL PROBLEMS
Compiler bypass:
There is no C compiler workaround required for this CPU functional
problem, because the compiler does not generate CALLI instructions with
a target address in register A11.
Assembler check:
The assembler generates an error for instruction CALLI A11.
CPU Functional Problems 9-17
TC112_COR7
Compiler and assembler option:
--silicon-bug=cor7
Assembler control:
$TC112_COR7 {on|off}
Assembler macro:
The assembler macro __TC112_COR7__ is defined if you specify the
option --silicon-bug=cor7.
Compiler bypass:
To bypass this CPU functional problem, the C compiler generates a NOP
instruction at the very top of any subroutine that starts with a CALL
instruction or that starts with an integer instruction or MAC instruction
directly followed by a CALL instruction.
Assembler check:
The assembler gives a warning when the first instruction of a subroutine is
a CALL instruction or an integer instruction or MAC instruction directly
followed by a CALL instruction.
Wnum: suspicious instruction concerning CPU functional
defect TC112_COR7
• • • • • • • •
9-18 TriCore Reference Manual
TC112_COR10
Compiler and assembler option:
--silicon-bug=cor10
Assembler control:
$TC112_COR10 {on|off}
Assembler macro:
The assembler macro __TC112_COR10__ is defined if you specify the
option --silicon-bug=cor10.
CPU FUNCTIONAL PROBLEMS
Compiler bypass:
To bypass this CPU functional problem, the C compiler avoids generation
of store instructions that use a circular addressing mode with an offset
value not equal to zero. An additional circular load instruction is generated
with the required offset to post-increment the circular buffer pointer.
For example:
st.w [a6/a7+c]0,d15
ld.w d15,[a6/a7+c]4
Instead of:
st.w [a6/a7+c]4,d15
Assembler check:
The assembler gives a warning for store operations that use a circular
addressing mode with an offset not equal to zero:
Wnum: suspicious instruction concerning CPU functional
defect TC112_COR10
TC112_COR13
Compiler and assembler option:
--silicon-bug=cor13
Assembler control:
$TC112_COR13 {on|off}
Assembler macro:
The assembler macro __TC112_COR13__ is defined if you specify option
--silicon-bug=cor13.
Compiler bypass:
To bypass this CPU functional problem, the C compiler generates an
ISYNC instruction prior to the LOOP instruction if the loop contains a
single integer instruction that is a DVSTEP or a DVSTEP.U.
Assembler check:
The assembler gives a warning for loops that contain a single integer
instruction that is a DVSTEP or a DVSTEP.U:
Wnum: suspicious instruction concerning CPU functional
defect TC112_COR13
• • • • • • • •
9-20 TriCore Reference Manual
TC112_COR14
Compiler option:
--silicon-bug=cor14
Compiler bypass:
To bypass this CPU functional problem, the C compiler uses code that
protects a divide instruction sequence against interrupts. Instead of
CPU FUNCTIONAL PROBLEMS
divide instructions:
;;
;; Restore interrupt state
;;
jz.t d0:8,disabled ; do not enable interrupts
enable ; when they were disabled
disabled:
Assembler check:
An assembler check for this CPU functional problem is not available,
because global interrupt enable state cannot be checked at assembly level.
CPU Functional Problems 9-21
TC112_COR15
Assembler option:
--silicon-bug=cor15
Assembler control:
$TC112_COR15 {on|off}
Assembler macro:
The assembler macro __TC112_COR15__ is if you specify the option
--silicon-bug=cor15.
Compiler bypass:
There is no compiler bypass for this problem.
Assembler bypass:
To bypass this CPU functional problem, the assembler adds a macro to the
C startup code to disable the starvation protection by resetting the
BCUCON.SPE bit.
• • • • • • • •
9-22 TriCore Reference Manual
TC112_COR16
Compiler and assembler option:
--silicon-bug=cor16
Linker option:
-D__TC112_COR16__
Assembler control:
$TC112_COR16 {on|off}
CPU FUNCTIONAL PROBLEMS
Assembler macro:
The assembler macro __TC112_COR16__ is defined if you specify the
option --silicon-bug=cor16.
Compiler bypass:
To bypass this CPU functional problem, the C compiler aligns circular
qualified buffers to a quad-word boundary, and the compiler sizes all
stack frames to an integral number of quad-words. See section 3.4.1,
Circular Buffers in the User's Manual, for a description on how to declare
a circular buffer.
Assembler bypass:
To bypass this CPU functional problem, the assembler adds a macro to the
C startup code to enable initialization of the stack pointers to a quad-word
boundary.
Linker bypass:
A preprocessor define is used in the tc*.lsl linker script files to set the
alignment of the user stack and the interrupt stack to a quad-word
alignment.
CPU Functional Problems 9-23
TC112_COR17
Compiler and assembler option:
--silicon-bug=cor17
Assembler control:
$TC112_COR17 {on|off}
Assembler macro:
The assembler macro __TC112_COR17__ is defined if you specify the
option --silicon-bug=cor17.
Compiler bypass:
To bypass this CPU functional problem, the C compiler generates an
ISYNC instruction after a DSYNC instruction. The C compiler only
generates a DSYNC instruction when bypass TC113_CPU14 is enabled.
Assembler check:
The assembler gives a warning if a DSYNC is not followed by an ISYNC
instruction:
Wnum: suspicious instruction concerning CPU functional
defect TC112_COR17
• • • • • • • •
9-24 TriCore Reference Manual
TC113_CPU5
Compiler option:
--silicon-bug=cpu5
Compiler bypass:
To bypass this CPU functional problem, the C compiler generates an
ISYNC instruction before a loop body.
CPU FUNCTIONAL PROBLEMS
Example:
isync
_loop_start:
..
..
loop a8, _loop_start
Assembler check:
This CPU functional problem does not cause a run-time problem, it is only
a performance issue. Therefor no assembler checking is required to warn
you for possible run-time problems.
CPU Functional Problems 9-25
TC113_CPU9
Compiler and assembler option:
--silicon-bug=cpu9
Assembler control:
$TC113_CPU9 {on|off}
Assembler macro:
The assembler macro __TC113_CPU9__ is defined if you specify the
option --silicon-bug=cpu9.
Compiler bypass:
To bypass this CPU functional problem, the C compiler generates two NOP
instructions after a DSYNC instruction. The C compiler only generates a
DSYNC instruction when CPU functional problem bypass TC113_CPU14 is
enabled.
Assembler check:
The assembler gives a warning if a DSYNC is not followed by two NOP
instructions:
Wnum: suspicious instruction concerning CPU functional
defect TC113_CPU9
• • • • • • • •
9-26 TriCore Reference Manual
TC113_CPU11
Compiler and assembler option:
--silicon-bug=cpu11
Pragma:
#pragma TC113_CPU11 [on|off|restore]
Assembler control:
$TC113_CPU11 {on|off}
CPU FUNCTIONAL PROBLEMS
Assembler macro:
The assembler macro __TC113_CPU11__ is defined if you specify the
option --silicon-bug=cpu11.
Compiler bypass:
To bypass this CPU functional problem, the C compiler generates a NOP
instruction before a JI instruction. The compiler also generates a NOP
before a RET and RET16 instruction if there is no or just one instruction
before RET, starting from the function entry point.
Assembler check:
The assembler gives a warning when a JI instruction is not directly
preceded by a NOP instruction. The assembler also gives a warning when
there is no or just one instruction (not a NOP instruction) between label
and RET or RET16:
Wnum: suspicious instruction concerning CPU functional
defect TC113_CPU11
TC113_CPU13
Assembler option:
--silicon-bug=cpu13
Assembler macro:
The assembler macro __TC113_CPU13__ is defined if you specify the
option --silicon-bug=cpu13.
Compiler bypass:
There is no compiler bypass for this problem.
Assembler bypass:
To bypass this CPU functional problem, the assembler adds a macro to the
C startup code to enable the 16Kb D-Cache. The DCSIZ bits are set to
16Kb in the SFR register DMU_CON.
• • • • • • • •
9-28 TriCore Reference Manual
TC113_CPU14
Compiler and assembler option:
--silicon-bug=cpu14
Assembler control:
$TC113_CPU14 {on|off}
Assembler macro:
The assembler macro __TC113_CPU14__ is defined if you specify the
option --silicon-bug=cpu14.
CPU FUNCTIONAL PROBLEMS
Compiler bypass:
To bypass this CPU functional problem, the C compiler generates a DSYNC
instruction directly after a (interrupt) function entry point label. Also an
assembler macro is added to the run-time library functions for optionally
adding a DSYNC instruction after a function entry point label.
Assembler check:
The assembler gives a warning when the first label in a code section is not
followed by a DSYNC instruction:
Wnum: suspicious instruction concerning CPU functional
defect TC113_CPU14
TC113_CPU15
Compiler and assembler option:
--silicon-bug=cpu15
Assembler control:
$TC113_CPU15 {on|off}
Assembler macro:
The assembler macro __TC113_CPU15__ is defined if you specify the
option --silicon-bug=cpu15.
Compiler bypass:
To bypass this CPU functional problem, the C compiler avoids generation
of the ST.T, SWAP and LDMST instructions. For immediate __bit and
bit-field operations alternative instructions are used.
Assembler check:
The assembler gives a warning for ST.T, SWAP and LDMST instructions:
Wnum: suspicious instruction concerning CPU functional
defect TC113_CPU15
• • • • • • • •
9-30 TriCore Reference Manual
TC113_CPU16
Compiler and assembler option:
--silicon-bug=cpu16
Assembler control:
$TC113_CPU16 {on|off}
Assembler macro:
The assembler macro __TC113_CPU16__ is defined if you specify the
option --silicon-bug=cpu16.
CPU FUNCTIONAL PROBLEMS
Compiler bypass:
To bypass this CPU functional problem, the C compiler generates a NOP
instruction before a JI, JLI or CALLI instruction when there is not one
already. The compiler also generates a NOP instruction before a RET and
RET16 instruction if there is no or just one instruction before RET, starting
from the function entry point.
Assembler check:
The assembler gives a warning when a JI, JLI or CALLI instruction is not
directly preceded by a NOP instruction. The assembler also gives a
warning when there is no or just one instruction (not a NOP instruction)
between label and RET or RET16:
Wnum: suspicious instruction concerning CPU functional
defect TC113_CPU16
TC113_DMU1
Compiler and assembler option:
--silicon-bug=dmu1
Assembler control:
$TC113_DMU1 {on|off}
Assembler macro:
The assembler macro __TC113_DMU1__ is defined if you specify the
option --silicon-bug=dmu1.
Compiler bypass:
To bypass this CPU functional problem, the C compiler avoids generation
of the ST.T, SWAP and LDMST instructions. For direct __bit and bit-field
operations, alternative instructions are used.
Assembler check:
The assembler gives a warning for SWAP, LDMST and ST.T instructions:
Wnum: suspicious instruction concerning CPU functional
defect TC113_DMU1
• • • • • • • •
9-32 TriCore Reference Manual
TC113_LFI2
Compiler and assembler option:
--silicon-bug=lfi2
Assembler control:
$TC113_LFI2 {on|off}
Assembler macro:
The assembler macro __TC113_LFI2__ is defined if you specify the
option --silicon-bug=lfi2.
CPU FUNCTIONAL PROBLEMS
Compiler bypass:
To bypass this CPU functional problem, the C compiler avoids generation
of ST.T, SWAP and LDMST instructions. For immediate __bit and bit-field
operations alternative instructions are used.
Assembler check:
The assembler gives a warning for SWAP, LDMST and ST.T instructions:
Wnum: suspicious instruction concerning CPU functional
defect TC113_LFI2
TC113_LFI3
Compiler and assembler option:
--silicon-bug=lfi3
Assembler control:
$TC113_LFI3 {on|off}
Assembler macro:
The assembler macro __TC113_LFI3__ is defined if you specify the
option --silicon-bug=lfi3.
Compiler bypass:
To bypass this CPU functional problem, the compiler avoids generation of
the ST.T, SWAP and LDMST instructions. For direct __bit and bit-field
operations alternative instructions are used.
Assembler check:
The assembler gives a warning for SWAP, LDMST and ST.T instructions:
Wnum: suspicious instruction concerning CPU functional
defect TC113_LFI3
• • • • • • • •
9-34 TriCore Reference Manual
TC113_PMU1
Assembler option:
--silicon-bug=pmu1
Assembler macro:
The assembler macro __TC113_PMU1__ is defined if you specify the
option --silicon-bug=pmu1.
CPU FUNCTIONAL PROBLEMS
Compiler bypass:
There is no compiler bypass for this problem.
Assembler bypass:
To bypass this CPU functional problem, the assembler adds a macro to the
C startup code to disable the split mode on the LMB bus. The SPLT bit of
the SFR register LFI_CON is set to zero.
CPU Functional Problems 9-35
TC113_PMU3
Assembler option:
--silicon-bug=pmu3
Assembler macro:
The assembler macro __TC113_PMU3__ is defined if you specify the
option --silicon-bug=pmu3.
Compiler bypass:
There is no compiler bypass for this problem.
Assembler bypass:
To bypass this CPU functional problem, the assembler adds a macro to the
C startup code to set the TLB-A and TLB-B mappings to a page size of 16
Kb. The SZA and SZB in the MMU_CON are set to 16 Kb.
• • • • • • • •
9-36 TriCore Reference Manual
CPU FUNCTIONAL PROBLEMS
CHAPTER
MISRA C RULES
10
10-2 TriCore Reference Manual
CHAPTER
10
MISRA C
MISRA C Rules 10-3
12. The same identifier shall not be used in multiple name spaces
16. The bit representation of floating point numbers shall not be used
• • • • • • • •
10-4 TriCore Reference Manual
20. All object and function identifiers shall be declared before use
24. Identifiers shall not have both internal and external linkage
* 25. Identifiers with external linkage shall have exactly one definition
* 27. External objects should not be declared in more than one file
33. The right hand operand of && or || shall not contain side effects
38. A shift count shall be between 0 and the operand width minus 1
This violation will only be checked when the shift count evaluates
to a constant value at compile time.
43. Don't use implicit conversions which may result in information loss
45. Type casting from any type to or from pointers shall not be used
50. F.P. variables shall not be tested for exact equality or inequality
• • • • • • • •
10-6 TriCore Reference Manual
60. All "if", "else if" constructs should contain a final "else"
72. The function prototype of the declaration shall match the definition
73. Identifiers shall be given for all prototype parameters or for none
83. Every exit point shall have a "return" of the declared return type
This rule is really a documentation issue. The compiler will flag all
#pragma directives as violations.
• • • • • • • •
10-8 TriCore Reference Manual
100. "defined" shall only be used in one of the two standard forms
110. Unions shall not be used to access the sub-parts of larger types
111. Bit fields shall have type "unsigned int" or "signed int"
112. Bit fields of type "signed int" shall be at least 2 bits long
MISRA C
127. The time handling functions of library <time.h> shall not be used
See also section 5.7, C Code Checking: MISRA C, in Chapter Using the
Compiler of the User's Manual.
• • • • • • • •
10-10 TriCore Reference Manual
MISRA C
INDEX
INDEX
Index-2 TriCore Reference Manual
INDEX
INDEX
Index Index-3
• • • • • • • •
Index-4 TriCore Reference Manual
• • • • • • • •
Index-6 TriCore Reference Manual
B clog, 2-5
close, 2-44
bit handling, 1-23 cnt, 3-8
board specification, 8-5, 8-33 coh, 3-9
bsearch, 2-36 command file, 5-21, 5-79, 5-120,
btowc, 2-46 5-169, 5-229
BUFSIZ, 2-23 comment, 3-27
bus definition, 8-4 comments, 8-7
buses, 8-23 common subexpression elimination,
byte, 3-25 5-12
compiler options
-?, 5-4
C
--align, 5-7
--check, 5-11
--cpu, 5-8
C library, reentrancy, 2-48 --cse-all-addresses, 5-12
cabs, 2-5 --debug-info, 5-24
cacos, 2-5 --default-a0-size, 5-65
cacosh, 2-5 --default-a1-size, 5-63
calloc, 2-35 --default-near-size, 5-37
calls, 3-26 --define, 5-13
carg, 2-5 --diag, 5-15
case, 3-66 --error-file, 5-19
case sensitivity, 5-111 --fpu-present, 5-23
casin, 2-5 --help, 5-4
casinh, 2-5 --include-directory, 5-26
cat, 3-8 --include-file, 5-25
catan, 2-5 --indirect, 5-28
INDEX
• • • • • • • •
Index-8 TriCore Reference Manual
D EXIT_SUCCES, 2-34
exitm, 3-35
data types, 1-4 exp, 3-10
debug, 3-67 exp functions, 2-14
debug information, 5-24, 5-82, 5-146 exp2 functions, 2-14
def, 3-10 expm1 functions, 2-14
default_a0_size, 1-27 extension isuffix, 1-27
default_a1_size, 1-27 extern, 1-27, 3-36
default_near_size, 1-27
define, 3-28
derivative definition, 8-4, 8-29
difftime, 2-42
F
directives fabs functions, 2-17
See also assembler directives fail, 3-37
detailed description, 3-21 fclose, 2-24
div, 2-37 fdim functions, 2-18
double, 3-38 FE_ALL_EXCEPT, 2-10
dup, 3-29 FE_DIVBYZERO, 2-10
dupa, 3-30 FE_INEXACT, 2-10
dupc, 3-31 FE_INVALID, 2-10
dupf, 3-32 FE_OVERFLOW, 2-10
FE_UNDERFLOW, 2-10
feclearexcept, 2-9
E fegetenv, 2-9
fegetexceptflag, 2-9
ELF/DWARF object format, 7-3 feholdexept, 2-9
elif, 3-41 feof, 2-33
else, 3-41 feraiseexcept, 2-9
end, 3-33 ferror, 2-33
endif, 3-41 fesetenv, 2-9
enum, 5-33 fesetexceptflag, 2-9
EOF, 2-23 fetestexcept, 2-9, 2-10
equ, 3-34 feupdateenv, 2-9
erf functions, 2-18 fflush, 2-24
erfc functions, 2-18 fgetc, 2-29
errno, 2-7 fgetpos, 2-32
errno declaration, 2-59 fgets, 2-29
errno.h, 2-59 fgetwc, 2-29
exceptions, floating-point, 4-13 fgetws, 2-29
exit, 2-36 File system simulation, 2-4
exit macro, 3-35 FILENAME_MAX, 2-23
EXIT_FAILURE, 2-34 fld, 3-10
• • • • • • • •
Index-10 TriCore Reference Manual
float, 3-38
floating-point, 4-10 G
libraries, 4-13 getc, 2-29
single precision, 5-23, 5-81, 5-177 getchar, 2-29
special values, 4-13 getcwd, 2-44
trap handler, 4-14 getenv, 2-36
trap handling api, 4-15 gets, 2-29
trapping, 4-13 getwc, 2-29
floor functions, 2-15 getwchar, 2-29
flr, 3-11 global, 3-40
fma functions, 2-17 gmtime, 2-42
fmax functions, 2-18
fmin functions, 2-18
fmod functions, 2-16
fopen, 2-24
FOPEN_MAX, 2-23
H
for_constant_data_use_memory, 1-28 half, 3-62
for_extern_data_use_memory, 1-28 Header files, 2-4
for_initialized_data_use_memory, 1-28 alert.h, 2-4
for_uninitialized_data_use_memory, complex.h, 2-4
1-28 ctype.h, 2-6
fpclassify, 2-19 errno.h, 2-7
fprintf, 2-31 fcntl.h, 2-9
fputc, 2-30 fenv.h, 2-9
fputs, 2-30 float.h, 2-10
fputwc, 2-30 fss.h, 2-10
fputws, 2-30 inttypes.h, 2-11
fract, 3-11, 3-39 iso646.h, 2-12
fractional arithmetic support, 1-14 limits.h, 2-12
fread, 2-32 locale.h, 2-12
free, 2-35 math.h, 2-13
freopen, 2-25 setjmp.h, 2-20
frexp functions, 2-16 signal.h, 2-20
fscanf, 2-29 stdarg.h, 2-21
fseek, 2-32 stdbool.h, 2-21
fsetpos, 2-32 stddef.h, 2-22
FSS, 2-4 stdint.h, 2-11
ftell, 2-32 stdio.h, 2-22
INDEX
I isnormal, 2-19
ISO C standard, 5-10
ident, 3-70 isprint, 2-6
if, 3-41 ispunct, 2-6
ilogb functions, 2-14 isspace, 2-6
imaginary, 2-4 isunordered, 2-19
imaxabs, 2-11 isupper, 2-6
imaxdiv, 2-11 iswalnum, 2-6, 2-46
include, 3-43 iswalpha, 2-6, 2-46
indirect, 1-28 iswblank, 2-6
indirect function calling, 5-28, 5-29 iswcntrl, 2-6, 2-46
indirect_runtime, 1-28 iswctype, 2-46
inline functions, 5-31 iswdigit, 2-6, 2-46
inline/noinline, 1-28 iswgraph, 2-6, 2-46
insert assembly instruction, 1-21 iswlower, 2-6, 2-47
int, 3-11 iswprint, 2-6, 2-47
Intel hex, record type, 7-8 iswpunct, 2-6, 2-47
interrupt handling, 1-19 iswspace, 2-6, 2-47
intrinsic functions, 1-12 iswupper, 2-6, 2-47
bit handling, 1-23 iswxdigit, 2-6
fractional data type, 1-14 iswxditig, 2-47
insert assembly instruction, 1-21 isxdigit, 2-6
interrupt handling, 1-19
min/max of integers, 1-13
miscellaneous, 1-25
packed data type, 1-15
L
register handling, 1-22 L_tmpnam, 2-23
iob structures, 2-59 l10, 3-12
isalnum, 2-6 labs, 2-37
isalpha, 2-6 language extensions, intrinsic
isblank, 2-6 functions, 1-12
iscntrl, 2-6 ldexp functions, 2-16
• • • • • • • •
Index-12 TriCore Reference Manual
• • • • • • • •
Index-14 TriCore Reference Manual
M -V, 5-239
-W, 5-240
mac, 3-14 -w, 5-241
macro, 3-45 -x, 5-242
define, 5-161 defining a macro, 5-215
definition, 3-45 malloc, 2-35
undefine, 3-50, 5-208 map file
macro/nomacro, 1-28 control program option, 5-195
macros, 1-31 format, 5-133
make utility, 5-215 linker, 5-132
macros, predefined mappings, 8-26
__DATE__, 5-56 max, 3-14
__FILE__, 5-56 MB_CUR_MAX, 2-34, 2-45
__LINE__, 5-56 MB_LEN_MAX, 2-45
__STDC__, 5-56 mblen, 2-37
__TIME__, 5-56 mbrlen, 2-46
Magnitude, 2-5 mbrtowc, 2-45
make utility options mbsinit, 2-45
-?, 5-217 mbsrtowcs, 2-45
-a, 5-218 mbstate_t, 2-45
-c, 5-219 mbstowcs, 2-37
-D, 5-220 mbtowc, 2-37
-d, 5-221 memchr, 2-40
-DD, 5-220 memcmp, 2-39
-dd, 5-221 memcpy, 2-38
-e, 5-222 memmove, 2-38
-err, 5-223 memory definition, 8-4
-f, 5-224 memory management instructions,
-G, 5-225 5-94, 5-191
-i, 5-226 memset, 2-41
-K, 5-227 message, 1-28, 3-47
-k, 5-228 min, 3-14
-m, 5-229, 5-235 min/max of integers, 1-13
-n, 5-231 MISRA C, 5-36
-p, 5-232 supported rules, 10-3
-q, 5-233 mktime, 2-42
-r, 5-234 fpu, 3-68
mmu, 3-75
INDEX
-s, 5-236
-t, 5-237 modf functions, 2-16
-time, 5-238 Modulus, 2-5
Index Index-15
N macro, 1-28
message, 1-28
nan functions, 2-17 object_comment, 1-29
nearbyint functions, 2-15 tradeoff, 1-30
nextafter functions, 2-17 warning, 1-30
nexttoward functions, 2-17 weak, 1-30
Norm, 2-5 Pragmas
NULL, 2-22 alias, 1-26, 1-30
align, 1-26
clear/noclear, 1-26
O
default_a0_size, 1-27
default_a1_size, 1-27
default_near_size, 1-27
object, 3-76 extension isuffix, 1-27
object_comment, 1-29 for_constant_data_use_memory,
offsetof, 2-22 1-28
open, 2-9 for_extern_data_use_memory, 1-28
optimization, 5-41, 5-96, 5-141 for_initialized_data_use_memory,
optimize/endoptimize, 1-29 1-28
option file, 5-21, 5-79, 5-120, 5-169, for_uninitialized_data_use_memory,
5-229 1-28
org, 3-48 inline/noinline, 1-28
output file, 5-44, 5-97, 5-143, 5-198 optimize/endoptimize, 1-29
output format, 5-109, 5-175 pack, 1-29
section, 1-29
section all, 1-29
P section code_init, 1-29
section const_init, 1-29
pack, 1-29 section data_overlay, 1-29
packed data type support, 1-15 section vector_init, 1-29
page, 3-77 smartinline, 1-28
pass option to tool, 5-211 source/nosource, 1-29
perror, 2-33 pragmas, 1-26
Phase angle, 2-5 prctl, 3-79
pmacro, 3-50 predefined macros, 1-31
pos, 3-15 predefined macros in C
pow, 3-15 __CTC__, 1-31
pow functions, 2-17 __DOUBLE_FP__, 1-31
power-on vector, 4-3 __DSPC__, 1-31
• • • • • • • •
Index-16 TriCore Reference Manual
__DSPC_VERSION__, 1-31
__FPU__, 1-31 S
__SINGLE_FP__, 1-31 scalbln functions, 2-16
__TASKING__, 1-31 scalbn functions, 2-16
preprocessing, 8-6 scanf, 2-27, 2-30
preprocessor, 5-93 conversion characters, 2-28
printf, 2-25, 2-31 scp, 3-16
conversion characters, 2-27 sdecl, 3-51
processor definition, 8-4, 8-33 sect, 3-54
ptrdiff_t, 2-22 section, 1-29
putc, 2-30 summary, 5-100
putchar, 2-30 section activation, 3-54
puts, 2-31 section all, 1-29
putwc, 2-30 section attributes, 3-51
putwchar, 2-30 section code_init, 1-29
section data_overlay, 1-29
section declaration, 3-51
Q section layout definition, 8-5, 8-37
section names, 3-52
qsort, 2-36 sections
grouping, 8-39
rename, 5-46
R SEEK_CUR, 2-32
SEEK_END, 2-32
raise, 2-20 SEEK_SET, 2-32
rand, 2-35 set, 3-55
RAND_MAX, 2-34 setbuf, 2-25
read, 2-44 setjmp, 2-20
realloc, 2-35 setlocale, 2-12
reentrancy, 2-48 setvbuf, 2-25
register handling, 1-22 sfract, 3-16, 3-39
remainder functions, 2-16 sgn, 3-16
remove, 2-33 SIGABRT, 2-20
remquo functions, 2-16 SIGFPE, 2-20
rename, 2-33 SIGFPE signal handler, 4-14
rename sections, 5-46 SIGILL, 2-20
reset vector, 8-25 SIGINT, 2-20
INDEX
• • • • • • • •
Index-18 TriCore Reference Manual
• • • • • • • •
Index-20 TriCore Reference Manual
INDEX