This Quickstart provides you with the tools and know-how to install and work with the Linux Board Support Package (BSP) for the phyCORE-AM57x Rapid Development Kit. This Quickstart shows you how to do everything from installing the appropriate tools and source, to building custom kernels, to deploying the OS, to exercising the software and hardware. Please refer to the phyCORE-AM57x Hardware Manual for specific information on board-level features such as jumper configuration, memory mapping and pin layout for the phyCORE-AM57x System on Module (SOM) and baseboard. Additionally, gain access to the SOM and baseboard schematics for the phyCORE-AM57x Rapid Development Kit by registering at the following: http://phytec.com/support/registration/

Requirements


The following system requirements are necessary to successfully complete this Quickstart. Deviations from these requirements may suffice, or may have other workarounds.

Hardware

Software

Getting Started With Binary Images


This section is designed to get the board up-and-running with pre-built images.

Connector Interfaces

Use the following as a reference for the connector interfaces on the phyCORE-AM57x Rapid Development Kit that will be used in this Quickstart.

Booting the Pre-built Images

The section was designed to show you how to boot the phyCORE-AM57x Rapid Development Kit with the pre-built demo images.

  1. Insert a bootable SD card into the SD0 (X2) slot on the baseboard. Since the default boot mode for the AM57xx PD15.1-rc1 release loads the kernel and root filesystem from SD card, a bootable SD card with MLO, u-boot.img, zImageam57xx-phycore-rdk.dtb, and tisdk-rootfs-image-am57xx-phycore-rdk.tar.gz extracted on the SD card is required. Instructions for creating an SD card are provided in the Creating a Bootable SD Card section of the Quickstart.
  2. Connect the kit supplied serial cable from a free serial port on your host PC to the DB9 connector X18 on the carrier board. This is the UART3 communication channel with the AM57x at RS-232 levels.
  3. Connect the kit supplied Ethernet cable from the Ethernet connector X7 on the carrier board to your network hub, router, or switch. If you do not have an Ethernet connection you can postpone this step, Linux will boot without the need for Ethernet connectivity but having the connection will significantly reduce your boot time.
  4. Start your favorite terminal software (such as Minicom or TeraTerm) on your host PC and configure it for 115200 baud, 8 data bits, no parity, and 1 stop bit (8n1) with no handshake.
  5. Plug the kit supplied 12 V power adapter into the power connector X4 on the carrier board. You will instantly see power LEDs VCC_5V0 and VCC_3V3 on the carrier board light up solid green.
  6. Press the power button S2 on the carrier board. You will now see power LEDs VDD_3V3, VDD_5V0, and VDD_12V0 on the carrier board light up a solid green. You will also start to see console output on your terminal window. If everything was done correctly the board should boot completely into Linux, arriving at a am57xx-phycore-rdk prompt. The default login account is root with an empty password. Note that the first time the board is booted it will takes a little while for the SSH server to generate new keys. Subsequent boots should be faster.

     Not seeing any output on the console?

    • Check that you have setup the terminal software correctly per step 5.
    • Make sure to press the power button S2 on the carrier board. Unlike some other PHYTEC boards, the phyCORE-AM57x RDK does not get powered on simply by plugging in the power supply.
    • Flash the release images from the PHYTEC ARTIFACTORY by creating a bootable SD/MMC card (Creating a Bootable SD Card), then configure the board to boot from SD/MMC (Selecting Boot Modes).


About the Yocto BSP


The Yocto Project is a Linux embedded development environment which provides layers of meta data and tools. PHYTEC's AM57x Yocto BSP is based on the Arago Project, which contains BSP, distro, and application recipes and tools for TI platforms based on ARM processors. The layers that provide this are meta-ti, meta-arago, and meta-processor-sdk. The openEmbedded meta layer is also included in this BSP and is made up of a collection of meta layers which provide recipes for many software packages. The meta-phytec layer leverages the Arago project as a base and contains recipes and configurations developed by PHYTEC. This layer defines configurations for u-boot, the kernel, and software specific to the phyCORE-AM57xx.

In order to help get started with PHYTEC's Yocto BSP structure, the repo tool can be used to obtain all the BSP sources relevant to your hardware configuration without interfacing with git. Detailed information on building this BSP from source is provided following the Development Host Setup section.

Development Host Setup


Host Debian Packages

Yocto development requires certain packages to be installed. Run the following commands to ensure you have the packages installed:


sudo apt-get install git build-essential diffstat texinfo gawk chrpath doxygen dos2unix

