Why POSIX for embedded systems?
A common problem with realtime application development is that each realtime OS tends to come with its own proprietary API. In the absence of industry standards, this isn't an unusual state for a competitive marketplace to evolve into, since surveys of the realtime marketplace regularly show heavy use of in-house proprietary operating systems. POSIX represents a chance to unify this marketplace.
Among the many POSIX standards, those of most interest to embedded systems developers are:
- 1003.1—defines the API for process management, device I/O, filesystem I/O, and basic IPC. This encompasses what might be described as the base functionality of a UNIX OS, serving as a useful standard for many applications. From a C-language programming perspective, ANSI X3J11 C is assumed as a starting point, and then the various aspects of managing processes, files, and tty devices are detailed beyond what ANSI C specifies.
- Realtime Extensions—defines a set of realtime extensions to the base 1003.1 standard. These extensions consist of semaphores, prioritized process scheduling, realtime extensions to signals, high-resolution timer control, enhanced IPC primitives, synchronous and asynchronous I/O, and a recommendation for realtime contiguous file support.
- Threads—further extends the POSIX environment to include the creation and management of multiple threads of execution within a given address space.
- Additional Realtime Extensions—defines further extensions to the realtime standard.
- Application Environment Profiles—defines several AEPs (Realtime AEP, Embedded Systems AEP, etc.) of the POSIX environment to suit different embedded capability sets. These profiles represent embedded OSs with/without filesystems and other capabilities.
Apart from any bandwagon
motive for adopting
industry standards, there are several specific advantages to
applying the POSIX standard to the embedded realtime marketplace:
- Multiple OS sources
- Hardware manufacturers are loath to choose a single-sourced
hardware component because of the risks implied if that source discontinues production.
For the same reason, manufacturers shouldn't be tied to a single-sourced,
proprietary OS simply because their application source code isn't portable to other OSs.
By building applications to the POSIX standards, developers can use OSs from multiple vendors. Application source code can be readily ported from platform to platform and from OS to OS, provided that developers avoid using OS-specific extensions.
- Portability of development staff
- Using a common API for embedded development, programmers experienced with one realtime OS can directly apply their skill sets to other projects involving other processors and operating systems. Also, programmers with UNIX or POSIX experience can easily work on embedded realtime systems, since the nonrealtime portion of the realtime OS's API is familiar territory.
- Development environment
- Even in a cross-hosted development environment, the API remains essentially the same as on the embedded system. Regardless of the particular host (Linux, Windows,...) or the target (x86, ARM), the programmer doesn't need to worry about platform-specific endian, alignment, or I/O issues.