Freitag, 19. Dezember 2014

Sharing OS X Internet Connection over USB to BeagleBone Black





After you have connected the BeagleBone Black to an iMac via USB cable, and installed the drivers from the BBB on OS X, a new network connection is created which provides tcp/ip to the BBB under the default address 192.168.7.2 over the USB cable.


It sounds natural to extend this connection to the internet. First steps are found again with Derek Molloy, who explains how set a gateway and nameserver in order to have internet access on the BBB, here my version:


#!/bin/sh
echo "Setup script for getting access to the internet via USB - Derek Molloy"
echo "Setting up the default gateway"
/sbin/route add default gw 192.168.7.1

echo "Updating the nameserver entry"
echo "nameserver 213.196.149.11" >> /etc/resolv.conf

echo "Setting the time using the Swiss ntp pool"
ntpdate -b -s -u 0.ch.pool.ntp.org

To extend the BBB network to the internet, OS X provides Internet Sharing. Unfortunately, sharing the internet to the BBB connection does not lead to a working internet connection. The reason is that by default OS X creates the internet sharing to the local network 192.168.2.x, and therefore cannot reach the BBB on 192.168.7.2. There are descriptions how to change this on OS X Lion, but Yosemite seems to work differently, and I haven't found yet a way to change the OS X Internet Sharing default network.


One solution is to change the pf.conf packet filter on the OS X host to provide additional NAT functionality. I didn't like to tamper with the pf settings, so I looked for another solution.


The solution was to change the default IP address the BBB gives itself on the USB interface on startup to match the OS X internet sharing default. This is described nicely by Eric Wong. Of course, the above script must be adapted as well regarding the default gateway.


Now the BBB starts up on 192.168.2.2, and has internet connection from the beginning.



Montag, 15. Dezember 2014

BeagleBone Black Debian Toolchain on OSX



While BeagleBone Gurus like Derek Molloy usually run their IDE in a Linux Virtual Box, this solution proved too slow on my early 2008 iMac. So next thing was to look for a toolchain for Eclipse on OS X to compile towards the Linux Debian on the BeagleBone Black.

First finding was the Carlson-Minot toolchain, which worked for a C hello world application. Going to C++, the need for a hard float toolchain turned up. This is due to the Debian distribution provided with the BeagleBone, which requires hard floats, promising execution speed. So I followed this excellent blog entry by Anders Knelson, which resulted in a working C++ hello world application.

Anders is using a toolchain provided by William Markezana, and my Eclipse project is now set up like this:




An Eclipse run configuration is set up so that the executable is automatically copied to the BeagleBone and executed there. This is done by using Target Management RSE (Remote Systems Environment), see installation and setup at Derek Molloy, and then creating an Eclipse C/C++ Remote Application run configuration:


So everything is prepared to delve into more sophisticated applications.