To build TinySoar's host environment, you'll need:
To build the TinySoar runtime for the Lego® Mindstorms RCX, you'll need:
gcc: installing these is probably the quickest
way to get started. If you're a die-hard, configure and build
binutils and gcc to cross-compile to
H8/300 yourself.
firmdl3 utility to download the
TinySoar runtime onto the RCX.
You can download the most up-to-date development version of the code (“the trunk”) using anonymous CVS. First, you'll need to log in:
$ cvs -d :pserver:anonymous@cvs.tinysoar.sourceforge.net:/cvsroot/tinysoar login (Logging in to anonymous@cvs.tinysoar.sourceforge.net) CVS password:
There is no password, so just press return. Then, checkout the source code using this command:
$ cvs -d :pserver:anonymous@cvs.tinysoar.sourceforge.net:/cvsroot/tinysoar co tinysoar
Alternatively, you can download the a released “tarball” from the TinySoar project homepage on SourceForge.
Start by creating a directory that is a sibling of the
tinysoar directory; e.g., if you've installed TinySoar
in /usr/src/tinysoar/tinysoar, create a directory
called /usr/src/tinysoar/debug. Then, run configure:
$ cd /usr/src/tinysoar/debug (or wherever) $ CFLAGS="-g -DDEBUG" ../tinysoar/configure
This will configure TinySoar four your host environment.
Next, build the TinySoar Tcl extension:
$ make tcl-extension
Now, you should be able to run tclsh and load the TinySoar
extension:
$ TCLLIBPATH=`pwd` tclsh % package require TinySoar Firing: Retracting: 1.0 %
If you get this far, TinySoar has been installed successfully for your host environment.
Once you've got your cross-compilation environment set up (building and installing LegOS would be a good test for this), you're ready to build TinySoar for the Lego RCX.
Make another directory that's a sibling of the
tinysoar directory; e.g.,
/usr/src/tinysoar/h8300-hitachi-hms. Then configure
TinySoar for the Lego RCX:
$ cd /usr/src/tinysoar/h8300-hitachi-hms (or wherever) $ CFLAGS="-O2 -fomit-frame-pointer" ../tinysoar/configure \ > --target=h8300-hitachi-hms --with-sizeof-int=2 --without-rete-create
(I know, I really should make configure smart enough
to know all this junk.)
Then, build the target environment:
$ make legosoar
This will link in a pre-existing agent (agent.inc in
the tinysoar source directory, which was exported from
tests/bumper.soar), and create a file called
lego that can be downloaded to the RCX using the
firmdl3 program included with LegOS. Assuming you've
installed LegOS in /usr/src/legOS, you'd type
something like:
$ /usr/src/legOS/util/firmdl3 --slow ./legosoar
I've never had any luck with the --fast option (maybe
I'm doing something wrong), so the --slow download
will take about two minutes. Once it's done, you should be able to
press the Run button on the RCX to start the
bumper.soar agent.
Note that you'll need to pull the batteries out of the RCX each time before downloading a new TinySoar agent. This is because a TinySoar agent is firmware, and isn't smart enough to notice that new firmware is trying to be downloaded on top of it. (I really ought to fix this.)