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

9.9k views Asked by At

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)

2

There are 2 answers

0
Imran Munshi On

OK, so Linux is the only way? I've tried cross-compiling for other processors (bare-metal) using code::blocks, em::blocks & eclipse/ by using the respective cross-gcc toolchain for windows. Ex: arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) with Eclipse CDT was great and easy. Isn't there any toolchain that would let me cross-compile for BBB/Angstrom-Linux on my windows laptop. I tried the linaro toolchain but even that didn't work

Thanks for those links, the Device tree seems good way, I want to try /dev/mem also, it looks more straightforward and is similar to bare-metal C/C++ programming once mmap is done.

0
jonasberg On

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/