erika educational
overview
news
download
  what's required
  compiling and using
  gcc3 support
demos
wireless interface
Matlab support
people
related links

Preliminar Matlab support for E.R.I.K.A.



Riccardo Vestrini

Introduction

Matlab and Simulink provides an excellent environment to test and develop control application, with the use of Real-Time workshop you can now automatically generate ERIKA code from your Simulink model.

Installation

You have to buy a Matlab license with at least Simulink and Real-time workshop, better with Embedded Coder toolbox. You will also need Gcc 3 support.

Configuration

After having installed Matlab you must add $ERIKABASE/toolbox directory to Matlab search path (use addpath command) and open $ERIKABASE/toolbox/ErikaEducational.mdl Simulink library; these blocks can be used to build a model of an Erika application.
You must select ErikaEducational.tlc as Realtime Workshop target file and ErikaEducational.tmf as target makefile, if you want you can open skeleton.mdl model file in $ERIKABASE/tests/toolbox which is an almost empty model suitable to start a new application.
Various configuration options can be found in Realtime Workshop options.

Use

You may use Simulink blocks of ErikaEducational.mdl file to build your model, when it will simulates correctly choose Generate code from Realtime Workshop options; you will obtain the complete application code inside current directory, it will also be automatically compiled and built and you will be able to directly download it.

Multitasking

A common model will be built as a single-thread application and will always work, if you partition your model into atomic subsystems each subsystem will run as a separate task.

Documentation

Some documentation and slides can be found here.

Current (many) limitations

Current blockset does not implement every possible ERIKA code, so you will be able only to use PWM Motors, light sensors, lcd and buttons; you can manually add code to your model to support other devices, look at Real-time Workshop documentation. Suspend block do not currently work because of limitations in Gcc 3 support.
Althought you can generate a multitasking model no code will be generated to handle safe trasfer of data between different tasks (for example mutexes), so you may experience runtime errors; you may manually add mutex code (which is an hard work) or modify ERIKA tlc code to automatically add mutexes (which is an harder work but is the right thing to do).
After having successfully compiled and built the model, make_rtw complains saying there were errors, do not give it a clue
Developing has been done with Linux, so C s-functions for blocks have been compiled only for Linux, you may easily recompile them in Windows using mex command with every .c file in $ERIKABASE/toolbox directory.

Work in progress

Since this toolbox is work in progress there is little documentation, I know it but if you are interested in use or developement you can contact me and I will explain if I can.