A board level "hello world"

This section describes how quick start with D on the BBB.

Get an official BBB Debian image onto the Micro SD card

get latest official BBB debian image with GUI (LXQT) or without GUI (IoT), here with

wget https://debian.beagleboard.org/images/bone-debian-9.1-lxqt-armhf-2017-08-24-4gb.img.xz

verify sha256sum

sha256sum bone-debian-9.1-lxqt-armhf-2017-08-24-4gb.img.xz

install tool to unpack .img.xz to .img

sudo apt-get install xz-utils

plug the sd card (sd card adapter with the micro sd card) into the sd card slot and find the device

ls /dev/mmc*

... should display something like

/dev/mmcblk0  /dev/mmcblk0p1

change to root

sudo su

copy the image onto the micro sd card

xz -cd bone-debian-9.1-lxqt-armhf-2017-08-24-4gb.img.xz > /dev/mmcblk0

install tool to reload partition table

sudo apt-get install parted

reload the partition table on the micro sd card

partprobe /dev/mmcblk0

verify that a partition exists on the micro sd card

ls -al /dev/mmcblk0*

... should show something like

brw-rw---- 1 root disk 179, 0 Aug 31 18:07 /dev/mmcblk0
brw-rw---- 1 root disk 179, 1 Aug 31 18:02 /dev/mmcblk0p1

create mount directory for the BBB image

mkdir /media/bbb

mount the image and verify the content

mount /dev/mmcblk0p1 /media/bbb
ll

... should show something like

drwxr-xr-x 21 root root  4096 Aug 24 21:20 ./
drwxr-xr-x  4 root root  4096 Aug 31 18:14 ../
-rw-r--r--  1 root root  1359 Aug 24 21:42 bbb-uEnv.txt
drwxr-xr-x  2 root root  4096 Aug 24 21:00 bin/
drwxr-xr-x  4 root root  4096 Aug 24 21:42 boot/
(etc.)

unmount the micro sd card

umount -l /dev/mmcblk0p1

BeagleBoard website - latest images

armhf.com - Getting Started with an Ubuntu or Debian .img.xz File

Hardware setup

connect BBB connector "USB" via microUSB-to-USB cable to a powered USB plug

connect a keyboard and a mouse to an USB port

connect the USB port to the BBB connector "USB HOST"

connect connector "HDMI" via microHDMI-to-HDMI cable to a screen

put the microSD card into BBB connector "microSD Card"

poweron

(no login required, default username@hostname: debian@beaglebone with password temppwd)

BeagleBone website - Getting started

Basic configuration

verify the network connection (eethernet cable connected to router)

ping google.com

open "QTerminal"

update package listings

sudo apt-get update

change keyboard layout (requires sudo reboot)

sudo dpkg-reconfigure keyboard-configuration

Setup Cape Manager

figure out latest kernel

apt-cache search linux-image

install a kernel which includes the cape manager e.g. (requires sudo reboot)

sudo apt-get install linux-image-4.9.46-bone7

check if the cape manager option of the kernel is existing and enabled (should output something like CONFIG_BONE_CAPEMGR=y):

zcat /proc/config.gz | grep CONFIG_BONE_CAPEMGR

verify the cape manager directory

ls /sys/devices/platform/bone_capemgr/

... should list something like

baseboard  driver  driver_override  modalias  of_node  power  slots  subsystem  uevent

define environment variables for slots and pins, sudo nano ~./profile and insert

# BeagleBone Cape Manager Slots and Pins
export SLOTS=/sys/devices/platform/bone_capemgr/slots
export PINS=/sys/kernel/debug/pinctrl/44e10800.pinmux/pins

source and check printenv PINS and printenv SLOTS:

source ~/.profile

check if the cape manager works:

cat $SLOTS

...should output something like:

0: PF----  -1
1: PF----  -1
2: PF----  -1
3: PF----  -1

... and

sudo cat $PINS

...should output something like:

registered pins: 142
pin 0 (44e10800.0) 00000031 pinctrl-single
pin 1 (44e10804.0) 00000031 pinctrl-single
...

check if the device tree overlays (Robert C. Nelson's overlay repo) are already installed (they are usually preinstalled):

apt-cache policy bb-cape-overlays

...otherwise install it:

sudo apt update ; sudo apt install bb-cape-overlays

get a list of available device tree overlays:

cd /lib/firmware
ls BB-*

load a device tree overlay e.g. "BB-UART1" (BB-UART1-00A0.dtbo) pre-built into the cape manager:

sudo sh -c "echo 'BB-UART1' > $SLOTS"

check if the overlay has been applied:

cat $SLOTS

...should show something like:

0: PF----  -1
1: PF----  -1
2: PF----  -1
3: PF----  -1
4: P-O-L-   0 Override Board Name,00A0,Override Manuf,BB-UART1

remove a device tree overlay from the cape manager:

sudo sh -c "echo '-4' > $SLOTS"

thin-printer.com - Cape Manager is back baby!

(Exploring BeagleBone, p. 222)

Install D tools

install gdc:

sudo apt-get install gdc

check gdc version:

gdc --version

create hello.d...

nano hello.d

... with the following content:

import std.stdio;
void main()
{
   writeln("Hello D on BBB");
}

compile hello.d into the executable hello:

gdc hello.d -o hello

make the hello executable:

chmod +x hello

run hello:

./hello
Hello D on BBB

install the package manager into the host (e.g. Ubuntu):

sudo apt-get install dub

Debugging with a serial-to-USB cable

If something goes wrong consider to connect a serial-to-USB cable to the BBB (cable "GND" to BBB connector "J1" pin 1, cable "TX" to BBB connector "J1" pin 4, cable "RX" to BBB connector "J1" pin 5).

install minicom or an equivalent sudo apt-get install minicom

start the serial console sudo minicom -b 115200 -D /dev/ttyUSB0

results matching ""

    No results matching ""