Contents
Last update:
Thursday, 06 Nov 2008, 10:26:39
Optimized for: Mozilla/5.0 MSIE/6.0+
[an error occurred while processing this directive] [an error occurred while processing this directive]
Code Synthesis Browser friendly
version
Back to Contents
Times provides automatic generation of the executable code from the system description. Currently the only supported target is Hitachi H8 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 was released under the old name. The pre-releases of brickOS, version 0.2.6.9 etc. are not supported).
Installing brickOS
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 website.

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 further instructions).

    • Download brickOS from legos.sourceforge.net.

  • On Windows:

    • Install the Cygwin environment from www.cygwin.com.

    • Download and install a pre-built cross compiler from Hitachi (the H8 GNU Tool). Note that brickOS 0.2.6 does not work with GCC from the 3.x series.

    • Download brickOS from legos.sourceforge.net.

Configuring brickOS:
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)
Configuring Times:
  • Make note of the directory where you have installed brickOS.

  • Open the Configuration window via menu Options->Configuration...

  • In the tab Code generator enter the name of the directory where brickOS is installed into the field brickOS directory.

See the Configuration chapter to learn more about available options.

Generating Code
To generate code from a system description use the menu command Run->Code synthesis. 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?

  • Makefile

  • brickos_kernel.c
    The kernel code interpreting an automata structure.

  • brickos_system.h
    Type and macros definitions.

  • brickos_interface.h
    Kernel API definition.

  • brickos_hooks.h
    Definition of hooks executed at events in the kernel (used by the logging module).

  • basename_init.c
    A stub for user hardware initialization code.

  • basename_init.h
    API definition of the initialization code.

  • basename_global.h
    An empty file where the shared global variables are be defined, if they are not defined in the model.

  • basename.h
    Generated definitions of the constants used in the code (e.g. number of transitions).

  • basename.c
    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 Run->Compile. To compile, using a separate shell, go to the output directory and enter execute the following command:
bash$ make
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 Run button on a brick.

Logging
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.
See also:

Editor | Configuration


Home | Download | Screenshots | Documentation | Case studies | Publications | DARTS team | Contact us

(C) 2007 DARTS, IT Dept, CS, Uppsala University, Sweden