GPIO/Analog programming for BeagleBone Black on Angstrom Linux, what compiler for cross development on Windows?

Imran Munshi picture Imran Munshi · Jan 2, 2014 · Viewed 9.8k times · Source

I'm working on a BeagleBone Black (BBB from now on) with its stock Angstrom Linux.

I'm able to do GPIO/Analog programming using JavaScript, but I want to do it in C/C++.

I know the sysfs thing and /dev/mem, I want to know how to configure the GPIO and analog pins.

I can write C/C++ code for GPIO/analog reading writing, but have no clue what to do for initialization.

One way is the Device Tree Overlay, but I don't want to go for two different things for one purpose, since I can understand that it can be done in C/C++ but how??

It'll be helpful if I could alongside get some example related to both sysfs and /dev/mem for configuring+r/w of gpio &/or analog pins of the BBB (on Angstrom Linux, if this matters)

Answer

jonasberg picture jonasberg · Jan 4, 2014

Derek Molloy has a great series of videos describing exactly how to do this, and more. His BeagleBone site has this address: http://derekmolloy.ie/beaglebone/

For C/C++ cross-development, the recommended path is to use Eclipse in Linux on your desktop computer. I personally run Ubuntu in VirtualBox under Windows. Derek Molloy describes this in full detail: http://derekmolloy.ie/beaglebone/setting-up-eclipse-on-the-beaglebone-for-c-development/

With the Beaglebone Black kernel (3.8), configuration can be done using Devicetree. It is shown in great detail in this video: http://derekmolloy.ie/beaglebone/beaglebone-gpio-programming-on-arm-embedded-linux/