📄 readme
字号:
A sample application using the Java nesC XML parsing classes to verifywiring constraints. A wiring constraint expresses requirements on thenumber of paths to and from a particular point in an application's wiringgraph. They can be used, e.g., to ensure that an initialisation interfaceis always wired, or that only one other component wires to an interfacewhich represents a non-shareable hardware resource such as a timer.These constraints are defined in terms of the per-function wiring graph ofthe program. In the per-function wiring graph, interfaces are replaced byseparate nodes for each command and event. An edge from interface instanceA to interface instance B is replaced by edges from the commands of A tothe commands of B and from the events of B to the events of A (reflectingthe fact that commands and events go in opposite directions). A commandin a provided interface and an event in a used interface are consideredprovided in the per-function wiring graph; a command in a used interfaceand an event in a provided interface are considered used.A wiring constraint expresses constraints on the number of paths to (forprovided commands and events) or from (for used commands and events) nodesin the per-function wiring graph. There are three constraints: at-most-once(<= 1), at-least-once (>= 1) and exactly-once (= 1).Examples: module Foo { /* we want to ensure Foo is initialised */ provides interface StdControl @atleastonce(); } ... module HardwareClockM { /* the hardware clock is not shareable, but it doesn't have to be used */ provides interface Clock @atmostonce(); } ... configuration WeirdClock { /* The clock interface can have only one user. Note that it *is* multiply wired in WeirdClock - this does not contradict the @atmostonce() annotation which applies to components wiring to WeirdClock.Clock */ provides interface Clock @atmostonce(); } implementation { components HWClock1, HWClock2; Clock = HWClock1.Clock; Clock = HWClock2.Clock; }To use WiringCheck, you need to first declare the @atmostonce(),@atleaseonce() and @exactlyonce() attributes in tos.h: struct @atomostonce() { }; struct @exactlyonce() { }; struct @atleastonce() { };and then use these annotations on provided or used interfaces, as desired(see doc/user/attributes.txt for more information on attributes).To run WiringCheck on your application, compile with these additionaloptions to ncc: -fnesc-dump=wiring '-fnesc-dump=interfaces(!abstract())' '-fnesc-dump=referenced(interfacedefs, components)' -fnesc-dumpfile=/tmp/wiring.xmland then execute java net.tinyos.nesc.wiring.WiringCheck </tmp/wiring.xmlto verify your wiring annotations.The currently version of WiringCheck only verifies annotations oninterfaces; adding annotations on commands on events would bestraightforward.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -