Jumpnow Technologies

home code consulting contact

Working with the Gumstix Pi Compute Dev Board

27 Jul 2016

Gumstix makes a RPi Compute Module development board that can be used as an alternative to the Compute Module Development Kit from the Raspberry Pi foundation.

The Gumstix Pi Compute Development Board is just one example of a custom board that can be designed using Gepetto their online board design/layout tool.

I am using Yocto Project tools build the software stack for the CM, similar to the way I build systems for the other RPi boards.

Some instructions for that can be found here.

When it comes time to flash the image onto the RPi, you can use the RPi Foundation’s Compute Module Development Kit if you have one of those boards. Instructions for flashing using that board can be found here.

You cannot use the Gumstix Pi Dev Board the same way since it does not have the circuitry to put the CM into a mode where a host computer can directly access the flash as a block device.

Instead, Gumstix sells a Pi Fast Flash Board just for flashing the RPi CM. The Fast Flash Board does the equivalent of the J4 Jumper in the USB Slave position on the RPi Compute Module Dev board

The Gumstix Fast Flash Board is much more convenient when you are flashing multiple boards in succession.

Assuming then that you have built your custom Yocto image using the instructions linked earlier.

And also assuming you have already built the RaspberryPi tool rpiboot from the RPi Compute instructions.

Then steps to flash the RPi CM are as follows

Install the RPi CM on the Gumstix Pi Fast Flash Board

Connect a USB cable from the Pi Fast Flash Board to the Host computer. (I did not require separate power, the USB was enough).

Run the rpiboot utility, to bring up the CM as a mass storage device.

scott@fractal:~/rpi$ sudo rpiboot
Waiting for BCM2835 ...
Initialised device correctly
Found serial number 0
Found serial = 0: writing file /usr/share/rpiboot/usbbootcode.bin
Successful read 4 bytes
Waiting for BCM2835 ...
Initialised device correctly
Found serial number 1
Found serial = 1: writing file /usr/share/rpiboot/msd.elf
Successful read 4 bytes

When rpiboot exits, there should be a new device, /dev/sdc on my system.

scott@fractal:~/rpi1/build$ lsblk
sda      8:0    0 931.5G  0 disk
├─sda1   8:1    0  93.1G  0 part /
├─sda2   8:2    0 186.3G  0 part /home
├─sda3   8:3    0  29.8G  0 part [SWAP]
├─sda4   8:4    0   100G  0 part /oe4
├─sda5   8:5    0   100G  0 part /oe5
├─sda6   8:6    0   100G  0 part /oe6
├─sda7   8:7    0   100G  0 part /oe7
├─sda8   8:8    0   100G  0 part /oe8
└─sda9   8:9    0   100G  0 part /oe9
sdc      8:32   1   3.7G  0 disk
├─sdc1   8:33   1    64M  0 part
└─sdc2   8:34   1   3.6G  0 part

If this is the first time flashing your RPi CM the device probably won’t have any partitions.

This particular CM has already been partitioned, but there is no harm in re-partitioning.

To partition the RPi eMMC, there is a simple 2 partition script in meta-rpi/scripts.

scott@octo:~/rpi/meta-rpi/scripts$ sudo ./mk2parts.sh sdc

Then after making sure the environment variables are set correctly you can use the copy_ scripts from the meta-rpi repository to copy the bootloader and O/S.

The copy_ scripts use a temporary mount point /media/card on the workstation to use when copying files. Create it first if it does not already exist.

scott@fractal:~/rpi$ sudo mkdir -p /media/card

Then export some environment variables for the scripts. (See the instructions for an explanation.)

scott@fractal:~/rpi/meta-rpi/scripts$ export OETMP=/oe5/rpi/tmp-krogoth
scott@fractal:~/rpi/meta-rpi/scripts$ export MACHINE=raspberrypi

The boot partition

scott@fractal:~/rpi/meta-rpi/scripts$ ./copy_boot.sh sdc

OETMP: /oe5/rpi/tmp-krogoth
Formatting FAT partition on /dev/sdc1
mkfs.fat 3.0.28 (2015-05-16)
Mounting /dev/sdc1
Copying bootloader files
Creating overlay directory
Copying overlay dtbs
Renaming overlay dtbs to dtbos
Copying dtbs
Copying kernel
Unmounting /dev/sdc1

The root file system

scott@fractal:~/rpi/meta-rpi/scripts$ ./copy_rootfs.sh sdc console cm

OETMP: /oe5/rpi/tmp-krogoth
IMAGE: console

Formatting /dev/sdc2 as ext4
/dev/sdc2 contains a ext4 file system labelled 'ROOT'
        last mounted on / on Wed Dec 31 19:00:07 1969
Proceed anyway? (y,n) y
Mounting /dev/sdc2
Extracting console-image-raspberrypi.tar.xz to /media/card
Writing cm to /etc/hostname
Unmounting /dev/sdc2

If you want to use the camera (see below), now is a good time to copy the dt-blob.bin

scott@octo:~/rpi/meta-rpi/scripts$ sudo mount /dev/sdc1 /media/card
scott@octo:~/rpi/meta-rpi/scripts$ sudo cp ~/rpi/dt-blob.bin /media/card
scott@octo:~/rpi/meta-rpi/scripts$ sudo umount /dev/sdc1

You can now move the RPi CM to the Pi Dev Board and boot it.

One of the nice features of the Pi Dev Board is the built-in USB serial console.

Poky (Yocto Project Reference Distro) 2.1.1 cm /dev/ttyAMA0

cm login: root

root@cm:~# uname -a
Linux cm 4.4.15 #1 Wed Jul 27 04:19:42 EDT 2016 armv6l armv6l armv6l GNU/Linux

root@cm:~# lsblk
mmcblk0rpmb  179:96   0  512K  0 disk
mmcblk0boot0 179:32   0    4M  1 disk
mmcblk0boot1 179:64   0    4M  1 disk
mmcblk0      179:0    0  3.7G  0 disk
|-mmcblk0p1  179:1    0   64M  0 part
`-mmcblk0p2  179:2    0  3.6G  0 part /

root@cm:~# free
              total        used        free      shared  buff/cache   available
Mem:         445052       13196      389092         140       42764      404232
Swap:             0           0           0

The qt5-image has some demo apps you can use to test that Qt5 apps will run.

For example, plug in an HDMI display and run this

root@cm:~# qcolorcheck -platform linuxfb

The Gumstix Pi Dev Board has a camera connector that is more convenient to use with the official RPi camera modules because it does not require an extra adapter board or jumpers to connect power and I2C the way you need to do using the RPi compute board.

You do still need a dt-blob.bin to reconfigure some GPU pins for the camera. You can download the blob from the instructions here.

Modify config.txt so the GPU can use the camera.

root@cm:~# mkdir /mnt/fat
root@cm:~# mount /dev/mmcblk0p1 /mnt/fat
root@cm:~# echo 'start_x=1' >> /mnt/fat/config.txt
root@cm:~# echo 'gpu_mem=128' >> /mnt/fat/config.txt
root@cm:~# reboot

After that you can use the raspicam tools installed on either the of test images in meta-rpi.

root@cm:~# raspistill -t 300000 -hf -vf

I’m waiting now for the hopefully pin-compatible RPi CM3 that’s rumored to exist.