provides automatic generation of the executable
code from the system description. Currently the only supported target is
processor of a LEGO Mindstorms RCX brick running
brickOS 0.2.6. (Note that brickOS was formerly known as legOS and
that the version supported by Times
under the old name. The pre-releases of brickOS, version 0.2.6.9 etc. are not
To use the code generation for a RCX brick you need to have the brickOS
operating system installed on the brick. You will find instructions on how to
get and install operating system from the brickOS
Here we only provide a brief summary of the installation process.
- On Linux/Solaris :
- Install a cross compiler for Hitachi H8 (see the brickOS site for
- Download brickOS from
- On Windows:
- Install the Cygwin environment from
- Download and install a pre-built cross compiler from
(the H8 GNU Tool). Note that brickOS 0.2.6 does not work with GCC from the
- Download brickOS from
Open the file Makefile.common in the brickOS root directory. About
line 116 there is a line:
CFLAGS=$(COPT) $(CWARN) $(CINC)
change it to:
CFLAGS=$(COPT) $(CWARN) $(CINC) $(CMACROS)
- Make note of the directory where you have installed brickOS.
- Open the Configuration window via menu
- In the tab
Code generator enter the name of the directory where
brickOS is installed into the field
chapter to learn more about
To generate code from a system description use the menu command
. This will generate several files
in the directory specified in the base name. The code generation does not
require brickOS to be installed.
What are the files generated?
The kernel code interpreting an automata structure.
Type and macros definitions.
Kernel API definition.
Definition of hooks executed at events in the kernel
(used by the logging module).
A stub for user hardware initialization code.
API definition of the initialization code.
An empty file where the shared global
variables are be defined, if they are not defined in the model.
Generated definitions of the constants used in the code
(e.g. number of transitions).
The main code generated including the tasks and
the automata structure.
Compiling Generated Code
To compile the generated code you can either use the GUI or a
separate shell. The compilation requires legOS and the cross compiler to be
installed. To compile from the GUI use the menu option
To compile, using a separate shell, go to the output directory and enter
execute the following command:
Uploading and Executing Compiled Binaries
To upload the generated and compiled code to the RCX-brick you must
connect and switch on the IR-tower. Place the brick in front of the tower and
turn it on.
To upload binaries to the RCX brick execute the following command:
bash$ make upload
To execute an uploaded program simply press the
button on a brick.
If the code is generated with the logging option a module that sends LNP
messages at events in the kernel is included. The logged events are:
- Discrete transition.
- Task release.
- Task start.
- Task end.