The general setup of this example consists of a host device (running a software stack) connected to a device via SPI. For this demonstration, we chose the NXP i.MX 8 Plus EVK as the host device and a very simple temperature sensor as the SPI device. The goal is to read temperature values from the temperature sensor via SPI with an application running on the host device.
We are simulating the desired setup by conneting two simulators, one for the host device and one for the temperature sensor, using SimBricks. The two simulators are connected at the SPI interface and therefore they exchange data at the SPI level. To this end, both simulators implement a SimBricks adapter, which supports the SPI protocol.
For the NXP i.MX 8 Plus EVK host device we chose to use QEMU, which already provides a machine model for this board. The board provides SPI interfaces and we connect our SimBricks adapter to one of them. We are running a small Linux ARM image on it, since the board includes an ARM 64-bit processor. This allows us to run a small application, that uses the SPI device which is exposed under /dev in order to read temperature values from the temperature sensor.
The temperature sensor is a very simple simulation model that returns random temperature values in a given temperature range on every read. The model also includes the SimBricks adapter, which allows it to be connected to the host device.
The demo shows how we conncet the NXP i.MX 8 Plus EVK board (simulated with QEMU) with the temperature sensor, define what should be executed on the host device, and finally executing the simulation. The Linux image includes our application "read_temperature", which opens and reads 10 temperature values from the given SPI device.