Difference between revisions of "Installing MansOS"

From DiLab
Jump to: navigation, search
(MacOS X)
 
(27 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{TocRight}}
 
{{TocRight}}
When you install MansOS development environment you need to know two things:
 
* What is the '''development host''' where you will compile your applications. All of the major desktop operating systems (Linux, Windows, MacOS) are supported as MansOS development hosts.
 
* What is the '''target platform''' or platforms that you will be developing for. At least you should know what is the main micro controller. MansOS supports several popular target controller families: TI msp430, 8-bit Atmega controllers and Nordic Semiconductor nRF24LE1. One can also compile the application for the current PC host, for example, for simulation and debugging purposes.
 
  
= Step #1: Prerequisites for installation =
+
When installing MansOS development environment you need to decide two things:
 +
 
 +
* What is the '''development host''' - where the application is developed and compiled. MansOS supports Linux, Windows, and MacOS operating systems. The best version is usually available for Linux first.
 +
 
 +
* What is the '''target platform'''(s) - on which the application will be running. At least the main micro controller should be known. MansOS supports several popular target controller families, e.g.: TI msp430, 8-bit Atmega controllers. One can also compile the application for the current PC host, for example, for simulation and debugging purposes.
 +
 
 +
 
 +
= Step 1: Prerequisites =
  
 
In general, the following programs are needed:
 
In general, the following programs are needed:
Line 13: Line 17:
 
If you already have them, you can skip this section.
 
If you already have them, you can skip this section.
  
== Linux and *BSD ==
+
== Linux (e.g. Ubuntu) ==
=== Using manual installation ===
+
 
 +
==== MSP430 ====
 +
Often MSP430 GCC toolchain is available as package in the OS repository.
 +
 
 +
: To install for Ubuntu (12.04 and higher) one or both lines should suffice:
 +
sudo apt-get install make gcc-msp430
 +
sudo apt-get install msp430-libc binutils-msp430  python-wxtools python-serial python-ply
 +
 
 +
 
 +
==== Atmega controllers and Arduino ====
 +
 
 +
