How do I run GPIO tests natively?


I’m writing a bus driver that’s based on GPIO bit-banging. To test this thing I need to connect up two or three boards and talk to all of them. This works, but tends to wear out their Flash memory.

So I’m investigating how to run most tests natively. Has anybody already done this? Simulating GPIO pin states by way of data from/to a Unix socket seems obvious enough that there might be some code for it out there somewhere …?

If you are on e.g. a Raspberry Pi you can also use it’s GPIOs on native with the --gpio command line option.

If you want to mock it all, gpio_mock.c is probably a good starting point

You don’t need a Pi for that, just load the gpio_mockup kernel module, use gpio_linux in Riot, and play with the GIPO states from the other side. Easy as pie.

The problem is that most distributions don’t build that, for no good reason I can think of :rage: and using my own kernel is kindof difficult when I’m on a hosted CI system somewhere.

Adding an alternative GPIO driver for native shouldn’t be too hard with the gpio_linux and gpio_mock as templates. With an IPC mechanism of your choice … maybe the file system? (Then the wiring could be done with symlinks :slight_smile: ).