Skip to content

Using the BBB on Linux

Franz Miltz edited this page Apr 12, 2022 · 3 revisions

This guide aims to give a rough but complete overview over the steps required to compile and run software on any Beaglebone Black (BBB) using a Linux x86-64 computer. Similar steps may apply to other platforms, in particular WSL.

Pre-requisities

The following are required:

  • BBB
  • USB A to micro USB cable
  • micro SD card
  • a Linux x86-64 device ("the laptop"), connected to the internet, with a USB A port

Cross-compiling

  1. Download a Debian image for the BBB, e.g. from here. Note that we intend to flash the image onto the BBB so make sure you download an appropriate image!
  2. Flash the image onto the BBB, e.g. by following these instructions.
  3. Make sure you can SSH into the BBB.
  4. On the BBB, verify the GLIBC version, e.g. by running
    $ sudo /lib/arm-linux-gnueabihf/libc.so.6
    
    For the AM3358 Debian 10.3 2020-04-06 4GB eMMC IoT Flasher image this is Debian GLIBC 2.28.
  5. Obtain a toolchain to cross-compile to the BBB, e.g. by downloading it from here. Make sure the GLIBC version matches what you found on the BBB in step 4.
  6. On the laptop, compile the desired binary using the newly obtained compiler. This could look as follows:
    cd hyped-2022
    mkdir build
    cd build
    cmake .. -DCROSS=OFF -DPEDANTIC=OFF -DFORMAT=OFF -DCMAKE_CXX_COMPILER=/home/miltfra/hyped/hyped-2022/armv7-eabihf--glibc--bleeding-edge-2018.11-1/bin/arm-linux-g++ 
    make debugger -j
    
    Note that when using the -DCMAKE_CXX_COMPILER flag one has to specify an absolute path to the compiler, not a relative one. Where the toolchain resides in your file system does not matter.
  7. Try and copy the binary onto the BBB to see whether you can run it at all.
  8. Now you may configure the BBB to meet your requirements (SPI, CAN, ...), e.g. by using the 2021 Wiki.

Compiling on the BBB

While cross-compilation is preferred, compiling the software directly on the BBB is possible.

  1. Follow steps 1-3 above.
  2. Configure an internet connection on the BBB, e.g. by following this guide.
  3. Update and upgrade all packages on the BBB.
  4. Install CMake.
  5. Clone the hyped repository and build the binary. Flags to consider are -DCROSS=ON, -DPEDANTIC=OFF, -DFORMAT=OFF, and possibly others. You may have to play around with this.
  6. Have a cup of tea. This will take some time.
  7. Run the binary as you normally would. If you run into compiler or linker errors it's likely because some includes are missing. Common offenders are the atomic and string headers.
  8. Similar to step 8 above, you may have to configure the BBB to do exactly what you want it to.
Clone this wiki locally