[Tinyos-help] TelosB stuck in reset cycle

2012-09-04 Thread David Harrison
I have a Sentilla T-Mote Sky TelosB mote running code that immediately crashes 
when powered up. Consequently, tos-bsl times out when I try to erase and 
install a fixed version. 

Is there a way to do a hard erase of the flash memory without an active USB 
connection?

Magic sequence of buttons on the device, perhaps?

Thanks,

David Harrison
University College Dublin
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


[Tinyos-help] TOSThreads, TinyLD and Callbacks to loaded modules

2012-08-14 Thread David Harrison
I have a TOSThreads, TinyLD system, heavily based on the SerialLoaderFlash 
example.

I compile new functionality on the laptop as a dynamic threads module, transfer 
it to the mote where it gets stored in flash. When the module is loaded, it 
registers itself with the monolithic app on the mote by calling a function I 
exposed by adding it to: tos/lib/tosthreads/lib/tinyld/tosthread_slcs_types.h. 

So far so good.

This "registration" function takes a function pointer as an argument which is, 
if you like, the constructor of the module that just registered itself. 
Unfortunately, when the monolithic code calls this function nothing much 
happens. Far as I can tell, the function pointer being passed in by the loaded 
module becomes invalid as it enters the monolithic app.

The loaded module looks like this (simplified for clarity):

tosthread_t button_sensor_source;
tosthread_t button_sensor_source_registration;

Source alloc_button_sensor_source() {
  // whatever
}

void button_sensor_source_registration_thread(void* arg) {
  register_source(&alloc_button_sensor_source);
}

void tosthread_main(void* arg) {
  tosthread_create(&button_sensor_source_registration, 
button_sensor_source_registration_thread, NULL, 200);
}

When TinyLD does it's thing, "tosthread_main" gets invoked which creates a new 
thread that uses the "button_sensor_source_registration_thread" function as 
it's entry point and in there registers itself with the main app.

A simplistic version of the "Registration" function (the one in the monolithic 
app) looks like this:

void register_source(Source (*constructor)()) {
  Source source = constructor(); 
  // whatever
}

When I test this, the line that calls the function is executed, but the 
function "constructor" points to is not invoked.

Anyone know what's going wrong here? 

Is there anyway to make the constructor pointer valid in the main app? 

Does the loaded module become invalid when it's "tosthread_main" function exits?

FYI - This is a port of code that works flawlessly on Contiki, but I may simply 
be using the wrong paradigm for TinyOS/TOSThreads. If I am, please point me in 
the right direction!

Many thanks,

David Harrison
University College Dublin
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


[Tinyos-help] Destroying Threads Created by DynamicLoader

2012-05-10 Thread David Harrison
I've modified the SerialLoaderFlash example application to include a new 
message type requesting the previously loaded DynamicThread be "stopped", i.e. 
destroyed. Doesn't work. 

Anyone in a position to give me the heads up on why not?

My code is included below.

Thanks, David

--8<---

Having read some old posts that suggested having multiple threads in the 
deployed app was problematic, the deployed app/thread has a single thread that 
simply blinks the blue led every second:

void tosthread_main(void* arg) {
  for(;;) {
led2Toggle();
tosthread_sleep(1000);
  }
}

Here's the modified code from FlashVolumeManagerP.nc, additions are in bold. 
Obviously I had to modify certain other files to include DynamicThread, but I 
guess we can take that as read.

FYI - putting call DynamicThread.destroy(&thread); in the 
DynamicLoader.loadFromFlashDone method does destroy the thread so my guess is 
it's something to do with the state the thread is in at the point I try to stop 
it. 

implementation
{
  tosthread_t thread;

  [ snip ]

  case SERIALMSG_STOP :
error = call DynamicThread.destroy(&thread);
if (error != SUCCESS)
  sendReply(error, sizeof(SerialReplyPacket));
break;
  case SERIALMSG_RUN :
error = call DynamicLoader.loadFromFlash(VOLUME_MICROEXEIMAGE);
if (error != SUCCESS)
  sendReply(error, sizeof(SerialReplyPacket));
break;
}

return msg;
  }
  
  event void DynamicLoader.loadFromFlashDone(uint8_t volumeId, tosthread_t id, 
error_t error) {
thread = id;
sendReply(error, sizeof(SerialReplyPacket));
  }

  [ snip ]
}___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

[Tinyos-help] Destroying Threads Created by DynamicLoader

2012-05-08 Thread David Harrison
I've modified the SerialLoaderFlash example application to include a new 
message type requesting the previously loaded DynamicThread be "stopped", i.e. 
destroyed. Doesn't work. 

Anyone in a position to give me the heads up on why not?

My code is included below.

Thanks, David

--8<---

Having read some old posts that suggested having multiple threads in the 
deployed app was problematic, the deployed app/thread has a single thread that 
simply blinks the blue led every second:

void tosthread_main(void* arg) {
  for(;;) {
led2Toggle();
tosthread_sleep(1000);
  }
}

Here's the modified code from FlashVolumeManagerP.nc, additions are in bold. 
Obviously I had to modify certain other files to include DynamicThread, but I 
guess we can take that as read.

FYI - putting call DynamicThread.destroy(&thread); in the 
DynamicLoader.loadFromFlashDone method does destroy the thread so my guess is 
it's something to do with the state the thread is in at the point I try to stop 
it. 

implementation
{
  tosthread_t thread;

  [ snip ]

  case SERIALMSG_STOP :
error = call DynamicThread.destroy(&thread);
if (error != SUCCESS)
  sendReply(error, sizeof(SerialReplyPacket));
break;
  case SERIALMSG_RUN :
error = call DynamicLoader.loadFromFlash(VOLUME_MICROEXEIMAGE);
if (error != SUCCESS)
  sendReply(error, sizeof(SerialReplyPacket));
break;
}

return msg;
  }
  
  event void DynamicLoader.loadFromFlashDone(uint8_t volumeId, tosthread_t id, 
error_t error) {
thread = id;
sendReply(error, sizeof(SerialReplyPacket));
  }

  [ snip ]
}___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help