1 /*
2 * Copyright (c) 2008 Texas Instruments and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Texas Instruments - initial implementation
10 *
11 * */
12 /*
13 * ======== ITarget.xdc ========
14 *
15 */
16
17 /*!
18 * ======== ITarget ========
19 * A TI specific extension to the base `xdc.bld.ITarget` interface.
20 */
21 @TargetHeader("xdc/bld/stddefs.xdt")
22 metaonlyinterface ITarget inherits xdc.bld.ITarget {
23
24 overridereadonlyconfig string stdInclude = "ti/targets/std.h";
25
26 /*!
27 * ======== Command ========
28 * Required command and options.
29 *
30 * The compile, link, and archive functions in this interface are
31 * implemented by expanding the strings specified in this structure
32 * and inserting strings from the Options structure to form a single
33 * command. The strings in this structure can not be changed by
34 * the user (they are fixed by the target), but the string in the
35 * Options structure may be changed by the user.
36 *
37 * The final command is:
38 * Command.cmd Options.prefix Command.opts Options.suffix
39 *
40 * @field(cmd) name of a tool-chain executable without any path
41 * information. The location of this executable is
42 * specified by the binDir (or pathPrefix)
43 * configuration parameter.
44 *
45 * @field(opts) required options passed to the command; these options
46 * can not be changed or eliminated by user's
47 * configuration script.
48 */
49 struct Command {
50 string cmd; /*! the command to run */
51 string opts; /*! required options for the command */
52 }
53
54 /*!
55 * ======== Options ========
56 * User configurable command options.
57 *
58 * The option strings allow the user to pass additional parameters to the
59 * executable that is responsible for compiling, linker, or archiving.
60 * See `ti.targets.ITarget.Command`.
61 */
62 struct Options {
63 string prefix; /*! options that appear before Command.opts */
64 string suffix; /*! options that appear after Command.opts */
65 }
66
67 /*!
68 * ======== binDir ========
69 * This parameter controls the location of the target's commands.
70 *
71 * All build commands returned within a command set
72 * (`xdc.bld.ITarget.CommandSet.cmds`) are formed by prefixing `binDir`
73 * to this target's Command.cmd specification. For example, the
74 * compile command returned is formed as follows:
75 * @p(code) 76 * $(binDir)$(cc.cmd)
77 * @p 78 * where, `$(binDir)` is this target's `binDir` value and `$(cc.cmd)` is
79 * the value of this target's `cc.cmd` string.
80 *
81 * If `binDir` is non-empty then it must end with '/'. If it is empty,
82 * the target's commands (compiler, linker, archiver, etc.) will be
83 * located along a path constructed from this target's `pathPrefix`.
84 */
85 config string binDir = "$(rootDir)/bin/";
86
87 /*!
88 * ======== pathPrefix ========
89 * A prefix to the PATH environment variable
90 *
91 * Each target command is executed with C_DIR set to "" and PATH
92 * set as follows:
93 * @p(code) 94 * $(pathPrefix);$(binDir);$(PATH)
95 * @p 96 * where, `$(pathPrefix)` and `$(binDir)` are the values of the
97 * configuration parameters and `$(PATH)` is the value of the `PATH`
98 * environment variable set by the `xdc` command (type 'xdc -n' to
99 * see this).
100 *
101 * Embedded ';' characters within `pathPrefix` separate directory
102 * names. On UNIX hosts these ';' characters are convered to an
103 * appropriate separator; i.e., ':'.
104 */
105 config string pathPrefix = "";
106
107 overrideconfig String binaryParser = "ti.targets.omf.cof.Coff";
108
109 /*!
110 * ======== debugGen ========
111 * TI Debugger/IDE file generation support.
112 *
113 * The settings below generate CCS project files that enable one
114 * to debug (and even rebuild) Executables from within the CCS GUI.
115 *
116 * To avoid unnecessary build time overhead, these files are not always
117 * generated; by default, they are only generated for "debug" profiles.
118 * The generation of these files is controlled by the
119 * `{@link xdc.cfg.Program#gen}` configuration parameter. To force these
120 * files to be generated for a particular executable, add the following
121 * line to the executable's program configuration script:
122 * @p(code) 123 * Program.gen.debuggerFiles = true;
124 * @p 125 * It is also possible to control the generation via build options; see
126 * `{@link xdc.bld.ITarget#DebugGen}`.
127 *
128 * Note: if you are using CCS 2.x, disable CodeMaestro to prevent
129 * instabilities when re-loading project files. CodeMaestro can be
130 * disabled via: Options->"Customize ..."->"CodeMaestro Settings"
131 *
132 * To debug an executable:
133 * @p(nlist) 134 * - load generated project for the executable:
135 * package/cfg/<cfg_name>.pjt
136 * - load generated GEL script for the executable:
137 * package/cfg/<cfg_name>.gel
138 * - load prerequisite packages:
139 * GEL->"XDC Package"->open_project
140 * @p 141 * where <cfg_name> is the name of the executable (foo.x62) with the
142 * '.' replaced by and '_' (foo_x62).
143 *
144 * Alternatively, one can use the `ccs_start.pl` script in this package
145 * to automate the steps above. In addition, it is possible to
146 * associate `ccs_start.bat` (also in this package) with the generated
147 * `.pjt` files to automate the above by double-clicking on the `.pjt`
148 * file.
149 *
150 * To avoid navigation to the executable via file menus, you can load
151 * the executable associated with the project via:
152 *
153 * GEL->"XDC Package"->load_executable
154 *
155 * @a(See Also) `xdc.bld.ITarget` contains addition information about
156 * how to create and use these templates.
157 */
158 overrideconfig xdc.bld.ITarget.DebugGen debugGen = {
159 execTemplate : "ti/targets/ccs_exec.xdt",
160 execPattern : "$(cfgDir)$(cfgName).pjt",
161 packageTemplate: "ti/targets/ccs_package.xdt",
162 packagePattern : "package/$(pkgName).pjt"
163 };
164
165 /*!
166 * ======== extensions ========
167 * File extensions recognized by TI targets
168 *
169 * @a(TI Specifics) 170 * For TI targets, the `typ` string field of an
171 * `xdc.bld.ITarget.Extension` structure may be of the form
172 * `"<cmd>:<langOpt>"` where `<cmd>` is one of `"asm"`, `"c"`, `"cpp"`,
173 * and `<langOpt>` is the language option to used to identify the source
174 * language of a source file. This allows one to explicitly control the
175 * language flag passed to the compiler based on a source file's
176 * extension; in particular, one can define separate source extensions
177 * for "linear" and "scheduled" assembly files, or simply cause `".s62"`
178 * files to be treated as "linear" assembly rather than "scheduled"
179 * assembly.
180 *
181 * For example,
182 * @p(code) 183 * tiTargets.C62.extensions[".s62"] = {suf: ".s62", typ: "asm:-fl"};
184 * @p 185 * causes all `".s62"` files to be treated as linear assembly.
186 *
187 * If no ':' appears in the `typ` string, a default will be used:
188 * `"-fa"` for `"asm"` files `"-fc"` for `"c"` files, and `"-fp"` for
189 * `"cpp"` files.
190 */
191 overrideconfig xdc.bld.ITarget.Extension extensions[string] =
192 xdc.bld.ITarget.extensions;
193
194 /*!
195 * ======== profiles ========
196 * Standard options profiles for the TI tool-chain.
197 */
198 overrideconfig xdc.bld.ITarget.OptionSet profiles[string] = [
199 ["debug", {
200 compileOpts: {
201 copts: "-g",
202 defs: "-D_DEBUG_=1",
203 }
204 }],
205 ["release", {
206 compileOpts: {
207 copts: "-O2",
208 },
209 }],
210 ["profile", {
211 compileOpts: {
212 copts: "-gp",
213 },
214 }],
215 ["coverage", {
216 compileOpts: {
217 copts: "-gp",
218 },
219 }],
220 ["whole_program", {
221 compileOpts: {
222 copts: "-oe -O2 -mo",
223 },
224 }],
225 ["whole_program_debug", {
226 compileOpts: {
227 copts: "-oe --symdebug:dwarf -mo",
228 },
229 }],
230 ];
231
232 /*!
233 * ======== versionMap ========
234 * Map of TI compiler version numbers to compatibility keys.
235 *
236 * This map translates version string information from the compiler
237 * into a compatibility key. The compatibility key is used to validate
238 * consistency among a collection of packages used in a configuration.
239 *
240 * TI compiler strings are formed by parsing the output of the
241 * compiler's -version option and creating a string of the form:
242 * @p(code) 243 * <comp>_<ver>
244 * @p 245 * where `<comp>` is the first word of the output and `<ver>` is the
246 * version number that appears on this same line.
247 *
248 * There are two forms of version numbers output by the TI code gen
249 * tools; an "old" style that is of the form "<major>.<minor>" and a
250 * new style of the form "<major>.<minor>.<update>[.<branch>][<qual>],
251 * where <major>, <minor>, <update>, and <branch> are non-negative
252 * integers and <qual> is of the form "[IBAP]<yyddd>", and <yyddd>
253 * is the last two digits of the year concatenated with the number of
254 * the day.
255 *
256 * If a compiler version is not found in this map the default is
257 * "1,0,<major>.<minor>" for old style version numbers, and
258 * "1,0,<major>.<minor>,<update>[.<branch>][,<yyddd>]" for new style
259 * version numbers.
260 *
261 * The user only needs to extend this table when a significant
262 * incompatibility occurs (and this package doesn't know about it) or
263 * when two versions of the compiler should be treated as 100%
264 * compatible.
265 *
266 * @a(Examples) 267 * @p(code) 268 * var C62 = xdc.useModule('ti.targets.C62');
269 *
270 * // assert that 4.0 is forward compatible with 4.32
271 * C62.versionMap["TMS320C6x_4.32"] = "1,0,4.0,0";
272 *
273 * // assert that 4.28 is incompatible with all other compilers
274 * C62.versionMap["TMS320C6x_4.28"] = "1,1,4.28,0";
275 */
276 overrideconfig string versionMap[string] = [
277 ["TMS320C6x_4.32", "1,0,4.32,0"],
278 ["TMS320C55x_2.56", "1,0,2.56,0"],
279 ["TMS320C54x_3.83", "1,0,3.83,0"],
280 ["TMS320C2000_3.07", "1,0,3.07,0"],
281 ];
282
283 /*!
284 * ======== alignDirectiveSupported ========
285 * The compiler supports an align directive.
286 */
287 overridereadonlyconfig Bool alignDirectiveSupported = true;
288
289 /*!
290 * ======== ar ========
291 * The command used to create an archive
292 */
293 readonlyconfig Command ar;
294
295 /*!
296 * ======== arOpts ========
297 * User configurable archiver options.
298 */
299 config Options arOpts = {
300 prefix: "",
301 suffix: ""
302 };
303
304 /*!
305 * ======== lnk ========
306 * The command used to link executables.
307 */
308 readonlyconfig Command lnk;
309
310 /*!
311 * ======== lnkOpts ========
312 * User configurable linker options.
313 */
314 config Options lnkOpts = {
315 prefix: "",
316 suffix: ""
317 };
318
319 /*!
320 * ======== cc ========
321 * The command used to compile C/C++ source files into object files
322 */
323 readonlyconfig Command cc;
324
325 /*!
326 * ======== ccOpts ========
327 * User configurable compiler options.
328 */
329 config Options ccOpts = {
330 prefix: "",
331 suffix: ""
332 };
333
334 /*!
335 * ======== ccConfigOpts ========
336 * User configurable compiler options for the generated config C file.
337 *
338 * By default, this parameter inherits values specified in ccOpts, by
339 * expanding $(ccOpts.prefix) and $(ccOpts.suffix) into the values
340 * specified in ccOpts for this target.
341 */
342 config Options ccConfigOpts = {
343 prefix: "$(ccOpts.prefix) -mo",
344 suffix: "$(ccOpts.suffix)"
345 };
346
347 /*!
348 * ======== asm ========
349 * The command used to assembles assembly source files into object files
350 */
351 readonlyconfig Command asm;
352
353 /*!
354 * ======== asmName ========
355 * The function that converts a C name into an assembly name
356 */
357 String asmName(String CName);
358
359 /*!
360 * ======== asmOpts ========
361 * User configurable assembler options.
362 */
363 config Options asmOpts = {
364 prefix: "",
365 suffix: ""
366 };
367
368 /*!
369 * ======== vers ========
370 * The command used to get the tool-chain to return a version number.
371 */
372 readonlyconfig Command vers;
373
374 /*!
375 * ======== version ========
376 * The Compatibility Key associated with this target.
377 *
378 * The first two components of this target Compatibility Key are '1,0'.
379 * The rest of the Key represents the compiler version. The third
380 * component combines the major and the minor version number in the format
381 * Major.Minor. The fourth component is the patch number, and the optional
382 * fifth component is the version of an Alpha or Beta release.
383 *
384 * @a(Example) 385 * If this target's `rootDir` points to the compiler version 6.0.11, the
386 * Compatibility Key is [1,0,6.0,11]. If this target's `rootDir` points to
387 * the compiler version 7.0.0B1, the Compatibility Key is [1,0,7.0,0,1].
388 *
389 */
390 overridemetaonlyconfig String version;
391
392 /*!
393 * ======== includeOpts ========
394 * Additional user configurable target-specific include path options
395 */
396 config string includeOpts;
397 }
398 /*
399 * @(#) ti.targets; 1, 0, 3,320; 7-29-2009 16:34:47; /db/atree/library/trees/xdctargets/xdctargets-b12x/src/
400 */
401