ENSBox development quickstart
From CSL Wiki
This page describes the quickest way to get started developing for the ENSBox.
Contents |
Toolchain
The ENSBox arm-linux toolchain lives here. The following commands will get this toolchain, copy to your home dir and then extract it to /, where it will live under /usr/arm-linux
cd ~/ wget http://lecs.cs.ucla.edu/~data/aensbox/arm-linux.tar.bz2 cd / sudo tar -jxvf ~/arm-linux.tar.bz2
EmStar
The following will make sure you have the correct libs for EmStar. These are for x86, but the ENSBox toolchain should have all of the required libs you need to build for ENSBox already.
Prequisites
Ubuntu is preferred for installing EmStar because of its package management, although most linux distros should be usable. To install the required libraries, here is a list of apt-get install commands (for Ubuntu, at least) you can cut and paste:
sudo apt-get install libc6-dev libglib2.0-dev pkg-config bison flex libgsl0 libgtk2.0-dev libcurl3-dev sudo apt-get install libreadline5-dev libflac-dev libsndfile1-dev sudo apt-get install libgsl0-dev g++ libasound2-dev libstdc++2.10-glibc2.2 cvs
Optionally:
sudo apt-get install audacity sox openssh-server nfs-kernel-server
Required packages (for reference):
libc6-dev libglib2.0-dev pkg-config bison flex libgsl0 libgtk2.0-dev libcurl3-dev libreadline5-dev libflac-dev libsndfile1-dev libgsl0-dev g++ libasound2-dev libstdc++2.10-glibc2.2 cvs
Also desirable:
audacity sox openssh-server nfs-kernel-server
Checkout/Install
To check out and install EmStar, do the following:
At your home directory, type:
cvs -d :pserver:anoncvs@cvs.cens.ucla.edu:/home/cvs/cvsroot login
When asked for a password, just press enter.
cvs -z9 -d :pserver:anoncvs@cvs.cens.ucla.edu:/home/cvs/cvsroot co emstar
This will checkout the current Emstar head revision to your home directory (~/emstar).
TinyOS with Emstar (optional)
(If you need to install TinyOS as part of Emstar, you must perform the following steps)
The next thing to do is create a /lecs directory in /usr/local/ (this is used to put nesc and avr into during the following stage)
cd /usr/local sudo mkdir lecs
Next, as per the original Emstar installation instructions, you need nesc and the avr compiler installed.
Download these files to your home directory, and then untar both of them, using the commands:
tar zxvf nesc-1.1-platform.tgz tar zxvf avr-3.3-platform.tgz
This will create a usr/local/lecs tree in your root directory.
Move these files into the /usr/local/lecs directory you created earlier, by typing:
sudo mv usr/local/lecs/avr3.3/ /usr/local/lecs/ sudo mv usr/local/lecs/nesc-1.1/ /usr/local/lecs/
next, add a symlink in emstar/bin/ to make sure the right version of uisp is being used:
cd ~/emstar/bin sudo ln -s uisp-ucb-20031126 uisp
you might also want to add a similar link in /usr/local/lecs/avr3.3/bin/ for if you need to program motes whilst using the laptop
cd /usr/local/lecs/avr3.3/bin/ sudo mv ./uisp ./usip-old sudo ln -s ~/emstar/bin/uisp-ucb-20031126 uisp
after this, you need to add the following lines to your ~/.bashrc file (at the bottom, making sure to leave a newline):
export PATH=$PATH:~/emstar/bin export EMSTAR_ROOT=~/emstar export PATH=/usr/local/lecs/nesc-1.1/bin:/usr/local/lecs/avr3.3/bin:$PATH
To make sure these settings are loaded, restart any open terminal sessions.
Edit the Make.conf file in ~/emstar and set to BUILD_EMTOS variable to 1. This will download TinyOS for you during the Emstar compilation process (later in this document) and compile relevant TinyOS applications in the tos-contrib directory.
Compile for ENSBox
You can then cross compile for the ENSBox using the following make command:
make ARCH=nims-stargate strip
The strip flag is optional, but will make files smaller (at the expense of debugging capabilities).
In order to make libraries which are not shared in terms of EmStar libraries (larger files, but self-contained for easy distribution), you must set the USE_SHARED to be 0 in Make.conf. Note that you must recompile from scratch the whole tree if you change this variable.
Cross compiling without EmStar
If you need to cross compile without using EmStar, make sure the correct arm-linux toolchain is in your path (you can either edit your profile settings, or do this as and when needed).
export PATH:$PATH:/usr/arm-linux/bin
all the arm-linux* tools are then in the path.
