1nescc(1) General Commands Manual nescc(1)
2
3
4
6 nescc - nesC compiler
7
9 nescc [-gcc=gcc-name] [-mingw-gcc] [-fnesc-target=architecture]
10 [-docdir=dir] [-topdir=dir] [-graphviz=y|n]
11 [-fnesc-simulate]
12 [-fnesc-nido-tosnodes=n] [-fnesc-nido-motenumber=expression]
13 [-conly] [-fnesc-cfile=file] [-fnesc-gccize]
14 [-fnesc-cppdir=directory] [-fnesc-separator=separator]
15 [-fnesc-no-inline] [-fnesc-optimize-atomic]
16 [--version] [-fnesc-verbose] [-Wnesc-...]
17 [-fnesc-dump=specification] [-fnesc-dumpfile=file]
18 [-fnesc-scheduler=specification]
19 [any gcc option] files...
20
22 nescc is an extension to gcc that knows how to compile nesC applica‐
23 tions. If invoked on regular C files, it behaves exactly like gcc. When
24 invoked on a nesC component or interface (.nc extension) file it com‐
25 piles and links (except if the -c, -S, -conly, -E or -fsyntax-only
26 options are used) that component with the other files specified on the
27 command line.
28
30 nescc accepts all gcc options, and some additional nesC specific
31 options:
32
33 -gcc=gcc-name
34 Specify which gcc compiler to use to compile and link any C
35 files, either explicitly specified, or generated as the output
36 of the nesC-to-C compiler. This option supports cross-compila‐
37 tion of nesC code (the usual mode of operation...).
38
39 -mingw-gcc
40 Pass this option if the gcc version specified with -gcc=... was
41 compiled for Window's mingw environment, and hence expects Win‐
42 dows-style rather than Unix-style paths.
43
44 -fnesc-target=architecture
45 Specify the target architecture to compile for. Currently sup‐
46 ported platforms are avr (the Atmel AVR family), msp430 (the TI
47 MSP430 family) and self (the machine the nesC compiler is run‐
48 ning on). If you use the env target, the architecture details
49 are read from the NESC_MACHINE environment variable. See the
50 separate env target documentation for details.
51
52 -docdir=dir
53 Generate documentation for the compiled component in directory
54 dir.
55
56 -topdir=dir
57 Specify directory paths that should be stripped from the source
58 file names when generating "package names" for the documentation
59 files.
60
61 -graphviz=y|n
62 Explicitly enable or disable the use of the graphviz tool in the
63 generated documentation. Without this option, graphviz is
64 enabled iff the dot program is found in the current path. Use of
65 graphviz requires dot. The documentation generation tool checks
66 the version of dot, and enables client-side image maps, if sup‐
67 ported.
68
69 -fnesc-simulate
70 Compile for a simulation environment.
71
72 -fnesc-nido-tosnodes=n, -fnesc-nido-motenumber=expression
73 When -fnesc-simulate is specified, the nesC program is compiled
74 for a simulation environment, where a single executable will
75 simulate n nodes. Specifically, in the generated code, each
76 global variable becomes an n element array, and all accesses to
77 global variables are indexed with expression.
78
79 -conly Just compile to C, leaving the generated source code for top-
80 level-component comp.nc in C file comp.c (except if the -fnesc-
81 cfile option is specified).
82
83 -fnesc-cfile=file
84 Specify a file in which to save the C code generated when com‐
85 piling a component. Note: if you specify two components on the
86 command line, then the C code from the second one will overwrite
87 the C code from the first.
88
89 -fnesc-gccize
90 Output target-specific extensions as gcc-style attributes rather
91 than using the target's original syntax. Can help if using
92 -conly and sending the nesC output from some other tool that
93 understands gcc attributes but not the target-specific exten‐
94 sions.
95
96 -fnesc-cppdir=directory
97 Save all preprocessing results in directory. The directory is
98 created if it doesn't exist. This can be helpful to track down
99 preprocessor-related compilation problems. You probably want to
100 ensure that directory is empty when you call nescc, to make it
101 obvious which files where preprocessed as part of the current
102 compilation.
103
104 -fnesc-separator=separator
105 Set separator used to create symbol names in the generated C
106 code (default $). The compiler needs to generate unique names
107 to denote, e.g., a module variable. It does this by concatenat‐
108 ing various symbol names to ensure that it generates unique
109 names. For instance, variable bar in module Maz becomes a global
110 C variable Maz$bar in the compiler output. Some C compilers do
111 not like $ in symbol names, so you can specify a different sepa‐
112 rator, e.g., __ (leading to generated symbols like Maz__bar).
113
114 You will get a compile-time warning if any symbol in the program
115 being compiled contains the separator you specify (the presence
116 of the separator in a symbol could lead to the generation of
117 incorrect code). The separator can however start or end a sym‐
118 bol.
119
120 -fnesc-no-inline
121 Disabled the automatic inlining of all small functions, and of
122 all functions with a single call site.
123
124 -fnesc-optimize-atomic
125 Optimize atomic statements [EXPERIMENTAL]: reduce or remove the
126 overhead of atomic statements in simple cases (e.g., single-byte
127 reads).
128
129 --version
130 Print the version of nescc and of the selected gcc compiler (see
131 -gcc).
132
133 -fnesc-include=header-file
134 Include the specified file before compiling a nesC component.
135 Behaves as if includes header-file; was included at the start of
136 that component.
137
138 -fnesc-dump=specification
139 Output information on the compiled programs structure, and in
140 particular its user-specified attributes. For more details, see
141 the separate nesC dump documentation.
142
143 -fnesc-dumpfile=file
144 Where to output the information requested by -fnesc-dump.
145 Defaults to stdout.
146
147 -fnesc-verbose
148 Be more verbose than -v.
149
150 -fnesc-scheduler=component,unique-string,interface-name,interface-defi‐
151 nition,run-event,post-command
152 By default, nesC compiles uses of task void taskname() ... to
153 void taskname(), and post taskname() to TOS_post(taskname).
154
155 With this option, each task gets its own interface-definition
156 interface, the task implementation is transformed into a run-
157 event event and posts becomes a call to the post-command com‐
158 mand. This per-task interface is automatically connected to the
159 parameterised interface-name interface of scheduler component
160 component. The parameter id for the connection is chosen with
161 unique("unique-string").
162
163 There are a number of warnings specific to nesC, specified with -Wnesc-
164 (all these warnings are off by default):
165
166 -Wnesc-fnptr
167 Warn when function pointers are used (use of function pointers
168 is deprecated in nesC and leads to inaccurate data race detec‐
169 tion).
170
171 -Wnesc-async
172 Warn when interrupt handlers call commands or events not anno‐
173 tated with async.
174
175 -Wnesc-data-race
176 Warn about potential data races.
177
178 -Wnesc-combine
179 Warn when configuration wiring leads to "fan-out" and the func‐
180 tion return type does not have a combining function defined.
181
182 -Wnesc-docstring
183 Warn when unexpected documentation strings (starting with /**)
184 are seen.
185
186 -Wnesc-all
187 Turns on -Wnesc-fnptr, -Wnesc-async, -Wnesc-combine and-Wnesc-
188 data-race.
189
190 -Wnesc-error
191 Turns the -Wnesc-fnptr, -Wnesc-async, -Wnesc-combine and -Wnesc-
192 data-race warnings into errors.
193
194 When compiling a nesC component, the nesC compiler recognizes the gcc C
195 language (-f...) and warning (-W...) options. The -S, -c and -o options
196 work as usual, the -x option accepts nesc. The -v option causes the
197 nesC compiler to print out the paths of all components and interfaces
198 that are loaded. Directories can be added to nesCs search path with -I.
199
201 If you wish to compile a component Bar.nc to a C file, you can do:
202
203 nescc -c -o /dev/null -fnesc-cfile=Bar.c Bar.nc
204
206 nescc defines the following preprocessor symbol:
207
208 NESC (since v1.1)
209 set to XYZ where x.yz is the nesC version
210
212 NESCPATH
213 A colon separated list of additional search directories for nesC
214 components.
215
217 gcc(1), platform-specific gcc
218
220 The warnings for the new nesC 1.1 features (see -Wnesc-all) are off by
221 default to increase compatibility with nesC 1.0 code. To match the lan‐
222 guage specification in the nesC 1.1 reference manual, you should com‐
223 pile with -Wnesc-all and -Wnesc-error. These options will become the
224 default in future releases.
225
226
227
228 April 27, 2004 nescc(1)