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 * ======== gnu.targets.ITarget ========
14 * Interface to GCC compatible compilers
15 */
16 @TargetHeader("xdc/bld/stddefs.xdt")
17 metaonlyinterface ITarget inherits xdc.bld.ITarget {
18
19 overridereadonlyconfig string stdInclude = "gnu/targets/std.h";
20 overrideconfig string dllExt = ".so";
21
22 /*!
23 * ======== GCCVERS ========
24 * Version number of the GCC compiler; e.g., "3.2".
25 *
26 * This string can be supplied by the user, otherwise it is obtained
27 * by running "gcc -dumpversion".
28 */
29 config string GCCVERS = null;
30
31 /*!
32 * ======== version ========
33 * The Compatibility Key associated with this target.
34 *
35 * The first two components of this target's Compatibility Key are '1,0'.
36 * The rest of the Key represents the compiler version. The third
37 * component combines the major and the minor version number in the format
38 * Major.Minor. The fourth component is the patch number.
39 *
40 * @a(Example) 41 * If this target's `rootDir` points to the compiler version 3.4.6, the
42 * Compatibility Key is [1,0,3.4,6].
43 *
44 */
45 overridemetaonlyconfig String version;
46
47 /*!
48 * ======== GCCTARG ========
49 * The name of the platform executing programs produced by this target
50 *
51 * This string can be supplied by the user, otherwise is is obtained
52 * from the compiler and follows the GNU standard format
53 * (<cpu>-<manufacturer>-<os> or <cpu>-<manufacturer>-<kernel>-<os>);
54 * e.g., "sparc-sun-solaris2.6" or "i586-pc-linux-gnu".
55 *
56 * When building a GCC compiler, there are three different execution
57 * platforms to consider: the platform used to "build" the compiler, the
58 * "host" platform that runs the compiler, and the "target" platform
59 * that runs the executables produced by the compiler. All three
60 * platforms are identified using a
61 * {@link http://sources.redhat.com/autobook/autobook/autobook_17.html configuration name}
62 * defined by GNU Autotools. `GCCTARG` is the name of the "target"
63 * platform.
64 */
65 config string GCCTARG = null;
66
67 /*!
68 * ======== LONGNAME ========
69 * The "long name" of the gcc compiler
70 *
71 * This name is used (in conjunction with rootDir) to find the compiler
72 * and linker for this target. The format of `LONGNAME` is always
73 * "/bin/<machine>-gcc". For majority of the targets, the default value
74 * for `LONGNAME` does not ever need to be changed. But, there are
75 * targets where the different but compatible compilers may have
76 * different `LONGNAME` parameters. For such targets and compilers,
77 * `LONGNAME` can be set in `config.bld`.
78 *
79 * @a(Example) 80 * If a version 2007q3 of the CodeSourcery GNU toolchain for Arm is
81 * installed in C:/CodeSourcery/arm-2007q3, the following settings in
82 * `config.bld` configure `gnu.targets.arm.GCArmv6` target to use that
83 * toolchain:
84 * @p(code) 85 * var GCArmv6 = xdc.module("gnu.targets.arm.GCArmv6");
86 * GCArmv6.rootDir = "C:/CodeSourcery/arm-2007q3";
87 * GCArmv6.LONGNAME = "bin/arm-none-linux-gnueabi-gcc";
88 * @p 89 *
90 */
91 config string LONGNAME = "/bin/gcc";
92
93 /*!
94 * ======== CYGWIN ========
95 * Is the target's compiler a cygwin executable
96 *
97 * Since file names produced by cygin-based tools differ from the
98 * names understood by other Windows executables, it is important
99 * to avoid using the names output by cygwin tools as input to
100 * non-cygwin programs. This property tells the target whether
101 * or not it's possible to use the output from `gcc -MD -MF`, for
102 * example.
103 */
104 readonlyconfig Bool CYGWIN = false;
105
106 /*!
107 * ======== noStdLinkScript ========
108 * Don't use the standard linker script
109 *
110 * If `true`, add a `-T` flag before the generated `package/cfg/*.xdl`
111 * file passed to the linker. This flag suppresses use of the
112 * standard linker script implicit in the GCC flow, which effectively
113 * says the generated `.xdl` file assumes total control for all
114 * `MEMORY` and `SECTION` directives.
115 *
116 */
117 config Bool noStdLinkScript = false;
118
119 /*
120 * ======== profiles ========
121 */
122 overrideconfig xdc.bld.ITarget.OptionSet profiles[string] = [
123 ["debug", {
124 compileOpts: {
125 copts: "-g",
126 defs: "-D_DEBUG_=1",
127 },
128 linkOpts: "-g",
129 }],
130
131 ["release", {
132 compileOpts: {
133 copts: "-O2",
134 },
135 linkOpts: "",
136 }],
137
138 ["profile", {
139 compileOpts: {
140 copts: "-g -pg",
141 },
142 linkOpts: "-pg"/* can't use -static here */
143 }],
144
145 ["coverage", {
146 compileOpts: {
147 copts: "-fprofile-arcs -ftest-coverage",
148 },
149 linkOpts: "",
150 }],
151 ];
152
153 /*!
154 * ======== versionMap ========
155 * Map of GCC compiler version numbers to compatibility keys.
156 *
157 * This map translates version string information from the compiler
158 * into a compatibility key. The compatibilty key is used to
159 * validate consistency among a collection of packages used in
160 * a configuration.
161 *
162 * The compiler version string is "gcc<ver>", where <ver> is
163 * GCCVERS.
164 *
165 * If a compiler version is not found in this map the default is
166 * "1,0,<ver>", where <ver> is the compiler version number. Thus,
167 * the user only needs to extend this table when a significant
168 * incompatibility occurs or when two versions of the compiler should
169 * be treated as 100% compatible.
170 */
171 overrideconfig string versionMap[string] = [
172 ["gcc3.2", "1,0,3.2,0"],
173 ];
174
175 /*!
176 * ======== Command ========
177 * Required command and options.
178 *
179 * The compile, link, and archive functions in this interface are
180 * implemented by expanding the strings specified in this structure
181 * and inserting strings from the Options structure to form a single
182 * command. The strings in this structure can not be changed by
183 * the user (they are fixed by the target), but the string in the
184 * Options structure may be changed by the user.
185 *
186 * The final command is:
187 * Command.cmd Options.prefix Command.opts Options.suffix
188 *
189 * @field(cmd) name of a tool-chain executable without any path
190 * information. The location of this executable is
191 * specified by the binDir (or pathPrefix)
192 * configuration parameter.
193 *
194 * @field(opts) required options passed to the command; these options
195 * can not be changed or eliminated by user's
196 * configuration script.
197 */
198 struct Command {
199 string cmd; /*! the command to run */
200 string opts; /*! required options for the command */
201 }
202
203 /*!
204 * ======== Options ========
205 * User configurable command options.
206 *
207 * The option strings allow the user to pass additional parameters to the
208 * executable that is responsible for compiling, linker, or archiving.
209 * See ti.targets.ITarget.Command.
210 */
211 struct Options {
212 string prefix; /*! options that appear before Command.opts */
213 string suffix; /*! options that appear after Command.opts */
214 }
215
216 /*!
217 * ======== remoteHost ========
218 * Remote host used to run compiler, linker, and archiver tools
219 *
220 * If `remoteHost` is `null` (or `undefined`), the configured compiler
221 * is run locally; otherwise, `remoteHost` is taken to be the host name
222 * of the machine that that should be used to run the specified compiler.
223 *
224 * All target commands are prefixed with a command that uses `rsh` to run
225 * the commands on the specified host. Thus, in order to use this
226 * setting, the remote machine must be support `rsh` and the user must
227 * have permission to run commands from the local machine on the remote
228 * host named `remoteHost`. This usually involves adding a line to the
229 * user's `~/.rhosts` file on the remote machine of the form:
230 * @p(code) 231 * local-machine-name user-name
232 * @p 233 * where `local-machine-name` is the name of the local machine and
234 * `user-name` is the user's login name on the local machine.
235 */
236 config string remoteHost;
237
238 /*!
239 * ======== ar ========
240 * The command used to create an archive
241 */
242 readonlyconfig Command ar = {
243 cmd: "$(rootDir)/$(GCCTARG)/bin/ar",
244 opts: "cr"
245 };
246
247 /*!
248 * ======== arOpts ========
249 * User configurable archiver options.
250 */
251 config Options arOpts = {
252 prefix: "",
253 suffix: ""
254 };
255
256 /*!
257 * ======== lnk ========
258 * The command used to link executables.
259 */
260 readonlyconfig Command lnk = {
261 cmd: "$(rootDir)/$(LONGNAME)",
262 opts: ""
263 };
264
265 /*!
266 * ======== lnkOpts ========
267 * User configurable linker options.
268 */
269 config Options lnkOpts = {
270 prefix: "",
271 suffix: ""
272 };
273
274 /*!
275 * ======== cc ========
276 * The command used to compile C/C++ source files into object files
277 */
278 readonlyconfig Command cc = {
279 cmd: "$(rootDir)/$(LONGNAME) -c -MD -MF $@.dep",
280 opts: ""
281 };
282
283 /*!
284 * ======== ccOpts ========
285 * User configurable compiler options.
286 */
287 config Options ccOpts = {
288 prefix: "",
289 suffix: ""
290 };
291
292 /*!
293 * ======== asm ========
294 * The command used to assembles assembly source files into object files
295 */
296 readonlyconfig Command asm = {
297 cmd: "$(rootDir)/$(LONGNAME) -c -x assembler",
298 opts: ""
299 };
300
301 /*!
302 * ======== asmOpts ========
303 * User configurable assembler options.
304 */
305 config Options asmOpts = {
306 prefix: "",
307 suffix: ""
308 };
309
310 /*!
311 * ======== includeOpts ========
312 * Additional user configurable target-specific include path options
313 */
314 config string includeOpts = "";
315 }
316 /*
317 * @(#) gnu.targets; 1, 0, 1,322; 7-29-2009 16:34:39; /db/atree/library/trees/xdctargets/xdctargets-b12x/src/
318 */
319