Installing TinyOS seems to be not so easy with Lion / Mountain Lion / Mavericks OS and the xcode. The following worked for me (using telosb / msp430):

Update Sep 2014: As TinyOS is pushing to next release, there have been numerous fixes to settle the Mac OSX issues that I list below. Thus, some issues might be obsolete by now.

Update October 2014: You find hints on OSX 10.10 Yosemite in the comments below.

1. Actually, I am not sure if one really needs this first step, I just did it along the way while figuring a way to make it all work. Install gcc 4.6 and gcc_select from macports and select gcc as default compiler for macports via “sudo port select gcc mp-gcc46”. When you are done with installing TinyOS, nesc etc you can disable this again by calling “sudo port select gcc none”. Update: based on the feedback of others: It seems this step is necessary.

2. Install msp430-gcc and msp430-libc via mac ports. At the time of writing of this post the gcc version was 4.6.3-20120406. Update: based on the comments, it seems that newer versions of gcc such as 4.6.4 or 4.7 do not work (yet?).

3. Load TinyOS from google code GitHub and put it somewhere. Set this path in tinyos.sh and source it from your bash configuration as both are described on the TinyOS documentation pages. Update: TinyOs is now on GitHub, and tinyos.sh seems not be included anymore. Thus, you can set the paths by hand or use  https://github.com/tschmid/tinyos-2.x/blob/master/tinyos.sh.

4. Load nesc from cvs head (neither nesc 1.3.3 from macports nor the tar ball from soureforge worked for me, while both compiled and installed fine they lead to errors when trying to compile TinyOS applications: “nesC: Internal error. Please send a bug report to the nesC bug mailing list”. But 1.3.4 should be out soon, hopefully this allows to install from macports/tarrball again). Compile and install as described in the readme for cvs installation (the readme says you need emacs and some other stuff, it worked fine for me without). Update: 1.3.4 has been released, and you can download it from the project website (http://sourceforge.net/projects/nescc/) and follow the install instructions. Update: If “make install” fails, make sure you run “./configure”, “make”, “sudo make install”. Update: NesC 1.3.4 and the latest code from github (https://github.com/tinyos/nesc) seem to work just fine (as long as you compile them with gcc — see step 1 — and not the default llvm-gcc of Mac OS X).

5. Install TinyOS tools: in the tinyos download, go to tools and run ./bootstrap, ./configure, make, sudo make install etc. (as described in the install instructions). You might have to fix the following on the way: In tos_locate_jre I had to set xcode_jdk=/System/Library/Frameworks/JavaVM.framework/Headers and in NativeSerial_darwin.cpp I added #include <string.h> and #include <stdlib.h>.
Upate: new paths for JVM:
jhome=/System/Library/Frameworks/JavaVM.framework/Versions/Current, 
xcode_jdk=/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers
Update: Hint: Also here you should make sure that you compile things with gcc — see step 1 — and not the default llvm-gcc of Mac OS X.

6. Install FTDI drivers: http://www.ftdichip.com/Drivers/VCP.htm. Interestingly, 2.2.17 lead to some errors during programming (BSLException: Bootstrap loader synchronization error). I took 2.2.16 (http://www.ftdichip.com/Drivers/VCP/MacOSX/FTDIUSBSerialDriver_v2_2_16.dmg) instead and it works fine.

7. Check that everything works: go to Blink and try “make telosb” and “make micaz sim”; connect some nodes and run motelist; install something (if it fails during programming noting that no module serial is availble in python, you might have to install pyserial via “sudo easy_install pyserial”).

Advertisements