1 2 3 4 5 6 7 8 9 10 11
12 /*!
13 * ======== gnu.targets.ITarget ========
14 * Interface to GCC compatible compilers
15 */
16 @TargetHeader("xdc/bld/stddefs.xdt")
17 metaonly interface ITarget inherits xdc.bld.ITarget3 {
18
19 override readonly config string stdInclude = "gnu/targets/std.h";
20 override config 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 * ======== BINVERS ========
33 * Version number of binutils used with the compiler; e.g., "2.19".
34 *
35 * This string can be supplied by the user, otherwise it is obtained
36 * by running "ld -v".
37 */
38 config string BINVERS = null;
39
40 /*!
41 * ======== version ========
42 * The Compatibility Key associated with this target.
43 *
44 * The first two components of this target's Compatibility Key are '1,0'.
45 * The rest of the Key represents the compiler version. The third
46 * component combines the major and the minor version number in the format
47 * Major.Minor. The fourth component is the patch number.
48 *
49 * @a(Example)
50 * If this target's `rootDir` points to the compiler version 3.4.6, the
51 * Compatibility Key is [1,0,3.4,6].
52 *
53 */
54 override metaonly config String version;
55
56 /*!
57 * ======== GCCTARG ========
58 * The name of the platform executing programs produced by this target
59 *
60 * This string can be supplied by the user, otherwise is is obtained
61 * from the compiler and follows the GNU standard format
62 * (<cpu>-<manufacturer>-<os> or <cpu>-<manufacturer>-<kernel>-<os>);
63 * e.g., "arm-none-eabi" or "x86_64-unknown-linux-gnu".
64 *
65 * When building a GCC compiler, there are three different execution
66 * platforms to consider: the platform used to "build" the compiler, the
67 * "host" platform that runs the compiler, and the "target" platform
68 * that runs the executables produced by the compiler. All three
69 * platforms are identified using a
70 * {@link http://sources.redhat.com/autobook/autobook/autobook_17.html configuration name}
71 * defined by GNU Autotools. `GCCTARG` is the name of the "target"
72 * platform.
73 */
74 config string GCCTARG = null;
75
76 /*!
77 * ======== LONGNAME ========
78 * @_nodoc
79 * The "long name" of the gcc compiler
80 *
81 * This name is used (in conjunction with rootDir) to find the compiler
82 * and linker for this target. The format of `LONGNAME` is always
83 * "/bin/<machine>-gcc". For majority of the targets, the default value
84 * for `LONGNAME` does not ever need to be changed. But, there are
85 * targets where the different but compatible compilers may have
86 * different `LONGNAME` parameters. For such targets and compilers,
87 * `LONGNAME` can be set in `config.bld`.
88 *
89 * @a(Example)
90 * If a version 2010q1 of the CodeSourcery GNU toolchain for Arm is
91 * installed in C:/CodeSourcery/arm-2010q1, the following settings in
92 * `config.bld` configure `gnu.targets.arm.GCArmv6` target to use that
93 * toolchain:
94 * @p(code)
95 * var GCArmv6 = xdc.module("gnu.targets.arm.GCArmv6");
96 * GCArmv6.rootDir = "C:/CodeSourcery/arm-2010q1";
97 * GCArmv6.LONGNAME = "bin/arm-none-linux-gnueabi-gcc";
98 * @p
99 *
100 */
101 config string LONGNAME = null;
102
103 /*!
104 * ======== CYGWIN ========
105 * Is the target's compiler a cygwin executable
106 *
107 * Since file names produced by cygwin-based tools differ from the
108 * names understood by other Windows executables, it is important
109 * to avoid using the names output by cygwin tools as input to
110 * non-cygwin programs. This property tells the target whether
111 * or not it's possible to use the output from `gcc -MD -MF`, for
112 * example.
113 */
114 readonly config Bool CYGWIN = false;
115
116 /*!
117 * ======== noStdLinkScript ========
118 * Don't use the standard linker script
119 *
120 * If `true`, add a `-T` flag before the generated `package/cfg/*.xdl`
121 * file passed to the linker. This flag suppresses use of the
122 * standard linker script implicit in the GCC flow, which effectively
123 * says the generated `.xdl` file assumes total control for all
124 * `MEMORY` and `SECTION` directives.
125 *
126 */
127 config Bool noStdLinkScript = false;
128
129 130 131
132 override config xdc.bld.ITarget.OptionSet profiles[string] = [
133 ["debug", {
134 compileOpts: {
135 copts: "-g",
136 defs: "-D_DEBUG_=1",
137 },
138 linkOpts: "-g",
139 }],
140
141 ["release", {
142 compileOpts: {
143 copts: "-O2 -ffunction-sections -fdata-sections",
144 },
145 linkOpts: "-Wl,--gc-sections",
146 }],
147
148 ["profile", {
149 compileOpts: {
150 copts: "-g -pg",
151 },
152 linkOpts: "-pg"
153 }],
154
155 ["coverage", {
156 compileOpts: {
157 copts: "-fprofile-arcs -ftest-coverage",
158 },
159 linkOpts: "-fprofile-arcs -ftest-coverage",
160 }],
161 ];
162
163 /*!
164 * ======== versionMap ========
165 * Map of GCC compiler version numbers to compatibility keys.
166 *
167 * This map translates version string information from the compiler
168 * into a compatibility key. The compatibilty key is used to
169 * validate consistency among a collection of packages used in
170 * a configuration.
171 *
172 * The compiler version string is "gcc<ver>", where <ver> is
173 * GCCVERS.
174 *
175 * If a compiler version is not found in this map the default is
176 * "1,0,<ver>", where <ver> is the compiler version number. Thus,
177 * the user only needs to extend this table when a significant
178 * incompatibility occurs or when two versions of the compiler should
179 * be treated as 100% compatible.
180 */
181 override config string versionMap[string] = [
182 ["gcc3.2", "1,0,3.2,0"],
183 ];
184
185 /*!
186 * ======== remoteHost ========
187 * Remote host used to run compiler, linker, and archiver tools
188 *
189 * If `remoteHost` is `null` (or `undefined`), the configured compiler
190 * is run locally; otherwise, `remoteHost` is taken to be the host name
191 * of the machine that that should be used to run the specified compiler.
192 *
193 * All target commands are prefixed with a command that uses `rsh` to run
194 * the commands on the specified host. Thus, in order to use this
195 * setting, the remote machine must be support `rsh` and the user must
196 * have permission to run commands from the local machine on the remote
197 * host named `remoteHost`. This usually involves adding a line to the
198 * user's `~/.rhosts` file on the remote machine of the form:
199 * @p(code)
200 * local-machine-name user-name
201 * @p
202 * where `local-machine-name` is the name of the local machine and
203 * `user-name` is the user's login name on the local machine.
204 */
205 config string remoteHost;
206
207 /*!
208 * ======== ar ========
209 * The command used to create an archive
210 */
211 override readonly config xdc.bld.ITarget2.Command ar = {
212 cmd: "$(rootDir)/bin/ar",
213 opts: "cr"
214 };
215
216 /*!
217 * ======== lnk ========
218 * The command used to link executables.
219 */
220 override readonly config xdc.bld.ITarget2.Command lnk = {
221 cmd: "$(rootDir)/bin/gcc",
222 opts: ""
223 };
224
225 override config xdc.bld.ITarget2.Options lnkOpts = {
226 prefix: "",
227 suffix: "-Wl,-Map=$(XDCCFGDIR)/$@.map -lstdc++ -L$(rootDir)/lib"
228 };
229
230 /*!
231 * ======== cc ========
232 * The command used to compile C/C++ source files into object files
233 */
234 override readonly config xdc.bld.ITarget2.Command cc = {
235 cmd: "$(rootDir)/bin/gcc -c -MD -MF $@.dep",
236 opts: ""
237 };
238
239 /*!
240 * ======== asm ========
241 * The command used to assembles assembly source files into object files
242 */
243 override readonly config xdc.bld.ITarget2.Command asm = {
244 cmd: "$(rootDir)/bin/gcc -c -x assembler",
245 opts: ""
246 };
247
248 /*!
249 * ======== includeOpts ========
250 * Additional user configurable target-specific include path options
251 */
252 override config string includeOpts = "";
253
254 override config String binaryParser = "ti.targets.omf.elf.Elf32";
255
256 257 258 259
260 String initVers();
261
262 /*!
263 * ======== asmName ========
264 * The function that converts a C name into an assembly name
265 */
266 String asmName(String CName);
267
268 /*!
269 * ======== bspLib ========
270 * bspLib is assigned the name of the BSP library. The specified library
271 * is included on the link line.
272 */
273 config string bspLib = null;
274 }
275 276 277 278
279