b /lib: Learn, Imagine, Build Beaglebone Black | /lib


Learn, Imagine, Build
Geoff Messier's Projects & Ideas

Beaglebone Black


Derek Molloy’s site and book with companion site are great resources. The book especially is well laid out and ranges from very basic introductory material to very specific and advanced concepts. That said, my version of the book is from 2015 and some of the items are now a bit dated, often topics related to the BBB linux OS. I’ve noted some of the differences in the sections below.

Development Environment

Setup Discussion

Since the BBB runs a full linux distro, it’s certainly possible to download compilers and develop code directly on the BBB. However, it’s also nice to be able to perform cross-compiled development on a PC since you can use fully featured development environments and version control.

My install is broadly based on Derek Molloy’s tutorial video which is somewhat dated. At time of writing, I installed on Ubuntu Bionic Beaver on my PC and didn’t need to do any of the sources.list updates. The whole install was done with the following commands:

sudo dpkg --add-architecture armhf
sudo apt-get update
sudo apt-get install crossbuild-essential-armhf

The hint Derek gives about being able to install cross-compiled libraries using the :armhf suffix is very useful. For example

sudo apt-get install libicu-dev:armhf

Rather than downloading eclipse directly as suggested in the tutorial video, I installed the version on offer from the Ubuntu software install tool. This ensures the eclipse version is compatible with whatever version of Java your machine is running. The only extra step was to install C++ GCC Cross Compile functionality within eclipse which wasn’t loaded by default. After that, creating the Hello World cross-compiler project works exactly as described in the tutorial video.

To enable the RSA, I had to install both Remote Systems User Actions and Remote Systems End-System Runtime within eclipse. Also, the terminal connection is now part of the TM Terminal package that needs to be installed and run separately from RSA. I might skip that next time since it’s easier to just run an ssh window outside of eclipse. The manual copying within RSA is also not that much more convenient than regular sftp but the post-compile scp copy of the binary directly to the BBB described in the tutorial is very handy.

To get the on-target debugging working, I needed to install C/C++ Remote Launch. I didn’t have the BeagleBone connection displayed by default like in the tutorial video and instead needed to create a new SSH connection with the BBB IP address and username. The key copying for automatic authentication described in the tutorial works well here and no password is required.

New Project Creation Summary

Once things are all set up, here’s a summary of the steps to create a new project:

  1. If this is a new BBB, you’ll need to grant your PC password free access to it using ssh-keygen:
    • On your PC, type ssh-keygen and leave the password blank.
    • Run ssh-copy-id bbbusername@bbb.ip.add.ress.
    • Confirm you can ssh to the BBB without being queried for a password.
  2. Create a new project. Single name projects are best since that makes the executables easier to copy over. Select C++ Managed Build and then an empty Cross GCC project. Build Project should work straight away.

  3. In project properties, select Build Steps in C/C++ Build Settings and enter the following command to copy the executable over to the BBB once it’s compiled: scp <ExecutableName> <BbbUsername>@<BbbIpAddress>:<BbbHomeDir>/<BbbExecutableName>.

  4. Confirm that gdbserver and gdb-multiarch are installed on the BBB and your PC, respectively.

  5. In your project directory, create a file called .gdbinit that contains the line set architecture arm.

  6. Under Debug Configurations, create a new C/C++ Remote application:
    • Main tab: Create a new ssh connection to the BBB using public key authentication.
    • Main tab: Set the Remote Absolute File Path to the location of the executable on the BBB.
    • Under Debugger, browse for the specific .gdbinit file you created in the previous step and change the GDB debugger to /usr/bin/gdb-multiarch.

Hardware Version

It can be a bit tricky to determine which version of the BBB you have. The BBB eLinux page and the schematic are helpful.

Operating System

Images for the BBB can be downloaded from here and a description of how to burn the image onto an SD card and then flash the onboard BBB memory with the OS is here. Note: If you want to burn the eMMC onboard memory with the OS, don’t forget to download a “flasher” image rather than the regular ones meant to run natively off of the SD card.

Pin Configuration