Dr. Hartmut Schorrig, www.vishia.org
1. Approach
Portable programming with the emC needs adaption of the operation system and the hardware.
-
If specific functions with a dedicated operation system are necessary (for example setup of OS features), it is not a part of emC "multi platform" but for specific programming on a target platform.
-
Most of operation system functions are sometimes similar. But:
-
The adaption to a specific operation system should not be done using a common standard, there is no common standard, but with deterministic adaptions maybe depending of the application requirements, as generally rule. For example POSIX is an (old and proven) standard for UNIX-like systems. Windows does its own things. Details seems to be compatible, but they aren’t really.
-
The emC offers some headers for OS access (the Abstraction Layer) which may be sufficient for most requests. It can be implemented well for the Operations systems (done for Windows, partially for Linux in emC), because all operation systems offers proper Application Interfaces.
-
Adequate it is for Hardware access:
-
The application and also parts of them (for unit tests) should be written independent from the hardware.
-
A (often application system specific) Hardware Abstraction Layer defines access to the hardware.
-
For the test platform on PC the Hardware Adaption Layer may use emulations of the hardware in software.
-
For platform A it is written, for platform B it should be able to adapt. Etc.
-
The Hardware Implementation Layer may given by the platform itself, as library or system headers. It should be used if sensible.
2. Example serial communication
This is adapted with one concept to embedded controller and OS-Windows. See Serial_HAL.html.