BBB programming language and OS question

Hello,

I had the BBB now a few days and works good, also the question on this forum I asked was solved, thanks for that.

But now I have a question about the programming language, witch one is better supported or can be used as best:

  • Python
  • JavaScript
  • Cloud9
  • Adafruit
  • Eclipse with C/C++ cross compiler
  • etc.

The following features must be possible:

  • GPIO
  • I2c
  • SPI
  • PWM
  • Analog
  • Write to tft screen

Can somebody give an advise or you own experince?

The second thing I like to know is witch OS is best for the Beaglebon BBB, on this moment I use the Angstrom, I also saw Ubuntu and Debian on several forums, but I would like to know witch on is best suited for the BBB.

I will use the BBB most of time as an embedded device, it will probely being placed in Robotic Arm or something like that.

Thanks already

C/C++ (and maybe assembly) would give you all the tools you need. Second choice would be javascript (node.js) but support still needs work. That’s just my opinion though.

Angstrom is working fine for me. Only minor issues, but I've read that
Ubuntu BBB users also have their own issues.
My problem is wifi setup, and that's a common issue with every linux
distribution so Angstrom is not the culprit here (the wifi dongle does
not even work in regular Ubuntu Desktop).
I'd say start with Angstrom, (make sure to follow the wiki for new
images) and if you really can't make your project work with Angstrom
then switch to Ubuntu or Debian.

Debian works fine. We have two BBB’s that have running Debian for about a month ( might be off slightly I haven’t been keeping track ). We’re not interrested in a GUI though, or even hdmi for that matter. I have not run into any problems with the OS at all, and the only problem I have experienced period was when trying to use capmgr to unload the hdmi device tree over lay. while Debian was running. That is most likely my own fault, and once experienced, you just don’t do that :wink: Read, capemgr will fault, and kick you to normal user if you’re root, and possibly lock up the OS right after.

Anyway, I think OS is more a matter of taste. You could keep Angstrom on the eMMC, and have other MMC cards / sticks to boot Ubuntu, debian gentoo, Arch/Linux, and I think someone recently got slackware going as well. Not to mention I think someone may be running fedora too, but not 100% positive.

Also, you can netboot, or netroot … . the possibilities are nearly endless.

I agree with this. Linux exposes its kernel interfaces via files in the file system. Basic C calls to open these files and read/write them is really all it takes to perform a variety of user-to-kernel interfacing tasks. Other languages and libraries to interface with the hardware of the system are all convenience wrappers to the system library calls that make the kernel system calls. Now, that being said, it may be quicker for someone to develop using Python or Javascript, depending on personal preference and skill level. People have taken the time to write libraries in these languages to assist new developers, so it makes sense to make the most of them if you feel that is where your skills are best used.

One thing that I would encourage any BBB user to try is to build your own kernel and bootloader and install them into your system. Once you break free of the pre-made kernel that is supplied with your distro of choice, you’ll have a bit more freedom with your BBB hardware. Plus, you can apply patches as need to work around quirks or bugs as the patches are made available. Understanding the actual changes that patches make, as well developing any device driver that you might want to try, rely on C knowledge. But, you don’t have to even be able to write a single line of C code to build your kernel. It will allow you to bump up the latest and greatest kernel without waiting for your next distro kernel update. It also avoids the problem of having your distro “break everything” when it updates.

As a base distro on my BBB, I use Ubuntu. The reason I chose this is so that I could do a quick apt-get for the build-essentials and have an on-board development toolchain in place quickly and easily. But, I don’t use X on my BBB, nor do I use any of the utilities to set up wifi and the like. I use the old sys-admin approach and edit the files myself. I concentrate on building minimal systems that run on the framebuffer, so my preferences most likely won’t match those of X users who might require more bells and whistles to feel at home. In my “release” configuration, I make the sole application on the system (BeagleSNES) the init process on the command line argument to the kernel. This skips systemd/init, so most aspects of my system are not even turned on. But it boots quite quickly, which is one of my goals. But you wouldn’t use something like this for general purpose computing.

As a whole, I think that Ubuntu is a good choice for a beginner. You can apt-get anything under the sun, and it all appears to work well for me. But, I replaced the Ubuntu-supplied kernel with my own kernel first thing, so I honestly don’t know how “good” the stock kernel is from release to release.

