Porting Embedded Rapid Prototyper Run-Time Libraries : Structure of the Code : The Architecture of the Generated Code

The Architecture of the Generated Code

The ERP generates fully functional code, based on the state charts and activity charts in the Rational Statemate model. The generated modules are partitioned according to a user-specified compilation profile. This allows code to be generated from a sub-section of the complete Rational Statemate model.

Each generated module reflects the state, timing, and scheduling logic of the model that is included in the compilation profile. This allows a suitable set of components to be built that reflect the system logic (behavior). All the logic is written in K&R or ANSI C, with calls to services from an underlying runtime module.

The generated code uses runtime modules for timing, scheduling and communication with analysis tools like GBA, Panels, Trace and user-defined drivers (I/O mapping). Requests are generated to the timing module for time-outs and scheduled actions, to the scheduler module to control user written tasks that are connected to basic activities or auxiliary tasks that serve to supply interface with I/O card drivers, GBA, Trace and Panel servers. In addition, the data elements can be double buffered, so data assignments are synchronized, to prevent racing conditions among the ‘concurrent’ behavioral components. Note that the envelopes of the user written tasks perform direct assignment, so the assignments inside of these tasks are not synchronized.

All the runtime modules are actually a set of compiled libraries. The libraries are supplied in source code form so they can be modified and reused in other environments. The runtime modules actually provide an interface between the generated behavioral logic and the underlying operating system.

Porting the generated code to a particular Operating System (OS) environment involves tailoring the runtime libraries to use the specific services provided by the target OS/Real-time kernel. In case where no underlying system exists, the run time library should provide an alternative functionality.

Note that tailoring the runtime libraries is a one-time effort. Once done, the generated components can be compiled and linked without being modified at all.