I spent a little time last week getting TinyOS 2.1 apps to run on the cool little Sentilla JCreate motes and after I asked a few questions on the TinyOS mailing list it became apparent that there were others interested in doing the same. I received quite a few requests via private mail and on the mailing list to post the directions on how I got things working so here you go!!
My basic findings were that the tos-bsl bootstrap loader for the msp430 (Telos, TelosB, etc) does not work with the JCreate, but the bootloader included with the Sentilla SDK is argument compatible with the tos-bsl so if you replace tos-bsl things seem to work. If anyone knows how to make tos-bsl from the msp430 tool chain work with JCreate please let me know. In addition, there are some conflicts with the FTDI USB drivers and the communication method used by the Sentilla SDK, which I outline below.
These directions are based on Mac OSX and using the telosb target for compiling. There are some limitations in doing this (only 3 LEDS on telos platform definition, no accelerometer, etc). I am working on a platform definition for the JCreate which includes all 8 LEDs and hopefully I can get the accelerometer and ADCs to work as well, but I will save that for another post.
Step 1: Remove FTDI VCP Drivers
One of the first problems was that the Sentilla code uses the FTDI D2XX libraries to talk directly to the USB device as opposed to the FTDI VCP drivers which map the device to a serial port (COM or /dev/ttyXXX). Most other software uses the VCP method which looks for the default VID/PID of the FTDI chip and maps any matching devices to the com ports. Unfortunately the Sentilla devices use the default VID/PID as well, so when you insert them your device gets locked by the VCP driver. So if you have the VCP drivers installed (which everyone probably does if you are using TinyOS), you need to uninstall them so that the D2XX libraries can talk to the device. This could be specific to the Mac drivers, but I tend to think it would be a problem for other platforms as well, although FTDI has something called “Combined driver model” for Windows so that might be some kind of option if you are on Windows.
Step 2: Install FTDI D2XX libraries
Go grab the FTDI D2XX libraries and install them according to the directions in the download. Basically this will involve putting the dll or shared libs in a system library path.
Step 3: Locate tmote-bsl from Sentilla SDK
Locate the tmote-bsl from the Sentilla SDK. I think the Windows version was included on the CDROM in the PERK kit and the Mac and Linux versions are available here if you are a registered Sentilla customer. On my Mac, the tmote-bsl is located in /opt/SentillaWork-1.1.01/SentillaWork/plugins/com.sentilla.work_1.1.1/ but this will vary by platform.
Step 4: Create new target for JCreate
Once you locate tmote-bsl, the easiest ways to use it is to create a new target for the JCreate. Copy /tinyos-2.x/support/make/telosb.target to a new file called jcreate.target in the same directory. Edit the jcreate.target and modify the bsl variables on lines 12-13 to look like this based on the location of tmote-bsl in step 3 (original values commented):
MSP_BSL ?= /opt/SentillaWork-1.1.01/SentillaWork/plugins/com.sentilla.work_1.1.1/tmote-bsl
#MSP_BSL ?= tos-bsl
MSP_BSL_FLAGS = -bsl=mini
#MSP_BSL_FLAGS = --telosb
Because the new bsl uses the D2XX libraries, there are some differences in the way you reference motes. So before you would use something like:
make telosb install bsl,/dev/ttyUSB0
Now you are going to use the serial number of the USB device and the jcreate target:
make jcreate install bsl,ftd/M4ASU2X7
To get the USB device serial number you can use the motelist from the same directory as tmote-bsl in the Sentilla SDK (which enumerates the FTDI USB devices by serial number vs COM port), or you can use something like device manager (Windows) or system profiler (Mac OSX).
Using the different device syntax above with the jcreate target, I have been able to load all of the example apps without any issues other than the mismatch in sensors and LEDs. I will post the jcreate platform definition once I have time to work all of that out.
Step 5 (Optional): Getting the Java apps to run
Because I uninstalled the VCP drivers, the standard toscom JNI library used for the Java apps won’t be able to talk to the devices. I suppose it is possible that installing the VCP drivers again at this point might work, but then you would have to uninstall every time you want to flash an app using the bsl. As I said earlier, Sentilla uses the D2XX libraries in place of the VCP COM port drivers and it appears that the toscom library has been modified to use D2XX as well. Out of curiosity, I replaced the toscom lib in my tinyos source tree with the one from the Sentilla SDK and re-ran tos-install-jni. After trying to run some of the Java apps it was clear that the tinyos.jar file did not match the modified toscom JNI lib, so I used the tinyos.jar from Sentilla and that seemed to work up to a point. Eventually I realized that some parts of the generated message interfaces were not working between the NesC code and Java. I had the Sentilla tinyos.jar open in IntelliJ and from the errors I was getting it was apparent that the JNI calls has a slightly different signature than what was in TinyOS 2.1. Once I modified net/tinyos/comm/TOSCommJNI.java to match those signatures, all of the Java apps started working perfectly. You can download TOSCommJNI.patch and apply it to your local source tree.
At this point you should have a perfectly functioning TinyOS 2.x installation and build tools.
Wow that was a long post! I know there are a lot of details here but I wanted to be specific and encourage others to offer their advice if there is a better way to do this. If anyone has suggestions or questions feel free to leave a comment, or even better, post to the tinyos-help mailing list.


#1 by Faisal on September 21st, 2009
I have followed this blog while using Ubuntu. I have found following differences.
1) Step 1 and 2 are not required in Ubuntu.
2) In Step 4, the line MSP_BSL_FLAGS = -bsl=mini is not required. Furthermore, make telosb install bsl,/dev/ttyUSB0 works fine and does not make jcreate install bsl,ftd/M4ASU2X7 is not required.
3) One has to place motelist-linux under /usr/local/bin as tmote-bsl needs it.
In short it is much simpler under Ubuntu. Ahha the power of Linux…
Faisal
#2 by Faisal on September 21st, 2009
Lastly, under ubuntu we did not needed to use tinyos.jar from Sentilla. The tinyos.jar present in our repository worked fine.
In short we just have to use tmote-bsl and motelist-linux and we are done.
Faisal