I this moment the orignal Angstrom distrubtion is still on the BBB, I didn’t know it was possible to boot from the SD card as well, this could be an idea to explore some OS.

The main feature for the OS must be that the peripherals can be acces and that I can for example send an bitmap to a LCD screen.

At this moment my knowledge of JavaScript and Python is not very good, C is no problem, but for the use of support of community’s for all, was this the question I did asked, witch programm language would be more common, so it would be easier to discuss over it and has more support

Here is one suck option: http://eewiki.net/display/linuxonarm/BeagleBone+Black Robert C Nelson also has other information on building / installing Ubuntu, and possibly more distros ( haven’t looked closely im perfectly happy with Debian ). But on IRC someone early on claimed to have gentoo running, and just last night someone came on happy about running slackware ( finally ). So yeah it seems your options are fairly wide open, but be prepared to learn, if you do not already know how it is done.

Learning is most of the fun IMHO though.

err, bad typo there “one such option” is what I meant to type.

Thank you William for the information, that looks very good.

I went around the loop trying eclipse with C/C++ running in Ubuntu 13.04 to cross compile and debug on Angstrom and whilst this worked, the overall experience wasn’t good and I quickly ran into problems. In my project I need to be able to talk to the mySQL server I have running on the beagleBone. This created a problem since the library for the mysql client would have to be native to the ARM and I couldn’t use this on my x86 based development system.

In the end I installed the openJDK and set-up java on Angstrom. This works far better for me, I was able to run eclipse Juno on my dev. system which is Windows 7 and this performed much better than running Ubuntu in a Virtual machine. I am able to build and debug from the Windows dev.system, the remote tools download automatically and it just works really well. I would recommend using Java and if you need to talk to I/O then write a simple JNI in C to provide a native interface to the hardware.

openjdk is not included in the Angstrom package list, but you can download and install the packages from the link below:

Thanks Simon for you anwser, this is an good idea I will look into it. This sounds very good, i found something on: http://beaglebone.cameon.net/home/doing-java-development

With simple JNI it is possible to acces the I2C, SPI, GPIO, UART interfaces? And a bitmap write to an LCD how is that done?

With JNI you can do anything you want,JNI = Java Native Interface, it’s the glue between Java which is very portalable and the hardware. You write routines in for example C that you put into a library and then from your Java load the library and call the C routine.

I use JNI’s on PC104 platforms, so our main application is written in Java, but the low level stuff is written in C and can be accessed from Java.

Thanks Simons, I will search for examples of the JNI how to add it.

This JNI, must this also be written in the Eclipse IDE where you then develop also you Java app.

This sounds very good to use Java as development on a Windows PC. Now i’m using als Eclipse with C/C++ cross compiler in virtual machine with Ubuntu, this is instead slow.

The JNI could be written anywhere, I will probably write mind on the beaglebone itself, but I will use eclipse if I need to.

To include a reference to the library in your Java package simple add to the class that needs to reference the routines in the library:

static {
System.loadLibrary( "name of your libary here" );
}

Then declare prototypes for the routines you will be calling from the libray also in your class:

private native int nameOfFunction(String strParam, int intParam);

The keyword native tells java that the function is a prototype and exists in a JNI library, the function name and parameters are jus the same as any other valid Java function.

In the C library this routine would be defined as:

JNIEXPORT jint JNICALL Java_package_reference_nameOfFunction
(JNIEnv *env, jobject obj, jstring jni_strParam, jint intParam)

The text package refernece is replaced with your java package refernece, for example if your package is:
hello.world.com then you would use Java_hello_world_com_nameOfFunction

nameOfFunction is whatever you call your funciton…there are lots of references online for this.

Hope this helps.

Thanks Simon, this will help

All thanks for the reply’s more advises are offcourse welcome.

For the things for know I had some pionts concluded.
OS for the BBB:

  • Angstrom with java kernel on it
  • Debian on SD card

For the programming IDE

  • Java, so as Simon told in the post before, with JNI in C for interface to the I/O in eclipse on Windows 7, what for an Windows PC offcourse good is.
  • Eclipse C/C++ development on Ubuntu, with some minors.

JavaScript, BoneScript & Python is offcourse very usefull but the somethings did not worked correct for me and missed some addiontal features.