9

Does exist a virtual GPIO driver to be used for a programming needs?

I have to develop a software on my Linux PC, and then try it on some embedded systems with physical GPIOs (C.H.I.P., OpenWRT, and so on...)?

Thank you!

3 Answers 3

12

The solution exists and is available since kernel 4.10 as GPIO mockup driver.

Some references for you:

Sign up to request clarification or add additional context in comments.

Comments

1

At time of writing the current in-kernel option is the gpio-sim, which obsoletes the gpio-mockup module as of Linux 5.17.

gpio-sim supports creating, controlling and destroying gpiochips on the fly. The created gpiochips appear identical to those created by hardware drivers, and so can be used for testing userspace code without requiring any actual hardware. Testing can be performed in purely virtual environments.

There are several libraries available to drive gpio-sims, or to provide examples of how to drive it yourself via configfs and sysfs:

Comments

0

You can try this https://github.com/maquefel/virtual_gpio_basic also.

In such case gpios are indistinguishable from real hardware.

Also latest qemu versions have gpio support with interrupts.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.