TASKING VX-toolset for TriCore User Guide
Options
The control program accepts several command line options. If you specify an unknown option to the control program, the control program looks if it is an option for a specific tool. If so, it passes the option directly to the tool. However, it is recommended to use the control program options --pass-* (-Wcp, -Wc,
-Wa, -Wl, -Wpl) to pass arguments directly to tools.
For a complete list and description of all control program options, see
Section 11.5, Control Program
Options
.
Example with verbose output
cctc --verbose test.c
The control program calls all tools in the toolset and generates the absolute object file test.elf
. With option --verbose (-v) you can see how the control program calls the tools:
+ "path\ctc" -o cc3248a.src test.c
+ "path\astc" -o cc3248b.o cc3248a.src
+ "path\ltc" -o test.elf -dextmem.lsl -ddefault.lsl --map-file
cc3248b.o "-Lpath\lib\tc1" -lc -lfp -lrt
The control program produces unique filenames for intermediate steps in the compilation process (such as cc3248a.src
and cc3248b.o
in the example above) which are removed afterwards, unless you specify command line option --keep-temporary-files (-t).
Example with argument passing to a tool
cctc --pass-compiler=-Oc test.c
The option -Oc is directly passed to the compiler.
9.2. Make Utility
If you are working with large quantities of files, or if you need to build several targets, it is rather time-consuming to call the individual tools to compile, assemble, link and locate all your files.
You save already a lot of typing if you use the control program and define an options file. You can even create a batch file or script that invokes the control program for each target you want to create. But with these methods all files are completely compiled, assembled and linked to obtain the target file, even if you changed just one C source. This may demand a lot of (CPU) time on your host.
The make utility mktc is a tool to maintain, update, and reconstruct groups of programs. The make utility looks which files are out-of-date and only recreates these files to obtain the updated target.
Make process
In order to build a target, the make utility needs the following input:
• the target it should build, specified as argument on the command line
252
Using the Utilities
• the rules to build the target, stored in a file usually called makefile
In addition, the make utility also reads the file mktc.mk
which contains predefined rules and macros. See
Section 9.2.2, Writing a Makefile
.
The makefile
contains the relationships among your files (called dependencies) and the commands that are necessary to create each of the files (called rules). Typically, the absolute object file (
.elf
) is updated when one of its dependencies has changed. The absolute file depends on
.o
files and libraries that must be linked together. The
.o
files on their turn depend on
.src
files that must be assembled and finally,
.src
files depend on the C source files (
.c
) that must be compiled. In the makefile
this looks like: test.src : test.c # dependency
ctc test.c # rule test.o : test.src
astc test.src
test.elf : test.o
ltc test.o -o test.elf --map-file -lc -lfp -lrt
You can use any command that is valid on the command line as a rule in the makefile
. So, rules are not restricted to invocation of the toolset.
Example
To build the target test.elf
, call mktc with one of the following lines: mktc test.elf
mktc --option-file=mymake.mak test.elf
By default the make utility reads the file makefile
so you do not need to specify it on the command line.
If you want to use another name for the makefile, use the option --option-file (-f).
If you do not specify a target, mktc uses the first target defined in the makefile. In this example it would build test.src
instead of test.elf
.
Based on the sample invocation, the make utility now tries to build test.elf
based on the makefile and performs the following steps:
1. From the makefile the make utility reads that test.elf
depends on test.o
.
2. If test.o
does not exist or is out-of-date, the make utility first tries to build this file and reads from the makefile that test.o
depends on test.src
.
3. If test.src
does exist, the make utility now creates test.o
by executing the rule for it: astc test.src
.
253