Setting up brickOS

For quick information on how to get brickOS up and running, see the QuickStart guide. This page provides a more detailed explanation of what happens and what could happen while you're installing brickOS.

Getting brickOS

All required files are mirrored on the course website. There aren't very many. The cs148 course version of brickOS is based off of LegOS 0.2.5.

Currently, we only support brickOS in the Sun Lab (Linux), MS Lab, and on Windows 98/NT/2000/XP machines. Macintosh and Solaris users are out of luck.

Files needed:

Preliminary steps

You'll need to install Cygwin, and the h8/300 cross-compiler. Cygwin must be installed with the modules listed in the QuickStart guide or else brickOS might not work with cygwin.  The cross-compiler must be unzipped into the cygwin\usr\local sub-directory of wherever you install Cygwin.

Installing and compiling the brickOS kernel

unzip the brickOS source code into a directory of your choice (preferably c:\brickOS) If you choose any other directory, you may have to modify the Makefile accordingly

Once you've done this, start up a bash shell (Cygwin), and issue the following commands:
cd /brickOS
make realclean
make depend
make
cd util
make strip

Putting a kernel into the RCX

You should now have a file called c:\brickOS\boot\brickOS.srec This is the kernel image that will be put into the RCX. To do this, use the Makefile provided for you in c:/brickOS/projects directory. The Makefile just executes a command line using the util/firmdl3 utility and uses brickOS.srec as its first argument.

cd c:/brickOS/project
make brick

Possible firmdl3 errors.

I've tried to show the exact error messages outputted by firmdl3. Since the actual errors aren't quite perfect, I won't correct them.

Compiling a program and downloading it to the RCX using the Makefile

brickOS has its own file format -- .lx -- for programs. When you want to put a program into the RCX, you make a .lx file and download it. As part of the installation, some demo programs were compiled for you in demo/

You can use the Makefile in the sub-directory projects to compile your programs. This should be the directory where you will be writing and compiling your programs.  A simple "Hello World" program is already in the directory.

To compile and download the program to your RCX, first make sure you have the brickOS kernel in your RCX.If not, type make brick to download the kernel to the RCX.Now type
make install

This will compile the program and download the program automatically to the RCX. You'll note that the download protocol is very fault tolerant - you should be able to move the RCX or temporarily block the download, and still have it recover.

If all is well, you should have a .lx file and the "Hello World" program should be downloaded into Program Slot 1. Press Run on the RCX, "Hello World" should flash on the lcd.

The command make install first compiles your program to a .lx file. It does this by using the cross-compiler to compile your .c file to a .lx file. Then it uses the util/dll utility to download your .lx file to your RCX.

Look at the Makefile to see how edit it to compile a new program and download it to other program slots. The Makefile makes it easier when you want to download multiple programs to the RCX, you just need to type one command and it does it all for you!

The commands equivalent to typing make install would be:
make filename.lx  (where filename.c is your source code)
c:/brickOS/util/dll directory/filename.lx  (where directory is the directory where your .lx file is)  

dll is a flexible tool with lots of useful options. The two more important are -p and -e. -pX allows the user to specify a program slot from 0-7. In this way, you can store multiple programs in your RCX. Once downloaded, use the "PRGM" button to rotate between the various programs you have downloaded. If you don't use -p, then dll defaults to downloading the program to the first program slot (which is numbered 0, of course). The -e flag automatically runs the program as soon as it is downloaded. To see the rest of the commands available, just type "dll" without any arguments.

dll error messages

Unfortunately, there is basically only one dll error message, and it applies to most possible errors, including a disconnected IR tower, an RCX that is turned off, an RCX that doesn't have brickOS, and an RCX that has brickOS and is already running a program. So, check all those things when dll fails.