Lab1 NP PDF
Lab1 NP PDF
Lab1 NP PDF
Disclaimer: These notes have not been subjected to the usual scrutiny reserved for formal
publications. They may be distributed outside this class only with the permission of the Instructor.
1.1 Introduction
In the first lab session, we are going to prepare our working environment to be able to run, develop,
modify and debug software for wireless sensors. In this lab we use the Contiki operating system that
is designed to run on small low-power embedded devices.
Contiki provides a fully configured development environment that runs as a virtual machine. In this
session we install and configure the free VMware Player, run the Contiki Image on it and connect
sensor nodes to the Contiki environment to be able to deploy programs.
Note: The lab computers have already the software installed and you do not need to redo the
installation. To run Contiki on the lab computer, you do the following:
1) Go to Applications - Accessories - Terminal
2) On terminal window, type "vmplayer"; Wait for Virtual Machine window to open up
3) Select "Remind Me Later" on additional pop-up window
4) Double click "Open a Virtual Machine" on main window
5) Select "pencil like" icon on top left of window to open up the "Location Box", into which, type in
"/usr/share/InstantContiki2.6"
6) Double click on file with extension ".vmx"
7) Click "Play Virtual Machine" at the bottom of main window
8) Select "I copied it" on pop-up window and wait for few seconds
9) On next pop-up window, select "Remind Me Later"
10) On the login screen, type username/password: contiki/user.
1.2 Prerequisites
• VMware Workstation Player:
Get it from http://www.vmware.com/products/player/
• InstantContiki 2.6 (not 2.6.1):
Get it from http://sourceforge.net/projects/contiki/files/Instant%20Contiki/
• XM1000 Platform Files:
Get it from http://www.advanticsys.com/shop/asxm1000-p-24.html
1.3 Installation
If you do not have Contiki installed, you may follow the instruction before to install Contiki.
You can download the software following the above link. First install the VMware Workstation Player
according to its installation instructions.
Extract the Instant Contiki Files to your hard drive and Open the vmx File in the VMware Player.
If you have problems installing the player and the software have a look at this tutorial explaining the
installation process step-by-step (http://www.contiki-os.org).
In order to be able to run the programs that we are going to develop on the hardware nodes, we
need the toolchain for the MTM-XM1000 Sensor Nodes. Copy the extracted folder of the MTM-
XM1000 Platform files with [CTRL]-[C].
Login into the installed instant contiki vmware with user: contiki password: user and paste the files
on the Desktop with [CTRL]-[V].
Copy the platform/xm1000 folder in the 'platform' folder of your contiki tree in /home/user/contiki
Copy the tools/xm1000 folder in the 'tools' folder of your contiki tree in home/user/contiki
Open a terminal console and enter the following command:
$ make TARGET=xm1000 savetarget
You should now have the development environment for XM1000 mote.
1.4 Testing
You can now test your development environment by running “Hello World”. Note that in our lab
computers, we install XM1000 under “contiki-2.6” folder.
1) Change the working directory to Hello World example. Type the following command:
$ cd /home/user/contiki-2.6/examples/hello-world
2) Touch the source code to make sure that the code will be compiled next time.
$ touch hello-world.c
4) Upload your binary code to the mote. When it is successful, you should see “Mass Erase…” and
then “19408 bytes programmed” on the screen.
$ make TARGET=xm1000 hello-world.upload
Note: If the above step returns a “Permission denied” error, you can execute the command
using super user to gain permission. The password for super user is ‘user’.
$ sudo make TARGET=xm1000 hello-world.upload
Note: If the above step returns quickly without showing the number of bytes programmed, then
there may be a connection problem between your VM and the mote. Please make sure:
- your mote is connected to your host machine
- the guest os (or the VM) has captured the mote “MTM-XM1000MSP”
5) Login to the mote to see the result. First, type the following command:
$ make TARGET=xm1000 login
or use the following if permission is needed
$ sudo make TARGET=xm1000 login
Now you should see some random characters. Press the red button on the mote to reset the
mote and rerun your code.
You should now see “Hello, world” on the screen. Congratulation, you have a working
environment.
6) Use [CTRL]+[Z] to logout from the mote. You should return back to your command prompt.