Architecture of Generated C Code : Code Libraries

Code Libraries

All of the runtime modules are actually a set of compiled libraries. These libraries can be reused for other projects because they are supplied in source code form which allows modifications based on project-specific requirements. The runtime modules actually provide an interface between the generated behavioral logic and the underlying Operating System (OS).

Porting the generated behavioral components to a particular environment primarily means tailoring the runtime library to use the specific services provided by the operating system. The target operating system can even be a Real-Time OS kernel. The runtime library can even be modified to provide an alternative functionality which does not normally exist in the target OS.

Note: Tailoring the runtime libraries is a usually one-time effort. Once completed, the generated components can be compiled and linked without being modified any further.

The detailed process of generating code for an embedded target system is discussed in detail later in this manual. However, there are many basic OS concepts that are more easily introduced using the more limited scope of an embedded operating system. The following figure shows the layered software components of the typical embedded application. The final executable image is normally built from some permanent pre-compiled modules (such as the RTOS kernel) and the generated/compiled modules that are dependent on the application.

The key components include the following:

The Scheduler Component is Optional - It is needed only if the user specifies that basic or external activities should be implemented as tasks or desires to link a graphic panel into the executable.
Callback Handler. - This component will be used only if the user selects to attach callback routines to behavioral logic components.
Memory Management - The runtime module’s timer, double-buffering and callback handlers utilize dynamic memory allocations. Under certain assumptions it is possible to tailor them to use only static allocation, if a memory management package is not available or memory resources are limited.
Multi-Threading (Tasking) Support - This support provides a mechanism for creating task threads and switching between them. This service is needed only if the user wishes to implement environment tasks or basic activities as tasks. This issue is discussed in greater detail in the Software Code Generator Interface Manual.