I have been able to reproduce the functionality of fastDigitalWrite() in a C program cross-compiled for the Galileo and executed in Linux.
See the attached sample program. Clearly, this is just a quick and dirty test, but it reproduces (and improves just a touch on) the IO rates discussed in Re: I/O speeds?
What I haven't really attempted (because I was hoping somebody else could provide the formulation) is including headers and linking with libraries in /arduino-ide-install-dir/hardware/arduino/x86.
Thus, I can reformulate my original question as:
Is there a formula (includes, #defines, library paths/names, etc.) for leveraging in cross-compiled C programs the existing libraries meant to be used with Arduino sketches ?
togglemap.c.zip 1.1 K
for the Galileo Gen 1, take a look at wiring_digital.c and fast_gpio* files under the ../hardware/arduino/x86/cores/arduino folder
also look at varaint.h ../hardware/arduino/x86/arduino/x86/variants/galileo_fab_d where some of the macros are defined
Yes, thanks. I did exactly what you suggested when I wrote the program to benchmark pin 2/3 IO.
My original question was about mixing and matching the headers and libraries under /hardware/arduino/x86/arduino and (in my case) under /opt/arduino/hardware/tools/sysroots/i586-poky-linux-uclibc.
I think I have my answer. There is no systematic way of doing such at this point.