If using a 64-bit machine, the following libraries are also required:

sudo apt-get install lib32stdc++6 lib32ncurses5 lib32z1


The above is the recommended package installation for development on a Ubuntu 14.04 LTS Linux distribution. For a breakdown of the packages as well as a list of packages required for other Linux distributions, see the "Required Packages for the Host Development System" section in the Yocto Project Reference Manual: http://www.yoctoproject.org/docs/1.7/ref-manual/ref-manual.html#required-packages-for-the-host-development-system

Verify that the preferred shell for your Host PC is ''bash'' and not ''dash'':

sudo dpkg-reconfigure dash 
# Respond "No" to the prompt asking "Install dash as /bin/sh?"

Repo Tool

Download and install the repo tool. This tool is used to obtain Yocto source from Git.

cd /opt 
sudo mkdir bin 
 
# /opt/ directory has root permission, change the permissions so your user account can access this folder. In the following replace <user> with your specific username
sudo chown -R <user>: bin 
 
cd bin 
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ./repo 
#add directory that contains repo to your path 
chmod a+x repo

Add the repo directory in your PATH, using export from the command line or permanently by including it in .bashrc:

PATH=/opt/bin/:$PATH

Git Setup

If you have not yet configured your Git environment on this machine, please execute the following commands to set your user name and email address. See here for more information on getting started with Git.

git config --global user.email "your@email.com" 
git config --global user.name "Your Name"

Server Setup (Optional)

Building the BSP from Source


Due to SSL certification issues with our server (https://stash.phytec.com), GIT SSL verification needs to be disabled before any git or repo commands are performed. There are two ways to do this:

1) Disable GIT SSL verification for only the current shell instance

export GIT_SSL_NO_VERIFY=true

2) Disable GIT SSL verification for the current user (persists)

git config --global http.sslVerify false



Create a directory which will house your BSP development. In this example the BSP directory is /opt/PHYTEC_BSPs/. This is not a requirement and if another location is preferred (ex. ~/PHYTEC_BSPs) feel free to modify. We recommend using /opt over your HOME directory to avoid errors attributed to ~ syntax as well as the sudo requirement for the root filesystem and automation package building. We also recommend creating a package download directory (yocto_dl) separate from the yocto tree (yocto_ti), as it makes resetting the build environment easier and subsequent build times much faster.

Setup the BSP Directory:

sudo mkdir /opt/PHYTEC_BSPs 
cd /opt/ 
 
# /opt/ directory has root permission, change the permissions so your user account can access this folder. In the following replace <user> with your specific username
sudo chown -R <user>: PHYTEC_BSPs 
 
cd PHYTEC_BSPs 
mkdir yocto_ti 
mkdir yocto_dl 
cd yocto_ti 
export YOCTO_DIR=`pwd`

At this point you will now be able to navigate to the Yocto directory using the $YOCTO_DIR environment variable.

Install the Linaro Toolchain:

Run the following commands to install the Linaro Toolchain:

wget --no-check-certificate https://launchpad.net/linaro-toolchain-binaries/trunk/2013.03/+download/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux.tar.bz2
tar -jxvf gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux.tar.bz2 -C /opt/PHYTEC_BSPs

Download the BSP Meta Layers

Download the manifest file for the AM57xx PD15.1-rc1 BSP:

cd $YOCTO_DIR 
repo init -u https://stash.phytec.com/scm/pub/manifests-phytec.git -b am57xx -m am57xx-PD15.1-rc1.xml

Download the Yocto meta layers specified in the manifest file:

repo sync


Remove package "ltp-ddt" from the build, as it currently fails to build with machine am57xx-phycore-rdk:

vim sources/meta-arago/meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-test.bb   
#Remove the line " ltp-ddt \" from ARAGO_TI_TEST: 
 
ARAGO_TI_TEST = "\ 
	input-utils \ 
	cpuloadgen \ "


Start the Build

Run the Yocto build directory setup script. The TEMPLATECONF variable is used to set the source of the local configuration files (conf/bblayers.conf and conf/local.conf), which are located in the meta-phytec layer:

cd $YOCTO_DIR 
TEMPLATECONF=$YOCTO_DIR/sources/meta-phytec/conf MACHINE=am57xx-phycore-rdk source sources/oe-core/oe-init-build-env build

Add the the new download directory to build/conf/local.conf:

DL_DIR ?= "/opt/PHYTEC_BSPs/yocto_dl"