Atmega platform support includes controllers such as ATMega328P MCU, which is a part of [http://www.arduino.cc Arduino Duemillanove].
 +
 
 +
This platform requires AVR-GCC toolchain. In Ubuntu you can get one as follows:
 +
 
 +
sudo apt-get install gcc-avr avr-libc binutils-avr avrdude
 +
 
 +
'''Warning''': older avr-gcc and avr-libc version (prior 4.3.4) do not support ATMega328P micro controller, which is used in MansOS. If your distribution has an older avr-gcc, you can [[AVR toolchain compilation |compile AVR toolchain by hand]].
 +
 
 +
'''Warning''': If you have TinyOS installed from [http://tinyos.stanford.edu/tinyos/ TinyOS] repository, you must uninstall TinyOS AVR packages which do conflict with the newest versions provided by official Ubuntu repository:
 +
sudo apt-get remove avr-binutils-tinyos avr-gcc-tinyos avr-libc-tinyos
 +
 
 +
Read here for more about the [[Platforms_atmega | support of the Atmega]] controllers in Mansos and the required tools.
  
For MSP430 based platforms, download and install either of these:
+
==== Nordic Semiconductor (nRF) ====
* http://mspgcc4.sourceforge.net/ - provides MSP tools based on GCC version 4
+
'''nRF''' platform for '''Nordic Semiconductors''' controllers with RF+MCU chips such as nrf24le1 may need [[SDCC]] compiler.  
* http://mspgcc.sourceforge.net/ - alternative, should you need the older GCC version 3
+
Here are the [[SDCC | SDCC installation instructions]].
  
After installing ''msp430-gcc'' you'll need to set up you ''$PATH'' correctly. Add this line to your ''~/.bashrc'' file (assuming ''msp430-gcc'' is installed in ''/opt''):
+
== MacOS X ==
export PATH="/opt/msp430-gcc/bin:$PATH"
+
Developer tools must be installed to support compilation environment. It can be found either on MacOS X installation DVD, or on [http://developer.apple.com/technologies/tools/ Apple web page].
  
=== Using package management software ===
+
=== TelosB / MSP430 platform ===
 +
MSP430 toolchain is required. The easiest way is to install MCP430 GCC v4, which has a pretty straightforward installation script prepared. Download it from http://mspgcc4.sourceforge.net/ .
  
Install MSP430 tools:
+
Alternatively there is a pre-built [http://www.sics.se/contiki/tutorials/tutorial-msp430-tools-with-installer-for-the-intel-mac.html Contiki OS package for MacOS X], provided by the Contiki Team at [http://www.sics.se SICS]. It includes MSP430 toolchain (version 3.3, works for TelosB) as part of Contiki OS.
http://mansos.net/deb/binutils-msp430_2.17-2_i386.deb - MSP430 binutils
 
http://mansos.net/deb/gcc-msp430_3.2.3-2_i386.deb - MSP430 GCC compiler
 
http://mansos.net/deb/msp430-libc_20071026_i386.deb - MSP430 libc
 
http://mansos.net/deb/msp430-tools_i386.deb - MSP430 tools metapackage
 
  
Alternatively, install the tool packages provided by TinyOS.
+
=== Arduino / ATMega platform ===
 +
Arduino platform requires AVR-GCC toolchain. Although it is included in [http://tinyos.net TinyOS], the version included is too old and does not support ATMega328P MCU, which is a part of [http://www.arduino.cc Arduino Duemillanove]. Therefore there are two options. Please choose just one of them (not both at a time!):
 +
* a) Download a ready-to-use [http://www.obdev.at/products/crosspack/download-de.html AVR-CrossPack], install it and set up path, by adding the following line to your ~/.profile file:
 +
export PATH=/usr/local/CrossPack-AVR/bin:$PATH
 +
* b) manual AVR-GCC toolchain compilation. Read [[AVR toolchain compilation]] instructions.
  
 
== Windows ==
 
== Windows ==
  
MansOS on Windows is supported using Cygwin. (It may also work with MinGW.)
+
MansOS on Windows is supported both using Cygwin and MinGW (with ''msys'').
  
 
Download and install [http://www.cygwin.com Cygwin]. Here's a direct link to [http://www.cygwin.com/setup.exe the setup program].
 
Download and install [http://www.cygwin.com Cygwin]. Here's a direct link to [http://www.cygwin.com/setup.exe the setup program].
  
Make sure to select the following Cygwin packages:
+
Make sure to select the following Cygwin packages, when prompted in the "Select packages" screen (it can be helpful to switch to the "Full" view first):
 
* gcc
 
* gcc
 
* make
 
* make
 
* python  
 
* python  
* svn
+
* rpm
* openssh (required only if you'll want to use non-anonymous SVN access)
+
* subversion (SVN)
* rpm (required only if you'll want to use the pre-made RPM packages for installation)
+
 
 +
If write access to SVN is needed (e.g. for MansOS developers), also select:
 +
* openssh
  
After this you'll need to install msp430 tools. There are two options for this:
+
=== Installing msp430 tools ===
 +
 
 +
After getting the general software you'll need to install the msp430 specific tools. There are two options for this:
 
# Installing the tools manually
 
# Installing the tools manually
 
# Installing the tools from RPM packages provided by TinyOS
 
# Installing the tools from RPM packages provided by TinyOS
  
=== Manual installation ===
+
==== Manual installation ====
  
Follow the instructions in ''mspgcc'' homepages. Download and install either of these:
+
Follow the instructions in ''mspgcc'' homepage.
* http://mspgcc4.sourceforge.net/ - provides MSP tools based on GCC version 4
+
* http://mspgcc.sourceforge.net/
* http://mspgcc.sourceforge.net/ - same, but for GCC version 3 (older)
 
  
=== Installation using RPM packages ===
+
The simplest way is:
 +
# Download a pre-built package (archive) for Windows
 +
# Create a folder /opt/msp430-gcc (relative to Cygwin top directory, e.g. ''C:\cygwin\opt\msp430-gcc'')
 +
# Extract the downloaded archive in /opt/msp430-gcc
  
The recommended way to install msp430 tools is to use [http://www.tinyos.net/tinyos-2.x/doc/html/install-tinyos.html rpm packages provided by TinyOS]. Download the RPM packages:
+
==== Installation using RPM packages ====
 +
 
 +
You may already have certain compilers and tools installed if you have TinyOS. Or you could install [http://www.tinyos.net/tinyos-2.x/doc/html/install-tinyos.html TinyOS rpm packages]. The RPM packages are available here:
 
  http://www.tinyos.net/dist-2.0.0/tools/windows/msp430tools-base-0.1-20050607.cygwin.i386.rpm
 
  http://www.tinyos.net/dist-2.0.0/tools/windows/msp430tools-base-0.1-20050607.cygwin.i386.rpm
 
  http://www.tinyos.net/dist-2.0.0/tools/windows/msp430tools-python-tools-1.0-1.cygwin.noarch.rpm
 
  http://www.tinyos.net/dist-2.0.0/tools/windows/msp430tools-python-tools-1.0-1.cygwin.noarch.rpm
Line 68: Line 103:
 
Install the RPM packages:
 
Install the RPM packages:
 
  $ rpm -ivh --force --nodeps --ignoreos *.rpm
 
  $ rpm -ivh --force --nodeps --ignoreos *.rpm
 +
 +
=== Installing TinyOS tools ===
 +
 +
At the moment TinyOS tools (i.e. ''motelist'' and ''tos-bsl'') also are required for MansOS on Cygwin. The recommended way of getting them is to download a .rpm package from http://tinyos.stanford.edu/tinyos-rpms/tinyos-tools-1.4.0-3.cygwin.i386.rpm and install it using
 +
$ rpm -ivh --force --nodeps --ignoreos tinyos-tools-1.4.0-3.cygwin.i386.rpm
  
 
=== Finishing installation ===
 
=== Finishing installation ===
Line 73: Line 113:
 
Set up you ''$PATH'' to point to ''msp430-gcc'' tools. Add this line to your ''~/.bashrc file'' (assuming ''msp430-gcc'' is installed in ''/opt''):
 
Set up you ''$PATH'' to point to ''msp430-gcc'' tools. Add this line to your ''~/.bashrc file'' (assuming ''msp430-gcc'' is installed in ''/opt''):
 
  export PATH="/opt/msp430-gcc/bin:$PATH"
 
  export PATH="/opt/msp430-gcc/bin:$PATH"
The .bashrc file can be found in your home directory, which is a location like this: ''C:\cygwin\home\username\.bashrc''.
+
The .bashrc file can be found in your home directory, which is in a location like this: ''C:\cygwin\home\username\.bashrc''.
  
=== Support for serial port interfacing with motes ===
+
=== Support for serial port interfacing with sensor nodes ===
  
To upload compiled programs to a mote you'll need to install proper USB to serial port drivers first. The drivers are included in Tmote Sky driver CD. If you don't have the CD, download the drivers from [http://www.ftdichip.com/Drivers/VCP.htm here]. For more details consult the Tmote Sky Quick Start Guide, section USB Serial COM Driver Install (page 7). The guide is availabe at http://www.cems.uvm.edu/~crobinso/mote/tmote-sky-quickstart-110.pdf.
+
To upload compiled programs to a mote you'll need to install proper USB to serial port drivers first. The drivers are included in Tmote Sky driver CD. If you don't have the CD, download the drivers from [http://www.ftdichip.com/Drivers/VCP.htm here]. For more details consult the Tmote Sky Quick Start Guide, section USB Serial COM Driver Install (page 7). The guide is available at http://www.cems.uvm.edu/~crobinso/mote/tmote-sky-quickstart-110.pdf.
  
 
Now install MansOS sources and check that ''motelist'' detects all motes attached to the Windows PC:
 
Now install MansOS sources and check that ''motelist'' detects all motes attached to the Windows PC:
Line 85: Line 125:
 
  M4AOQGBQ    COM8      tmote sky
 
  M4AOQGBQ    COM8      tmote sky
  
== MacOS ==
+
Note: USB port driver is installed on first use of TMote Sky sensor node (or any other node, using FTDI USB to serial chip). If you get an error "error, could not open key HKLM\SYSTEM\CurrentControlSet\Enum\FTDIBUS", it means, that FTDI USB driver has not been loaded. To load it, plug in TMote Sky sensor node, and the driver will be loaded automatically.
 
 
...
 
TODO
 
...
 
  
= Step #2: Getting MansOS =
+
= Step 2: Getting MansOS sources =
 +
MansOS source code is available either using SVN version control or in a pre-packaged form.
  
 
=== Using version control system ===
 
=== Using version control system ===
Line 97: Line 134:
 
MansOS sources are available for anonymous checkout from SVN:
 
MansOS sources are available for anonymous checkout from SVN:
 
<pre>
 
<pre>
  $ svn co http://mansos.net/svn/mansos/ mansos
+
  $ svn checkout http://mansos.googlecode.com/svn/trunk/ mansos
  A    mansos/archive
+
  A    mansos/apps
  A    mansos/archive/test
+
  A    mansos/apps/tests
 
  ...
 
  ...
  Checked out revision 732.
+
  Checked out revision 600.
 
</pre>
 
</pre>
[[Image:mansos-svn.png]]
 
  
 
If you also want to receive SVN write access, contact MansOS developers.
 
If you also want to receive SVN write access, contact MansOS developers.
  
=== Using package management software (broken at the moment!) ===
+
=== Using package management software ===
  
Get and install the MansOS Debian package: http://mansos.net/box/mansos-0.1.0_20101101_all.deb
+
Get and install the MansOS Debian package: http://code.google.com/p/mansos/downloads/detail?name=mansos_0.1-r684_all.deb&can=2
  
The package depends on either ''msp430-tools'' metapackage, ''tinyos-required-msp430'' package, or ''tinyos-required-avr'' package.
+
The dependencies are listed above and in the Google Code site.
  
= Step #3: Testing your installation =
+
= Step 3: Testing your installation =
  
 
  $ ls mansos
 
  $ ls mansos
  apps archive CREDITS.txt  doc  mos pc  README.txt  USE_AND_DISCLAIMER.txt
+
  apps  CREDITS.txt  doc  mos   README.txt
 
[[Image:mansos-ls.png]]
 
[[Image:mansos-ls.png]]
  
Line 129: Line 165:
  
 
To test serial port output:
 
To test serial port output:
  $ cd mansos/apps/demo/CounterToSerial
+
  $ cd mansos/apps/demo/PrintCounter
 
  $ make telosb upload
 
  $ make telosb upload
 
Now you can use a tool like ''minicom'' or ''putty'' (on Windows) to monitor the serial port. The settings: baudrate=38400, flow-control turned off.
 
Now you can use a tool like ''minicom'' or ''putty'' (on Windows) to monitor the serial port. The settings: baudrate=38400, flow-control turned off.
Line 138: Line 174:
 
  $ make pc run
 
  $ make pc run
 
[[Image:mansos-pc.png]]
 
[[Image:mansos-pc.png]]
 +
 +
= Extras =
 +
 +
For msp430-based sensor board debugging ''mspsim'' tool can be useful. MansOS has support for ''mspsim'' on '''telosb''' platform.
 +
 +
To use ''mspsim'' (from Linux):
 +
# Download the source code from http://www.sics.se/project/mspsim and extract it to ''/opt/mspsim''
 +
# Build a MansOS application for ''telosb mspsim'' target. For example, to build Blink:
 +
$ cd mansos/apps/demo/Blink
 +
$ make telosb mspsim
 +
 +
The expected result:
 +
{|align=left
 +
|
 +
[[Image:mansos-mspsim.jpg|thumb|alt=Blink on mspsim|Blink on mspsim]]

Latest revision as of 14:29, 23 February 2015

When installing MansOS development environment you need to decide two things:

  • What is the development host - where the application is developed and compiled. MansOS supports Linux, Windows, and MacOS operating systems. The best version is usually available for Linux first.
  • What is the target platform(s) - on which the application will be running. At least the main micro controller should be known. MansOS supports several popular target controller families, e.g.: TI msp430, 8-bit Atmega controllers. One can also compile the application for the current PC host, for example, for simulation and debugging purposes.


Step 1: Prerequisites

In general, the following programs are needed:

  • Compiler and binutils
    • For example, msp430-gcc for TelosB and msp430 platforms or avr-gcc for Atmega platform
  • GNU make
  • Python

If you already have them, you can skip this section.

Linux (e.g. Ubuntu)

MSP430

Often MSP430 GCC toolchain is available as package in the OS repository.

To install for Ubuntu (12.04 and higher) one or both lines should suffice:
sudo apt-get install make gcc-msp430
sudo apt-get install msp430-libc binutils-msp430  python-wxtools python-serial python-ply


Atmega controllers and Arduino

Atmega platform support includes controllers such as ATMega328P MCU, which is a part of Arduino Duemillanove.

This platform requires AVR-GCC toolchain. In Ubuntu you can get one as follows:

sudo apt-get install gcc-avr avr-libc binutils-avr avrdude

Warning: older avr-gcc and avr-libc version (prior 4.3.4) do not support ATMega328P micro controller, which is used in MansOS. If your distribution has an older avr-gcc, you can compile AVR toolchain by hand.

Warning: If you have TinyOS installed from TinyOS repository, you must uninstall TinyOS AVR packages which do conflict with the newest versions provided by official Ubuntu repository:

sudo apt-get remove avr-binutils-tinyos avr-gcc-tinyos avr-libc-tinyos

Read here for more about the support of the Atmega controllers in Mansos and the required tools.

Nordic Semiconductor (nRF)

nRF platform for Nordic Semiconductors controllers with RF+MCU chips such as nrf24le1 may need SDCC compiler. Here are the SDCC installation instructions.

MacOS X

Developer tools must be installed to support compilation environment. It can be found either on MacOS X installation DVD, or on Apple web page.

TelosB / MSP430 platform

MSP430 toolchain is required. The easiest way is to install MCP430 GCC v4, which has a pretty straightforward installation script prepared. Download it from http://mspgcc4.sourceforge.net/ .

Alternatively there is a pre-built Contiki OS package for MacOS X, provided by the Contiki Team at SICS. It includes MSP430 toolchain (version 3.3, works for TelosB) as part of Contiki OS.

Arduino / ATMega platform

Arduino platform requires AVR-GCC toolchain. Although it is included in TinyOS, the version included is too old and does not support ATMega328P MCU, which is a part of Arduino Duemillanove. Therefore there are two options. Please choose just one of them (not both at a time!):

  • a) Download a ready-to-use AVR-CrossPack, install it and set up path, by adding the following line to your ~/.profile file:
export PATH=/usr/local/CrossPack-AVR/bin:$PATH

Windows

MansOS on Windows is supported both using Cygwin and MinGW (with msys).

Download and install Cygwin. Here's a direct link to the setup program.

Make sure to select the following Cygwin packages, when prompted in the "Select packages" screen (it can be helpful to switch to the "Full" view first):

  • gcc
  • make
  • python
  • rpm
  • subversion (SVN)

If write access to SVN is needed (e.g. for MansOS developers), also select:

  • openssh

Installing msp430 tools

After getting the general software you'll need to install the msp430 specific tools. There are two options for this:

  1. Installing the tools manually
  2. Installing the tools from RPM packages provided by TinyOS

Manual installation

Follow the instructions in mspgcc homepage.

The simplest way is:

  1. Download a pre-built package (archive) for Windows
  2. Create a folder /opt/msp430-gcc (relative to Cygwin top directory, e.g. C:\cygwin\opt\msp430-gcc)
  3. Extract the downloaded archive in /opt/msp430-gcc

Installation using RPM packages

You may already have certain compilers and tools installed if you have TinyOS. Or you could install TinyOS rpm packages. The RPM packages are available here:

http://www.tinyos.net/dist-2.0.0/tools/windows/msp430tools-base-0.1-20050607.cygwin.i386.rpm
http://www.tinyos.net/dist-2.0.0/tools/windows/msp430tools-python-tools-1.0-1.cygwin.noarch.rpm
http://www.tinyos.net/dist-2.0.0/tools/windows/msp430tools-binutils-2.16-20050607.cygwin.i386.rpm
http://www.tinyos.net/dist-2.0.0/tools/windows/msp430tools-gcc-3.2.3-20050607.cygwin.i386.rpm
http://www.tinyos.net/dist-2.0.0/tools/windows/msp430tools-libc-20050308cvs-20050608.cygwin.i386.rpm

Install the RPM packages:

$ rpm -ivh --force --nodeps --ignoreos *.rpm

Installing TinyOS tools

At the moment TinyOS tools (i.e. motelist and tos-bsl) also are required for MansOS on Cygwin. The recommended way of getting them is to download a .rpm package from http://tinyos.stanford.edu/tinyos-rpms/tinyos-tools-1.4.0-3.cygwin.i386.rpm and install it using

$ rpm -ivh --force --nodeps --ignoreos tinyos-tools-1.4.0-3.cygwin.i386.rpm

Finishing installation

Set up you $PATH to point to msp430-gcc tools. Add this line to your ~/.bashrc file (assuming msp430-gcc is installed in /opt):

export PATH="/opt/msp430-gcc/bin:$PATH"

The .bashrc file can be found in your home directory, which is in a location like this: C:\cygwin\home\username\.bashrc.

Support for serial port interfacing with sensor nodes

To upload compiled programs to a mote you'll need to install proper USB to serial port drivers first. The drivers are included in Tmote Sky driver CD. If you don't have the CD, download the drivers from here. For more details consult the Tmote Sky Quick Start Guide, section USB Serial COM Driver Install (page 7). The guide is available at http://www.cems.uvm.edu/~crobinso/mote/tmote-sky-quickstart-110.pdf.

Now install MansOS sources and check that motelist detects all motes attached to the Windows PC:

$ motelist
Reference   CommPort   Description
----------  ---------- ----------------------------------
M4AOQGBQ    COM8       tmote sky

Note: USB port driver is installed on first use of TMote Sky sensor node (or any other node, using FTDI USB to serial chip). If you get an error "error, could not open key HKLM\SYSTEM\CurrentControlSet\Enum\FTDIBUS", it means, that FTDI USB driver has not been loaded. To load it, plug in TMote Sky sensor node, and the driver will be loaded automatically.

Step 2: Getting MansOS sources

MansOS source code is available either using SVN version control or in a pre-packaged form.

Using version control system

MansOS sources are available for anonymous checkout from SVN:

 $ svn checkout http://mansos.googlecode.com/svn/trunk/ mansos
 A    mansos/apps
 A    mansos/apps/tests
 ...
 Checked out revision 600.

If you also want to receive SVN write access, contact MansOS developers.

Using package management software

Get and install the MansOS Debian package: http://code.google.com/p/mansos/downloads/detail?name=mansos_0.1-r684_all.deb&can=2

The dependencies are listed above and in the Google Code site.

Step 3: Testing your installation

$ ls mansos
apps  CREDITS.txt  doc  mos   README.txt

Mansos-ls.png

To test building for TelosB (Tmote Sky):

$ cd mansos/apps/demo/Blink
$ make telosb

Mansos-build.png

If you have motes attached:

$ make telosb upload

Mansos-build-upload.png

To test serial port output:

$ cd mansos/apps/demo/PrintCounter
$ make telosb upload

Now you can use a tool like minicom or putty (on Windows) to monitor the serial port. The settings: baudrate=38400, flow-control turned off. Mansos-serial.png

To test the PC simulator:

$ make pc
$ make pc run

Mansos-pc.png

Extras

For msp430-based sensor board debugging mspsim tool can be useful. MansOS has support for mspsim on telosb platform.

To use mspsim (from Linux):

  1. Download the source code from http://www.sics.se/project/mspsim and extract it to /opt/mspsim
  2. Build a MansOS application for telosb mspsim target. For example, to build Blink:
$ cd mansos/apps/demo/Blink
$ make telosb mspsim

The expected result:

Blink on mspsim
Blink on mspsim