mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-08-25 19:29:10 +00:00
128 lines
4.1 KiB
Plaintext
128 lines
4.1 KiB
Plaintext
The examples/ directory contains a few examples that will help you get
|
|
started with Contiki.
|
|
|
|
To run the example programs, you need either to be running Linux or
|
|
FreeBSD (or any other *nix-type system), or install Cygwin if you are
|
|
running Microsoft Windows (http://www.cygwin.com/). As a minimum you
|
|
will need to have the gcc C compiler installed. To run the examples in
|
|
the 'netsim' target, you need to have GTK 1.x development libraries
|
|
installed. These are usually called 'gtk-devel', 'libgtk1-devel' or
|
|
similar in your Linux software installation programs.
|
|
|
|
hello-world/
|
|
|
|
A really simple Contiki program that shows how to write Contiki
|
|
programs. To compile and test the program, go into the hello-world
|
|
directory:
|
|
|
|
cd examples/hello-world
|
|
|
|
Run the 'make' command.
|
|
|
|
make
|
|
|
|
This will compile the hello-world program in the 'native' target.
|
|
This causes the entire Contiki operating system and the hello-world
|
|
application to be compiled into a single program that can be run by
|
|
typing the following command:
|
|
|
|
./hello-world.native
|
|
|
|
This will print out the following text:
|
|
|
|
Contiki initiated, now starting process scheduling
|
|
Hello, world
|
|
|
|
The program will then appear to hang, and must be stopped by
|
|
pressing the C key while holding down the Control key.
|
|
|
|
multi-threading/
|
|
|
|
A quite simple demonstration of the Contiki multi-threading library
|
|
employing two worker threads each running a recursive function. It
|
|
can be compiled and run in the 'native' target by typing the
|
|
following commands:
|
|
|
|
cd examples/multi-threading
|
|
make
|
|
./multi-threading.native
|
|
|
|
rime/
|
|
|
|
Contains a set of examples on how to use the Rime communications
|
|
stack. To run those examples in the 'netsim' target (a very simple
|
|
Contiki network simulator), compile the programs with:
|
|
|
|
make TARGET=netsim
|
|
|
|
You will need to have GTK 1.x development libraries installed.
|
|
|
|
Run the different programs:
|
|
|
|
./test-abc.netsim
|
|
./test-meshroute.netsim
|
|
./test-rudolph0.netsim
|
|
./test-rudolph1.netsim
|
|
./test-treeroute.netsim
|
|
./test-trickle.netsim
|
|
./test-uabc.netsim
|
|
|
|
Most of the examples requires you to click with the middle mouse
|
|
button on one of the simulated nodes for something to happen.
|
|
|
|
sky/
|
|
|
|
Examples inteded for running on the Tmote Sky board. To compile
|
|
those, you need to have msp430-gcc (the gcc C compiler for the
|
|
MSP430 microcontroller) installed.
|
|
|
|
The follwing programs are included:
|
|
|
|
blink.c A simple program that blinks the on-board LEDs
|
|
sky-treeroute.c Collects sensor data to a sink (press button to
|
|
make the node a sink)
|
|
tcprudolph0.c TCP server that receives loadable ELF files and
|
|
sends them to the network.
|
|
test-button.c Toggles the LEDs when the button is pressed.
|
|
test-cfs.c Tests the 1 mb flash memory of the Tmote Sky
|
|
|
|
telnet-server/
|
|
|
|
A simple TCP telnet server with a simple command shell. It can be
|
|
compiled and run in the 'minimal-net' target by typing the following
|
|
commands:
|
|
|
|
cd examples/telnet-server
|
|
make
|
|
./telnet-server.minimal-net
|
|
|
|
Most likely you'll have to adjust the TCP/IP values set in main() in
|
|
platform/minimal-net/contiki-main.c to match your needs.
|
|
|
|
Please consult cpu/native/net/README-WPCAP as well if you are running
|
|
Microsoft Windows.
|
|
|
|
webserver/
|
|
|
|
A web server supporting dynamic content creation using "scripts" which
|
|
are actually compiled-in C-functions. It can be compiled and run in the
|
|
'minimal-net' target by typing the following commands:
|
|
|
|
cd examples/webserver
|
|
make
|
|
./webserver.minimal-net
|
|
|
|
As an alternative to the static and dynamic compiled-in content the web
|
|
server can instead support "external" static-only content loaded from
|
|
any storage supported by the 'Contiki File System' (CFS) interface. To
|
|
compile it in the 'minimal-net' target and have it load files from disk
|
|
use the following command:
|
|
|
|
make HTTPD-CFS=1
|
|
|
|
Most likely you'll have to adjust the TCP/IP values set in main() in
|
|
platform/minimal-net/contiki-main.c to match your needs.
|
|
|
|
Please consult cpu/native/net/README-WPCAP as well if you are running
|
|
Microsoft Windows.
|