Maximize build efficiency by modifying the BB_NUMBER_THREADS variable to suit your host development system. This sets the maximum number of tasks that BitBake should run in parallel. Also set the variable PARALLEL_MAKE to specify the number of threads that make can run. By default, these are set to 4 in build/conf/local.conf:

# Parallelism options - based on cpu count 
BB_NUMBER_THREADS ?= "4" 
PARALLEL_MAKE ?= "-j 4"


The setup is complete and you now have everything to complete a build. This BSP has been tested with the arago-core-tisdk-image, it is suggested that you start with this image image before building other images. Alternate images are located in various meta layers at meta*/recipes*/images/*.bb. They can be found using the command bitbake-layers show-recipes "*-image*" in $YOCTO_DIR/build/.

The following will start a build from scratch including installation of the toolchain as well as bootloader, Linux kernel, and root filesystem images.

cd $YOCTO_DIR/build 
export PATH=/opt/PHYTEC_BSPs/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin:$PATH 
MACHINE=am57xx-phycore-rdk bitbake arago-core-tisdk-image

Built Images

All images generated by bitbake are deployed to $YOCTO_DIR/build/arago-tmp-external-linaro-toolchain/deploy/images/<machine>:

Source Locations:

Build Time Optimizations

The build time will vary depending on the package selection and Host performance. Beyond the initial build, after making modifications to the BSP, a full build is not required. Use the following as a reference to take advantage of optimized build options and reduce the build time.

To rebuild Barebox:

bitbake u-boot-phytec -f -c compile && bitbake u-boot-phytec

To rebuild the Linux kernel:

bitbake linux-phytec-ti -f -c compile && bitbake linux-phytec-ti

The Yocto project's Bitbake User Manual provides useful information regarding build options: http://www.yoctoproject.org/docs/1.6/bitbake-user-manual/bitbake-user-manual.html

Customizing the BSP


We recommend you create your own layer and make changes to the existing BSP there. This will make it easier to update the BSP. Instructions and tips on creating your own layer are available here: http://www.yoctoproject.org/docs/1.6/dev-manual/dev-manual.html#creating-your-own-layer

Appending Recipes

To modify an existing recipe in your own layer, use a bbappend file. The following is an example of modifying the u-boot-phytec_2014.07 recipe, u-boot-phytec_2014.07.bb, located at $YOCTO_DIR/sources/meta-phytec/recipes-bsp/u-boot/u-boot-phytec_2014.07.bb.

Create a recipes-bsp/barebox/ directory in your own meta-layer to place the bbappend file in. Make sure that the new file matches the .bb file name exactly. Alternatively, you may use % after the underscore in place of the specific version for portability with future versions of the recipe.

mkdir $YOCTO_DIR/sources/<YOUR_META_LAYER>/recipes-bsp/u-boot/ 
vim $YOCTO_DIR/sources/<YOUR_META_LAYER>/recipes-bsp/u-boot/u-boot-phytec_%.bbappend

For information on how to write a recipe, see chapter 5.3 of the Yocto Development Manual: http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html#understanding-recipe-syntax

Adding Packages to the build

There are various ways to add a package to the BSP. For example, packages and package groups can be added to image recipes. See the Yocto Development manual for how to customize an image: http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html#usingpoky-extend-customimage-imagefeatures

The following instructions demonstrate how to add a package to the local build of the BSP. First, search for the corresponding recipe and which layer the recipe is in. This link is a useful tool for doing so: http://layers.openembedded.org/layerindex/branch/daisy/layers/.

If the package is in the meta-openembedded layer, the recipe is already available in your build tree. Add the following line to $YOCTO_DIR/build/conf/local.conf:

IMAGE_INSTALL_append = " <package>"


The leading whitespace between the " and the package name is necessary for the append command.


If you need to add a layer to the BSP, clone or extract it to the $YOCTO_DIR/sources/ directory. Then, modify $YOCTO_DIR/build/conf/bblayers.conf to include this new layer in BBLAYERS:

BBLAYERS += "${BSPDIR}/sources/<new_layer>"

Configuring the Kernel

The kernel configuration menu allows the user to adjust drivers and support included in a Linux Kernel build. run the following command from the build directory:

cd $YOCTO_DIR/build
bitbake linux-phytec-ti -c menuconfig

Then rebuild the kernel:

bitbake linux-phytec-ti -f -c compile && bitbake linux-phytec-ti

To rebuild the root filesystem:

bitbake -f arago-core-tisdk-image

Customizing the Device Tree

The device tree is a data structure for describing hardware, and is a way of separating machine specific information from the kernel. For information on the device tree concept, devicetree.org is a good source: http://devicetree.org/Device_Tree_Usage

Device trees for PHYTEC products consist of a board DTS file, a SOM dtsi and a carrier board dtsi. The SOM dtsi includes the processor dtsi and contains definitions for all devices that are located on the SOM, such as eMMC flash. Peripherals whose signals are routed through the SOM but whose hardware is located on the carrier board are defined in the carrier board dtsi, such as MMC. All of the peripherals in these files are enabled or disabled in am57xx-phycore-rdk.dts.

To disable a peripheral such as EEPROM, change the status of the i2c_eeprom in arch/arm/boot/dts/am57xx-phycore-rdk.dts from "okay" to "disabled":

&i2c_eeprom {
	 status = "disabled"; 
}


The kernel source directory has very good documentation and examples on what bindings are supported for specific peripherals: Documentation/devicetree/bindings/.

Creating a Bootable SD Card


The process requires an SD card reader operational under Linux to format and access the Linux partition of the card. If you do not have SD card access under Linux then copying the bootloader and mounting the root filesystem on SD/MMC card will not be possible.

  1.  To format the SD card, you may use the script provided by TI, called "create-sdcard.sh". The script is available here. The script will also be built with the BSP, and can be found in the tarball processor-sdk-linux-image-am57xx-phycore-rdk.tar.gz (located in the bin/ directory. For more information regarding the script, seehttp://processors.wiki.ti.com/index.php/Processor_SDK_Linux_create_SD_card_script

If using pre-built images provided by PHYTEC, the exact image names are listed in the instructions below. If you have built your own images, then the images are located in: $YOCTO_DIR/build/arago-tmp-external-linaro-toolchain/deploy/images/<machine>/.

Once the SD card has been formatted, you may update the kernel, root filesystem, and barebox individually as well:

Root Filesystem

  1. If modifying the root filesystem, remove the existing (Note: this will replace the kernel and device tree blob (DTB) as well, since they are stored within the root filesystem):

    sudo rm -rf /media/rootfs/*


  2. Load the new filesystem to the SD Card. 

    sudo tar -zxf tisdk-rootfs-image-am57xx-phycore-rdk-20151104220543.rootfs.tar.gz -C /media/rootfs; sync;


Kernel

  1. If modifying the kernel, remove the existing kernel image and device tree binary files.

    sudo rm /media/rootfs/boot/zImage 
    sudo rm /media/rootfs/boot/am57xx-phycore-rdk.dtb


  2.  Load the new Linux kernel and device tree binary to the SD Card. Note that u-boot expects the kernel to be named "zImage" and the DTB file to be named "am57xx-phycore-rdk.dtb":

    sudo cp zImage--3.14.43+git_am57xx-PD15.1-rc1-b27-r7c-am57xx-phycore-rdk-20151104220543.bin /media/rootfs/boot/zImage; sync;
    sudo cp zImage--3.14.43+git_am57xx-PD15.1-rc1-b27-r7c-am57xx-phycore-rdk-20151104220543.dtb /media/rootfs/boot/am57xx-phycore-rdk.dtb; sync;


Bootloader

  1. Remove the existing barebox and MLO images:

    rm /media/boot/u-boot.img 
    rm /media/boot/MLO


  2. Copy the new images to the SD Card:

    cp u-boot-am57xx-phycore-rdk-2014.07+git_am57xx-PD15.1-rc1-b11-r0.img /media/boot/u-boot.img; sync
    cp MLO-am57xx-phycore-rdk-2014.07+git_am57xx-PD15.1-rc1-b11-r0 /media/boot/MLO; sync


Boot Configurations


Selecting Boot Modes

The bootloader, one of the key software components included in the BSP, completes the required hardware initializations to download and run operating system images. The boot mode, selected from the S5 dipswitch on the Carrier Board, determines the location of the primary bootloader. Set the S5 dipswitch correspondingly:

SD Card 

eMMC

Once the boot switch has been set appropriately, press the power button S2 on the phyCORE-AM57xx carrier board to power on the board.

Basic Settings

After application of power, approximately three seconds are allotted for the user to hit any key which will halt autoboot and enter U-Boot:

help is a useful tool in U-Boot to show available commands and usage.


Network Settings

You can check the target's default environment settings by running the following:

printenv

The ethaddr variable is the MAC id of the target. This is a pre-programmed value which is read from the E-fuse and matches the sticker on the SOM. Set U-boot's network environment variables to match your required network settings:

setenv ipaddr ###.###.###.### 
setenv serverip ###.###.###.##. 
setenv gatewayip ###.###.###.### 
setenv netmask ###.###.###.### 
setenv tftploc <TFTP image location> 
setenv rootpath /<NFS mount location>

Use the following command to verify that all of the environment variables are set as intended:

printenv

Saving Configurations

After confirming the environment variables are correct, save them and continue on to the next section to set the correct kernel and root filesystem boot location:

saveenv

Boot Options

The target can be booted from on-board media or from a development host via network. In our standard configuration, this BSP release loads the kernel and root filesystem from SD.

For booting via network, the development host is connected to the phyCORE-AM57xx Rapid Development Kit with a serial cable and via Ethernet; the embedded board boots into the bootloader, then issues a TFTP request on the network and boots the kernel and device tree from the TFTP server on the host. Then, after decompressing the kernel into RAM and starting it, the kernel mounts its root filesystem via the NFS server on the host. This method is especially useful for development purposes as it provides a quick turnaround while testing the kernel and root filesystem.

Stand-Alone SD/MMC Card Boot

By default, the phyCORE-AM57xx kit is set up to boot the Linux kernel and root filesystem from SD card. If switching from another boot configuration back to SD, use the predefined environment variable to set this mode:

setenv bootcmd 'run boot_mmc" 
saveenv


Remote Boot

To configure U-Boot to boot the kernel from TFTP and mount the root filesystem from NFS, configure the network as described above and then set the boot command to use the predefined environment variable with the following command:

setenv bootcmd 'run boot_net' 
saveenv


Stand-Alone eMMC Boot

Stand-alone eMMC boot is not supported in release PD15.1-rc1, as the root filesystem is too large to load into memory. See the section on Flashing Images for more information.


Custom Boot

You can create a unique bot configuration but an additional step is required. Use the following as a guide:

Boot the Linux Kernel via TFTP with Root Filesystem on SD:

setenv customboot 'tftp ${loadaddr} ${tftploc}${bootfile}; tftp ${fdtaddr} ${tftploc}${fdtfile}; run mmcargs; bootz ${loadaddr} - ${fdtaddr}' 
setenv bootcmd 'run customboot' 
saveenv


Flashing Images to eMMC


The board Development Kit is delivered with a pre-flashed bootloader. The following instructions for flashing images from SD card will be useful if you want to:

The images to be flashed will need to be copied to the /boot  or /rootfs/boot/ partition of a properly formatted SD card as described in the Creating a Bootable SD Card section of the Quickstart.

Partition eMMC from U-boot

Write a GPT partition table to eMMC. Create UUIDs for the disk and each partition by executing the following on the host machine:

uuidgen
<first UUID generated>
 
uuidgen
<second UUID generated>


After making all required connections, power on the board and enter U-Boot. Set the UUIDs for the disk and rootfs to the generated values:

U-Boot # printenv partitions uuid_disk=${uuid_gpt_disk};name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs} 
U-Boot # setenv uuid_gpt_disk <first UUID> 
U-Boot # setenv uuid_gpt_rootfs <second UUID>
U-Boot # gpt write mmc 1 ${partitions}
U-boot # reset

The partition gpt partition will be visible after a reset. (Note that mmc0 corresponds with the SD card slot interface, while mmc1 corresponds with eMMC):

U-Boot # mmc dev 1
U-Boot # mmc part

U-Boot

Copy the MLO and u-boot.img from the /boot partition of the SD card (connector X2, mmc0 in U-Boot) to eMMC (mmc1 in U-Boot):

U-Boot # mmc dev 0
U-Boot # mmc rescan
U-Boot # mmc dev 1
 
U-Boot # fatload mmc 0 ${loadaddr} MLO
U-Boot # mmc write ${loadaddr} 0x100 0x100
U-Boot # mmc write ${loadaddr} 0x200 0x100
 
U-Boot # fatload mmc 0 ${loadaddr} u-boot.img
U-Boot # mmc write ${loadaddr} 0x300 0x400

Root Filesystem

The default root filesystem "tisdk-rootfs-image-am57xx-phycore-rdk" is too large to load into memory. If you would like to flash a filesystem to eMMC, you may create a custom filesystem image that is smaller and flash this in a similar way as the kernel and u-boot. In order to build an ext4 filesystem image, add the following to the machine configuration file:

IMAGE_FSTYPES += "ext4"