How to simulate embedded-board serial on Zephyr-RTOS system when compiled for "emulation" on Linux host

120 Views Asked by At

I have a embedded system build with Zephyr-RTOS which uses a serial port as the main interface to the world. The "world" in this case includes cloud servers (or locally hosted test instances thereof), some intermediate proxy's with EC key-pairs running around, etc. The embedded device has non-trivial business logic.

Virtual development, integration testing & CI are important requirements. Before porting the embedded project to Zephyr-RTOS, the practice had been to replace all embedded system external I/O (eg serial-driver I/O) with TCP based approximations so that a cousin of the "embedded" system could be compiled & run under X-Code, or on a Linux docker image, for business logic development & testing, and for CI.

Is there a better way in Zephyr to "port/emulate/handle" a embedded's physical serial port as a "channel" built for a Linux host for testing. I would love something that would give me a pair of virtual serial ports connected back-to-back like a BSD pipe. This would allow me to specify the Linux serial port in the "device tree" and the Linux test drivers to connect to the paired "virtual serial port" for communications. A big bonus would be test driver setup could connect to the physical hardware for testing by only changing the virtual serial port to a physical one.

Long question, but while I know what I what to accomplish, I don't know what this facility's name might be, or tools commonly used, so I don't know how to search for it. Suggestions greatly appreciated!

1

There are 1 best solutions below

0
jwielink On

Typically QEMU is used for simulation within the Zephyr project, which you can also use to simulate serial ports.

Perhaps this will help: https://docs.zephyrproject.org/latest/develop/debug/index.html