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