nescc(1)
π nescc β the nesC compiler, bestie edition π
okay so hi, you found the man page for nescc(1), straight outta the General Commands Manual. pull up a chair, grab a boba, we're doing this. π§β¨
β¨ NAME β¨
nescc β the nesC compiler. that's it, that's the name. iconic. π
πΈ SYNOPSIS πΈ
nescc [-gcc=gcc-name] [-fnesc-gcc=gcc-name] [-fnesc-mingw-gcc]
[-fnesc-target=architecture] [-fnesc-docdir=dir]
[-fnesc-topdir=dir] [-fnesc-docs-use-graphviz] [-fnesc-is-app]
[-fnesc-simulate]
[-fnesc-nido-tosnodes=n] [-fnesc-nido-motenumber=expression]
[-conly] [-fnesc-cfile=file] [-fnesc-gccize]
[-fnesc-cppdir=directory] [-fnesc-separator=separator]
[-fnesc-no-inline] [-fnesc-optimize-atomic]
[--version] [-fnesc-include=file] [-fnesc-verbose] [-Wnesc-...]
[-fnesc-dump=specification] [-fnesc-dumpfile=file]
[-fnesc-scheduler=specification] [-fnesc-path=path]
[-fnesc-no-debug]
[-fnesc-deputy] [-fnesc-no-deputy]
[-fnesc-default-safe] [-fnesc-default-unsafe]
[any gcc option] files...
π¦ DESCRIPTION π¦
okay so nescc is basically gcc but with β¨extensionsβ¨ β it knows how to compile nesC applications. that's the whole vibe.
- if you invoke it on regular C files? it behaves exactly like
gcc. no notes, no drama. π - if you invoke it on a nesC component or interface file (that's the
.ncextension, babes), it compiles and links that component together with the other files you listed on the command line.
but wait β it does not link if you're using the-c,-S,-conly,-Eor-fsyntax-onlyoptions. read the room, read your flags. π«Ά
π OPTIONS π
so nescc accepts every single gcc option, plus a whole little collection of nesC-specific ones. here we go, bestie:
-gcc=gcc-name,-fnesc-gcc=gcc-nameβ tell it which gcc compiler to use for compiling and linking any C files, whether those were explicitly specified by you or generated as the output of the nesC-to-C compiler. this option is what supports cross-compilation of nesC code (which is, like, the usual mode of operation...).-fnesc-mingw-gccβ pass this if the gcc version you specified with-gcc=...was compiled for Window's mingw environment. in that case it expects Windows-style paths rather than Unix-style paths. so different. so specific. πͺ-fnesc-target=architectureβ say which target architecture to compile for. currently supported platforms areavr(the Atmel AVR family),msp430(the TI MSP430 family) andself(the machine the nesC compiler is running on). if you use theenvtarget, the architecture details get read from theNESC_MACHINEenvironment variable instead. see the separateenvtarget documentation for the deets.-fnesc-docdir=dirβ generate documentation for the compiled component, and put it in directory dir.-fnesc-topdir=dirβ specify directory paths that should be stripped from the source file names when generating "package names" for the documentation files.-fnesc-docs-use-graphvizβ explicitly enable or disable the use of the graphviz tool in the generated documentation. without this option, graphviz is enabled iff thedotprogram is found in the current path. heads up: using graphviz requiresdot. the documentation generation tool also checks the version ofdot, and enables client-side image maps if they're supported. fancy. π-fnesc-is-appβ tellnesccthat the source being compiled is an application, and that it should generate an app description page for the entire application. main character application energy.-fnesc-simulateβ compile for a simulation environment.-fnesc-nido-tosnodes=n,-fnesc-nido-motenumber=expressionβ when-fnesc-simulateis specified, the nesC program is compiled for a simulation environment where a single executable will simulate n nodes. specifically: in the generated code, each global variable becomes an n element array, and all accesses to global variables are indexed with expression. so yeah, one binary, many little guys. π£-conlyβ just compile to C, leaving the generated source code for top-level-componentcomp.ncin the C filecomp.c(except if the-fnesc-cfileoption is specified).-fnesc-cfile=fileβ specify a file in which to save the C code generated when compiling a component.
β οΈ note: if you specify two components on the command line, then the C code from the second one will overwrite the C code from the first. the second one said "my turn". π
-fnesc-gccizeβ output target-specific extensions as gcc-style attributes rather than using the target's original syntax. this can help if you're using-conlyand sending the nesC output off to some other tool that understands gcc attributes but not the target-specific extensions.-fnesc-cppdir=directoryβ save all preprocessing results in directory. the directory gets created if it doesn't exist. this can be helpful for tracking down preprocessor-related compilation problems. you probably want to make sure directory is empty when you callnescc, so it's obvious which files were preprocessed as part of the current compilation. detective mode π-fnesc-separator=separatorβ set the separator used to create symbol names in the generated C code (default is$). the compiler needs to generate unique names to denote stuff like, e.g., a module variable, and it does that by concatenating various symbol names to make sure the names come out unique. for instance, variablebarin moduleMazbecomes a global C variableMaz$barin the compiler output. some C compilers do not like$in symbol names, so you can specify a different separator, e.g.,__(which leads to generated symbols likeMaz__bar).
π¨ you will get a compile-time warning if any symbol in the program being compiled contains the separator you specify β because the presence of the separator in a symbol could lead to the generation of incorrect code. the separator can, however, start or end a symbol.
-fnesc-no-inlineβ disables the automatic inlining of all small functions, and of all functions with a single call site.-fnesc-optimize-atomicβ optimize atomic statements [EXPERIMENTAL]: reduce or remove the overhead of atomic statements in simple cases (e.g., single-byte reads). experimental means experimental, bestie, don't come for me. π§ͺ--versionβ print the version ofnesccand of the selected gcc compiler (see-gcc).-fnesc-include=header-fileβ include the specified file before compiling a nesC component. it behaves as ifincludes header-file;was included at the start of that component. (and yes, the synopsis calls itfilewhile this option saysheader-fileβ we contain multitudes. π)-fnesc-dump=specificationβ output information on the compiled program's structure, and in particular its user-specified attributes. for more details, see the separate nesC dump documentation.-fnesc-dumpfile=fileβ where to output the information requested by-fnesc-dump. defaults tostdout.-fnesc-verboseβ be more verbose than-v. yes. more. than that. π’-fnesc-scheduler=component,unique-string,interface-name,interface-definition,run-event,post-commandβ okay so by default, nesC compiles uses oftask void taskname() ...tovoid taskname(), andpost taskname()toTOS_post(taskname).
with this option, each task gets its own interface-definition interface, the task implementation is transformed into a run-event event, and posts becomes a call to the post-command command. this per-task interface is automatically connected to the parameterised interface-name interface of scheduler component component. the parameter id for the connection is chosen with unique("unique-string"). slay. π―
-fnesc-path=pathβ add colon separated directories to thenesccsearch path.-fnesc-no-debugβ remove the functionsdbg(),dbg_clear(),dbg_active()from the source code.-fnesc-deputyβ compile with the deputy compiler.-fnesc-no-deputyβ do not use the deputy compiler. this is the default.-fnesc-default-safeβ make modules default to having the@safe()attribute. has no effect if-fnesc-deputyis not set.-fnesc-default-unsafeβ make modules default to having the@unsafe()attribute. has no effect if-fnesc-deputyis not set.
β the nesC-specific warnings β
there are a number of warnings specific to nesC, specified with -Wnesc-. and listen: all of these warnings are off by default. every single one. π€
-Wnesc-fnptrβ warn when function pointers are used. (use of function pointers is deprecated in nesC and leads to inaccurate data race detection.)-Wnesc-asyncβ warn when interrupt handlers call commands or events that are not annotated withasync.-Wnesc-data-raceβ warn about potential data races.-Wnesc-combineβ warn when configuration wiring leads to "fan-out" and the function return type does not have a combining function defined.-Wnesc-docstringβ warn when unexpected documentation strings (starting with/**) are seen.-Wnesc-implicit-connβ warn when implicit connections between components are used.-Wnesc-allβ turns on-Wnesc-fnptr,-Wnesc-async,-Wnesc-combineand-Wnesc-data-race.-Wnesc-errorβ turns the-Wnesc-fnptr,-Wnesc-async,-Wnesc-combineand-Wnesc-data-racewarnings into errors. π₯
π and also, the gcc-isms π
when compiling a nesC component, the nesC compiler recognizes the gcc C language (-f...) and warning (-W...) options. the -S, -c and -o options work as usual, and the -x option accepts nesc. the -v option causes the nesC compiler to print out the paths of all components and interfaces that are loaded. directories can be added to nesC's search path with -I.
π EXAMPLES π
if you wish to compile a component Bar.nc to a C file, you can do:
nescc -c -o /dev/null -fnesc-cfile=Bar.c Bar.nc
that's it, that's the whole move. /dev/null said "not today" and Bar.c said "say less". π
π PREPROCESSOR SYMBOLS π
nescc defines the following preprocessor symbol:
NESC(since v1.1) β set toXYZwherex.yzis the nesC version.
πΈ ENVIRONMENT VARIABLES πΈ
NESCPATHβ a colon separated list of additional search directories for nesC components.
β¨ SEE ALSO β¨
gcc(1), platform-specific gcc
π NOTES π
the warnings for the new nesC 1.1 features (see -Wnesc-all) are off by default to increase compatibility with nesC 1.0 code. so if you want to match the language specification in the nesC 1.1 reference manual, you should compile with -Wnesc-all and -Wnesc-error. these options will become the default in future releases. so like... get used to them now, bestie. π
and that's the page!! π¦ this whole thing is from the General Commands Manual and it's dated May 22, 2013 β so if you're reading this in the future, hi, hope nescc is treating you well. go compile something cute. πβ¨
π¦ where this page comes from
- debian bookworm: nescc 1.3.5-1.1 Β· GPL-2.0-only
- ubuntu jammy: nescc 1.3.5-1.1build1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms