Development OveroDevelopment

peabody124 edited this page Mar 23, 2016 · 4 revisions
Clone this wiki locally

Setting up Overo Development

This page contains notes on getting an overo system up and running and using the spi_server to communicate with revo.

Do not try and use dash

Some ubuntu installations now use dash instead of bash by default. To see which you are using type

ls -l /bin/sh

If you are using dash some Makefiles will give cryptic errors. Update by running

sudo dpkg-reconfigure dash

and select no.

Build Environment Setup

The build environment for the TauLabs DataLogger is based on the Yocto embedded Linux build system.

Get the metadata for yocto and the taulabs-datalogger build

mkdir ~/yocto
cd ~/yocto
git clone git://git.yoctoproject.org/poky.git
cd poky   # make sure the clone is done inside the "poky" directory
git checkout dylan # this is the release that is compatible with our overlay
git clone git@github.com:TauLabs/meta-taulabs-datalogger.git
source ./oe-init-build-env

You should end up in ~/yocto/poky/build at this point.

Set up to build for the taulabs-datalogger platform:

vi conf/bblayers.conf
# Add the full path of the meta-taulabs-datalogger layer into the BBLAYERS list
# e.g     /home/ssheldon/yocto/poky/meta-taulabs-datalogger \
# Note the "\" at the end of the line for continuation

vi conf/local.conf
# Set MACHINE = "taulabs-datalogger" at the end of the MACHINE =? list
# Set PACKAGE_CLASSES = "package_deb"
# Change to EXTRA_IMAGE_FEATURES = "debug-tweaks tools-debug package-management"

OPTIONAL setup to speed up builds and have a shared cache for your downloads and your package build output:

vi conf/local.conf
# You may also want to set these variables:
#    BB_NUMBER_THREADS
#    PARALLEL_MAKE
# to speed things up for your machine.

# Shared caches
# Set DL_DIR ?= "/home/<userid>/yocto/downloads"
# Set SSTATE_DIR ?= "/home/<userid>/yocto/sstate-cache"

Prepare an SD card (one-time setup)

Plug your SD card into your PC. If there were any preexisting partitions or filesystems on the SD card, they will have automounted. You'll need to unmount them so we can wipe and repartition the SD card.

umount /dev/mmcblk0p1
umount /dev/mmcblk0p2
...

Wipe the existing partition table

sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1024 count=1024
sudo parted -s -a minimal /dev/mmcblk0 -- mklabel msdos
sudo parted -s -a minimal /dev/mmcblk0 -- mkpart primary fat32 128s 131071s
sudo parted -s -a minimal /dev/mmcblk0 -- set 1 boot on
sudo parted -s -a minimal /dev/mmcblk0 -- mkpart primary ext3 131072s -1s

Create filesystems on the newly partitioned disk

sudo mkfs.vfat -F 32 /dev/mmcblk0p1 -n boot
sudo mke2fs -j -L rootfs /dev/mmcblk0p2

IMPORTANT: Eject and reinsert the SD card

Build the images

Install prerequisites:

Debian/Ubuntu users will likely need to install at least these prerequisites. When you run bitbake in the next step, it will notify you of any additional missing components. You'll need to install those and re-run the bitbake command.

sudo apt-get install diffstat gawk chrpath texinfo

Start the build:

time bitbake core-image-minimal

This will take a long time the first time (1h40m+ isn't unusual) but will be much quicker on subsequent rebuilds. If you have errors (sometimes upstream yocto has issues) you can build through them with

time bitbake -k core-image-minimal

The -k option should only be used if you know what you're doing. It may not result in a working build.

Write the images to the SD card

Output images are in:

./tmp/deploy/images

Insert your SD card. The Boot Partition should be automatically mounted in /media/boot. The Root Filesystem partition should be automatically mounted in /media/rootfs.

Write Boot Partition: SPL, U-Boot and Linux Kernel

NOTE: MLO must be the very first thing copied to the boot partition.

cp ./tmp/deploy/images/MLO-taulabs-datalogger /media/boot/MLO
cp ./tmp/deploy/images/u-boot-taulabs-datalogger.img /media/boot/u-boot.img
cp ./tmp/deploy/images/uImage-taulabs-datalogger.bin /media/boot/uImage

Unmount the boot partition

umount /media/boot

Write Root Filesystem contents

NOTE: This will entirely overwrite the contents of the Root Filesystem on your SD card. Any files you have created or modified will be deleted and will not be recoverable.

sudo rm -rf /media/rootfs/*
sudo tar xaf ./tmp/deploy/images/core-image-minimal-taulabs-datalogger.tar.bz2 -C /media/rootfs/ 
sudo tar xaf ./tmp/deploy/images/modules--3.4.36+git0+80b4b5110dca5184b57e85f1e775fb006a2e85ad_c994390cfa28339cbc1ec3b56eeec83a5fa75bb7-r4.4.2-taulabs-datalogger-20130426163913.tgz -C /media/rootfs/

Unmount the rootfs partition

umount /media/rootfs

NOTE: You must wait until the umount has completed before removing your SD card or the filesystem may be corrupted.

Running your image on the Overo board

Power OFF your Overo board.

Remove the SD card from your PC and insert it into the SD slot of your Overo board.

Power ON your Overo board.

You should see serial output on the console port at 115200 N81.

Updating the Tau Labs spi_server

To just upgrade taulabs-server you do not need to reflash the whole sd card with a full image. This can be done by sending the updated code to the device. To rebuild taulabs-server you have to add a step to make sure it catches changes from git.

bitbake -c cleansstate taulabs-server
bitbake taulabs-server

Installing it

This assumes you have wifi connected and the IP address is 192.168.1.68. Once VCP pass through is working you will be able to install it via kermit probably.

If you just want to test the new version you can copy it to your root user directory (replace 192.168.1.68 with your ip address).

scp ./tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/taulabs-server/0.1-r1/packages-split/taulabs-server/usr/bin/spi_server root@192.168.1.68:~

To install it as the new server to run on start up (replace 192.168.1.68 with your ip address)

scp ./tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/taulabs-server/0.1-r1/deploy-rpms/armv7a_vfp_neon/taulabs-server-0.1-r1.armv7a_vfp_neon.rpm
command_to_install? (do we install a package manager with yocto?)

Some useful customizations to the overo image

Enabling WiFi

Customize the /etc/wpa_supplicant.conf file to contain exactly one network so that it associates with that one immediately. Here are a couple complete examples of working /etc/wpa_supplicant.conf files:

AP with WPA2-PSK authentication

# Access point using WPA2-PSK authentication
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
eapol_version=1
ap_scan=1
fast_reauth=1
network={
    ssid="sgb-private-ap"
    psk="somesecretpassword"
    priority=6
}

AP with absolutely no security (not even WEP):

# A completely open access point (no security)
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
eapol_version=1
ap_scan=1
fast_reauth=1
network={
    ssid="MONTE DA POUPA"
    priority=5
    key_mgmt=NONE
}

Bring up the wifi interface

ifup wlan0

Allowing ssh logins for the default root user

Normally this isn't required since you should be logging in as the 'taulabs' user rather than root but if you need remote login for the root account, here's how to enable it.

The root user has no password. By default, the SSH daemon won't allow logins with an empty password. Edit /etc/ssh/sshd_config and set:

PermitEmptyPasswords yes

Using the CaspaVL camera

Note the direction the cable should be connected (image from here).

Direction of Overo to Caspa cable

Testing connectivity to your camera:

media-ctl -v -l '"mt9v032 3-005c":0->"OMAP3 ISP CCDC":0[1]'
media-ctl -v -l '"OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -v -V '"mt9v032 3-005c":0 [SGRBG10 752x480]'
media-ctl -v -V '"OMAP3 ISP CCDC":1 [SGRBG10 752x480]'

Recording:

yavta -p -f SGRBG10 -s 752x480 -n 4 --capture=20 --skip 10 $(media-ctl -e "OMAP3 ISP CCDC output") --file=img-#.bin

Using the datalogger

Logging in

The taulabs user is automatically created with the following credentials:

login: taulabs
password: taulabs

This user has full access to the spidev* devices and has sudo permissions in case you need to perform system administration.

It is generally a good idea to log into the datalogger as the taulabs user when not performing system administration tasks.

Creating a log

Generate a log

spi_server -l 300000 /dev/spidev1.1

Copy the log.dat output to log.opl on your host computer and process it with OPLogConvert.m