SPRU514Z July 2001 – October 2023 SM320F28335-EP
This is the general syntax for linking C/C++ programs as part of the compile step:
cl2000filenames [options] --run_linker [--rom_model | --ram_model] filenames | |
[options] [--output_file=name.out] --library=library [lnk.cmd] |
The --run_linker option divides the command line into the compiler options (the options before --run_linker) and the linker options (the options following --run_linker). The --run_linker option must follow all source files and compiler options on the command line.
All arguments that follow --run_linker on the command line are passed to the linker. These arguments can be linker command files, additional object files, linker options, or libraries. These arguments are the same as described in Section 4.1.1.
All arguments that precede --run_linker on the command line are compiler arguments. These arguments can be C/C++ source files, assembly files, or compiler options. These arguments are described in Section 2.2.
You can compile and link a C/C++ program consisting of object files prog1.c, prog2.c, and prog3.c, with an executable object file filename of prog.out with the command:
cl2000 prog1.c prog2.c prog3.c --run_linker --rom_model --output_file=prog.out
--library=rts2800_ml.lib
When you use cl2000 --run_linker after listing at least one C/C++ file to be compiled on the same command line, by default the --rom_model is used for automatic variable initialization at run time. See Section 4.3.5 for details about using the --rom_model and --ram_model options.
Order of Processing Arguments in the Linker: The order in which the linker processes arguments is important. The compiler passes arguments to the linker in the following order: