Check wiring of nesc program
nescc-wiring nesc-xml-file
nescc-wiring is a tool to verify that wiring constraints specified on individual components are respected in a nesC program. These wiring constraints can specify that an interface provided or used by a component must be wired at least once, at most once, or exactly once. If no wiring constraints are violated, nescc-wiring terminates with an exit status of 0. Otherwise, appropriate error messages are printed and nescc-wiring terminates with a non-zero exit status.
Wiring constraints are specified by placing @atmostonce(), @atleastonce() and @exactlyonce() attributes on the relevant interfaces. For instance, writing
module Fun { provides interface Init @atleastonce(); ...
ensures that programs using module Fun must wire its Init interface at least once.
Specifically, when the annotation is placed on a provided interface, there must be the specified number of paths in the wiring graph from any module to that interface. If the annotations are placed on a used interface, there must be the specified number of paths in the wiring graph from the interface to any module.
To use this wiring check tool, you must declare the @atmostonce(), @atleastonce() and @exactlyonce() attributes in some global header file as follows:
struct @atleastonce() { }; struct @atmostonce() { }; struct @exactlyonce() { };
and you must pass the following options to nescc to create the XML file that you pass to nescc-wiring:
-fnesc-dump=wiring -fnesc-dump='interfaces(!abstract())' -fnesc-dump='referenced(interfacedefs, components)' -fnesc-dumpfile=nesc-xml-file