The open source lwIP TCP/IP stack has been natively integrated with the QP state-machine frameworks. The newly released QP-lwIP integration example code available for download from www.state-machine.com/lwip provides all you need to develop professional TCP/IP applications with lwIP, including embedded code and host-based utilities.
The example code accompanying the extensive Application Note (see http://www.state-machine.com/lwip/AN_QP_and_lwIP.pdf) runs on the LM3S6965 Cortex-M3 MCU with integrated Ethernet MAC and PHY. But the QP-lwIP integration has been carefully designed for portability. All hardware-specific code is clearly separated in the Ethernet/lwIP device driver with the clean interface to the lwIP stack and the QP application.
The example code is based on the Dining Philosopher Problem (DPP) sample application described in Chapter 7 of PSiCC2. The goal is to demonstrate lwIP running alongside an existing real-time application, as opposed to lwIP running all by itself that fails to show how lwIP can share the CPU and cooperate with other software components. The QP-lwIP example code includes the following components:
QP-lwIP integration has been carefully designed for hard real-time control-type applications, in which the TCP/IP stack is used to monitor and configure the embedded device as well as to provide remote user interface (e.g., by means of a web browser). In particular, The lwIP stack, which is not reentrant, is strictly encapsulated inside a dedicated active object (lwIP-Manager), so interrupt locking is unnecessary, which is critical for low interrupt latency. Also, the Ethernet interrupt service routine (ISR) runs very fast without performing any lengthy copy operations. This means that hard-real-time processing can be done at the task level, especially when you use the preemptive QK kernel built into QP for executing your application. No external RTOS component is needed to achieve fully deterministic real-time response of active object tasks prioritized above the lwIP task.
The QP-lwIP integration uses exclusively the event-driven lwIP API. The heavyweight Berkeley-like socket API requiring a blocking RTOS and is not used, which results in much better performance of the lwIP stack and less memory consumption.
The lwIP source code has not been modified in any way to match the event-driven, run-to-completion execution model underlying QP. In other words, QP works with the standard lwIP code, as distributed from the lwIP homepage at http://savannah.nongnu.org/projects/lwip.