I\'m getting started with contiki on the sky mote through a project. I\'m trying to get over the air programming to work right now.
I\'ve been looking through examples/sky-
To get over the air (OTA) Programming
working, your own codebase needs to work on top of another layer ( thus other users mentioning too look into the shell examples ).
It is comparable to the Windows kernel that runs an executable and needs to update.
1: Kernel downloads foo and saves this on its filesystem.
2: The kernel terminates the old foo program and starts the new foo program after some required file validation.
3: If everything is ok, the old foo program gets removed.
Now as you can see that at the time of updating your program needs to be twice on the same device ( the old one and the new one ).
I hope this gives more insight in how OTA programming works.
So i will try to answer your questions one by one now:
1) To distribute the files to all other nodes, deluge is used. Now using deluge is indeed quite tricky to use. The following post in the mailing list of contiki gives a basic idea what the code example for sky does. http://permalink.gmane.org/gmane.os.contiki.devel/4884 .
2) Every mote needs a shell needs to run that runs the deluge application. And one sink node ( the one transmitting the newest file ) needs to call the deluge_dessiminate() function to distribute (dessiminate) the new program.
3) The code will be stored in the coffee file system. Deluge will automatically ( behind the scenes of deluge_dessiminate and the deluge app on your sky node ) save the new file on the flash of the sky node. After this is done, you need to run this program by using the ELF loader. Since you need your program to be an ELF compiled file to be run by the contiki ELF_LOADER.
4) I think you mean ROM? But yes, you need extra code to support OTA programming and you need twice the space of the size of your application. All of the modules you say you need you probably need to program yourself on the shell side. file verification can be done by CRC checking your file.
This is indeed a lot of work and I suggest doing this is small steps.
1: Run a program using the ELF loader that is saved on the coffee file system.
2: dessiminate (deluge) your own (random) file from a sink node to the other nodes
3: dessiminate an ELF file.
4: run a deluge_dessiminated file using ELF loader.
and 5: Create a tutorial for the other guys and share the knowledge!
I hope this will help you in any way.