
Stargate Developer’s Guide
Wireless Sensor Networks
Doc. # 7430-0317-13 Rev. B
Page 23
The /mnt/cf1/cdc/bin/jre script file is linked to /usr/sbin/jre to be included in the default path. The jre
script is used to start a compiled Java program.
To start a compiled Java program issue the following command:
$ jre <Java class>
The jre script accepts a single command line argument by default and includes the basic class
libraries. This script can be modified to add additional command line arguments and class library
references.
3.3 Starting Programs during System Boot-up
To start programs automatically when the Stargate boots up you need to do the following:
1.
Create a script in the /etc/init.d folder, call it say myprog.sh. This script when called starts the
/usr/local/myprog program in the background. You must run the program in the background
otherwise the boot-up sequence will pause until the program completes.
Example script file myprog.sh:
#!/bin/sh
# Start program as a background task
/usr/local/myprog >/dev/null 2>&1 &
The & tells the command processor to start the program as a background task then continue. The
>/dev/null redirects the standard output to the null device. The 2>&1 sends the standard error output
to the null device as well (via standard out). Re-directing the program output to the null device
prevents messages from appearing on the console screen.
2.
Create a link to the script you just created to /etc/rc2.d. The name of the link tells the command
processor what order to start it.
Example:
$ ln –s /etc/init.d/myprog /etc/rc2.d/S99myprog
The Stargate will then run the /etc/init.d script with a relative startup priority of 99. The links with
01 run first, and so on.
3.4 Programming
Motes
The Stargate can be used to download programs onto motes via the on-board connector in a similar
manner to the MIB510 & MIB600 cards. The application program must first be compiled within the
Cygwin TinyOS environment on the PC. The resulting program image is then copied to the Stargate
and then the programming instruction can be issued.
Open Cygwin shell on PC –
(cd to application folder and build)
$ make mica2
(set mote id, this example sets it to 1)
$ set-mote-id build/mica2/main.srec build/mica2/main.srec.out 1
(Copy image with mote id applied to Stargate for programming step)
$ scp build/mica2/main.srec.out root@<Stargate IP Address>/usr
Open Stargate shell -
Содержание Stargate
Страница 1: ...Stargate Developer s Guide Rev B January 2006 Document 7430 0317 13 ...
Страница 50: ......
Страница 51: ......