As PikeOS is based on a microkernel architecture, the implementation of networking applications is very flexible. Generally spoken, the developer has the choice to implement the entire low-level hardware access, TCP/IP stack and application within one single user space partition. However, this is not recommended for several reasons.
Firstly, such a software architecture is not extendable as only one partition would be able to access the same Ethernet port at the same time. Secondly, the solution would not be portable as an exchange of the Ethernet hardware would require adjustments to the user space application itself to replace the Ethernet driver. And thirdly, the Ethernet port is not available for tracing and debugging purposes during the development phase.
The recommended way to setup networking within a PikeOS system consists of splitting the networking components into three parts:
- Link level Ethernet driver
- (TCP/IP) network stack
The low-level Ethernet driver implements the direct hardware access and is the only component to be replaced when the hardware would change. In terms of code size, this part is the smallest. In addition, the driver virtualizes the Ethernet port and provides a configurable number of channels to guest operating systems. The software interface of each channel can be realized as a PikeOS file provider or via PikeOS queuing ports. The driver itself typically sits within a special user space partition called service partition. It is also possible to implement the Ethernet driver within the kernel space in case the requirements on latency or performance are stricter.
Figure 2 shows an example PikeOS system that follows the recommended scheme. This setup consists of 4 partitions. The low level Ethernet driver resides in the service partition and offers one virtualized Ethernet channel to the development tool agents that provide debugging and tracing services. You can find a more in-deep discussion on that topic here: Multiplexing Application Input/Output
The Linux partition consists of two major parts: the Linux kernel and the (network) applications. The kernel contains the TCP/IP stack and utilizes the low-level link level Ethernet driver via the PikeOS file system. The network applications are accessing the TCP/IP stack via the standard BSD socket API.
The remaining two partitions are using a lightweight open source TCP/IP stack called lwIP. Here, the application is directly linked against this network stack and utilizes a simplified API. The BSD socket is available optionally as well. Since this is a lightweight implementation, certain restrictions apply. Please refer to the LwIP Article (wikipedia) for more details.
As pictured, such an architecture allows sharing a single Ethernet port between 3 different partition applications each having their own IP address, as well as between the development tool agents (debugging, tracing, monitoring).
Note: lwIP is not intended to be used within Safety-relevant applications. That is because this network stack is not certifiable.
Please refer to Networking in Safety-critical Environments for a network solution that can be used in projects that have high Safety requirements
(even up to ISO 262626 ASIL D/ DO-178C DAL A).