4. Platform and Operating Systems (OS)
EC-Simulator and the EcSimulatorHilDemo example application support a wide range of operating systems and platforms. This chapter covers OS-specific setup, build, and compiler settings for each supported platform.
EC-Simulator 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 every supported platform.
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.
The OS layer is initialized with EC_T_OS_PARMS, either by calling OsInit() as done by the demo applications, or by EC_T_SIMULATOR_INIT_PARMS::pOsParms when calling esInitSimulator().
Note
Real-time behaviour is determined by the operating system and not by EC-Simulator.