Emulating Raspberry Pi GPIO on Linux Mint PC lazarus / 32-Linux ---------------------------------------------------------------------- BosseB · 2016-02-29 07:58 I am working on a data acquisition controller targeting Raspberry Pi2 hardware. I have installed FPC/Lazarus on a Pi2 unit so I can program and build/debug there, but the platform is rather limited in performance so I have followed advice to move to a Linux based development system instead. So now I have duplicated the installation on a Linux Mint 17.3 MATE virtual computer on my Win7X64 laptop using VMWare Workstation 12PRO. What I would like to discuss is how I could handle the hardware differences between a Pi2 (ARM7) and a virtual PC environment. Specifically I need to use the GPIO on the RPi2 in order to switch on/off power and similar things on the actual target hardware. So I have tested this on the RPi2 platform and the GPIO manipulations work just fine from Lazarus using the PiGpio unit (after I patched it for the register address differences between the original RPI and the RPi2). Now I would like to have some way to make FPC/Lazarus use the GPIO on the physical system if running on a Pi2 hardware but otherwise redirect to some kind of GPIO emulator if not on an RPi2. Has this been done before and if so how was it accomplished? For development/test/debug I will not need physical signals, but I need to make sure that the code will compile on an RPi2 platform so it will actually use the GPIO. During development it is sufficient if I can see the states of the GPIO outputs and toggle the inputs, possibly in some simulation window or such. ---------------------------------------------------------------------- Thaddy · 2016-02-29 09:38 It should not be very difficult to write a Daemon that simulates the GPIO, but rather than ask here ask on  the Raspberry Pi forum if something like that is already available (in any language). I would be interested in writing one, but I am notoriously lazy in doing it from scratch. ---------------------------------------------------------------------- BosseB · 2016-02-29 10:07 I did post a question there but probably in a too obscure place... (Programming/Other) Somehow it seems like the GPIO simulator/emulator is only needed if one programs on a different platform than the RPi and therefore the RPi forums might not be such a good place. They seem not to know much about Pascal there for example. OTOH in other forums they probably know nothing about the Raspberry Pi instead.... ---------------------------------------------------------------------- Thaddy · 2016-02-29 10:16 It should be in "Bare metal". ---------------------------------------------------------------------- BosseB · 2016-02-29 10:38 Thanks, I asked the admins to move the thread.