4. Platform and Operating Systems (OS)
The EC-Master is implemented in portable C++ and contains no direct operating system call. Everything it requires from its environment, such as memory, threads, synchronization and time, is obtained through a small OS layer. Only this layer is platform dependent, all other sources are built unmodified on general purpose operating systems, on hard real-time kernels and on bare metal systems.
The OS layer interface is declared in the header file EcOs.h and covers the following services:
- Memory
Allocation as well as memory and string operations.
- Threads
Thread creation including priority and CPU affinity.
- Synchronization
Locks of several types and events.
- Time
Millisecond tick, sleep, host system time and high resolution counter.
- Module loading
Binding of the Real-time Ethernet Driver at runtime on platforms supporting dynamically loaded modules.
- Debug
Assertions and string formatting.
The platform specific implementation consists of EcOsPlatform.h and EcOs.cpp. Most functions are that easy that they can be implemented using simple C macros mapping to the native API. Implementations for all platforms listed below are part of a source code delivery, see MainDevice stack source code.
The OS layer is initialized with EC_T_OS_PARMS, either by calling OsInit() as done by the demo applications, or by EC_T_INIT_MASTER_PARMS::pOsParms when calling emInitMaster().
Note
Real-time behaviour is determined by the operating system and not by the MainDevice stack. The following chapters therefore describe for each platform the required tool chain settings, the recommended system configuration like real-time patches, scheduling and power management, and how to build and run the demo applications.
See also
Real-time Ethernet Driver (RtEth) for the network controllers supported on each platform.