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:cygwin\usr\local
sub-directory
of wherever you install Cygwin.
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
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.
"delete firmware failed" Because of a limitation in the Lego firmware, firmdl3 cannot delete brickOS. Instead, before downloading the new firmware, you must first stop the old brickOS program, and then hold down the Prgm button while hitting the On/Off switch. This will delete the old brickOS firmware, allowing a new download. Alternately, if you see no green light on the IR box and get this error message, it may indicate you have a dead battery in the IR tower.
"/dev/ttyS0: Permission denied", "com1: Permission denied", or a similar message. The first part of the error message is the output port that firmdl3 is trying to use. This can mean two things. Either you have specified the wrong device or you have specified the correct device but do not have permission to access it. If it is an access problem, speak to your sysadmin. If not, you can use the --tty argument to specify another device. Under cygwin, you probably probably want to use "firmdl3 --tty com1". If you discover that this is the case, you may wish to recompile firmdl3 to make your setting the default.
"/dev/ttyS0: Input/output error" or a similar message.You forgot to plug the tower in, most likely.
"unlock firmware failed" This indicates that there was a slight corruption in the download. Clear brickOS and download it again.
"no response from RCX" This error should be called "you forgot to turn on your RCX, moron." If I hadn't done it about 10 million times, I'd submit the patch to change the error myself.
If firmdl3 gives you repeated problems, you may want to try using the --slow argument, which will make your download much slower but can correct for certain errors caused by ambient light.
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.