On Jan 18, 2007, at 11:52 AM, Will Archer wrote:
Hi, I'm having a problem with calling a task within a binary
component under nesc 1.2.7. First, I should ask, given the task
dispatch setup in TOS 2.0, is possible to run a task inside a
binary component?
If so, the problem I'm running into is that tasks from the .nc
files are not showing up in the generated C code. I compiled the
binary components demo in nesc-1.2.7/doc/user/binary-
components.txt, and changed FooImplementation.nc to include a task
post.
implementation {
// This does something mysterious to requests...
int x;
// **************
// Added this task
task void run_done(){
signal X.done(x);
}
// **************
command int X.request() {
// Added task post.
post run_done();
return call Y.request() + x;
}
event void Y.done(int val) {
x = val;
}
}
When I compile the task post exists, but the source for the actual
task does not. I compiled using nesc 1.2.7,
ncc -DNESC_BUILD_BINARY -_fnesc-cfile=tmp.c -c BuildBinaryFoo.nc
This is going to require that the other files mentioned in the demo
(A.nc, Foo.nc, FooImplementation, which is the code I modified,
etc.) are available. I am happy to provide them if anybody cares,
but I wanted to keep this pithy.
David Gay might have some special magic, but my guess is that by
default, no, this won't work. Tasks use unique() in the scheduler,
and the binary component with the scheduler in it doesn't have the
unique() call from your new binary component.
If you are using binary components for production systems, there
isn't a good works-in-all-cases solution. However, if you're binary
components for isolated testing, then you can always pull a trick
like telling the scheduler to allocate a few extra task slots and
including N dummy calls to unique in your testing component in order
to get it to start at the right index.
Phil
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help