3

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)

Imran Munshi
  • 53
  • 1
  • 7
  • I suggest you retag this with beagleboneblack so your intended audience will see your question. – Ross Jan 02 '14 at 21:29
  • I tried the Linaro toolchain (arm-linux-gnueabihf-) but it never worked, can anyone suggest some other toolchain – Imran Munshi Jan 03 '14 at 12:35

2 Answers2

3

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/

jonasberg
  • 1,835
  • 2
  • 14
  • 14
0

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.

Imran Munshi
  • 53
  • 1
  • 7