.BSP Development Guide vPD13.1.0



1 About this Quickstart

This document describes how to install and work with the Linux and MQX Board Support Packages (BSP) for the phyCORE-Vybrid platform. The BSPs provide a fundamental software platform for development, deployment and execution on the phyCORE-Vybrid.

The Quickstart contains instructions for:

This Quickstart is written assuming the customer is running Linux on the Cortex-A5 and MQX on the Cortex-M4. However, it is also possible to run MQX on the Cortex-A5.

2 System Requirements

2.1 Hardware

2.2 Software

- Ubuntu: Most recent release or LTS (currently 12.04 32 or 64 bit)- Fedora: Most recent release

3 Getting Started

3.1 Connector Interfaces

Use the following as a reference for the connector interfaces on the phyCORE-Vybrid that will be used in this Quickstart:

3.2 Hello World

1. Insert the SD card that came in the kit in to the SD card slot connector X9 on the phyCORE-Vybrid Carrier Board.

2. Connect the kit supplied serial cable from a free serial port on your host PC to the DB9 connector X10 on the Carrier Board. This is the SCI_1 communication channel with the Vybrid at RS-232 levels.

3. 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.

4. Plug the kit supplied 5 V power adapter into the power connector X2 on the Carrier Board. LEDs D3, D14, and D20 on the phyCORE-Vybrid Carrier Board light up and boot messages will be printed on the terminal. If everything was done correctly the board should boot completely into Linux, arriving at a # prompt. 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.

5. From the command prompt, execute the following commands to load the MQX simple serial sample application from the root filesystem to the Cortex-M4 core. If the application is successfully loaded, you should see the text "Hello World (M4)" printed on the console.

modprobe mcc
mqxboot /home/sserial_example_pcm052_m4.bin 0x3f000000 0x3f000485

Note: There is no software mechanism implemented for sharing, without conflict, the serial console between Linux and MQX. See Console Conflict / Sharing for more information.

6. Before disconnecting power execute the poweroff command to shutdown the system. Please note that failure to use the command to end a session could result in a corrupted filesystem.

4 Host Setup

The phyCORE-Vybrid (PCM-052) has been developed and tested with Ubuntu 12.04 LTS Precise Pangolin [Installation Guide]. Although it is possible to use a different OS, some setup information will contain OS-specific commands and paths for settings.

Update repositories and upgrade installed packages:

sudo apt-get update
sudo apt-get upgrade

4.1 Server Setup

Support for installing and setting up TFTP, NFS, and Samba server settings to enable communication between multiple systems and the target.

4.1.1 TFTP

TFTP allows files to be downloaded from one machine to another. With most embedded Linux devices, TFTP is an efficient way to boot the kernel during development so that the user does not have to flash a new kernel every time it is modified. It is also helpful when updating images in flash from U-Boot.

First, start by installing the TFTP server.

sudo apt-get install tftpd-hpa

Next, files can be accessed from another machine on the same network by simply using the IP address of the host. Specify a folder where the files will reside on the host by replacing the folder path for TFTP_DIRECTORY with whatever folder you wish to use as your TFTP file storage location, or leave the folder as the default.

sudo gedit /etc/default/tftpd-hpa

# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure"

If you made any changes to the settings of the TFTP server, you need to restart it for them to take effect.

sudo restart tftpd-hpa

Lastly, if you would like to grant every user on the system permission to place files in the TFTP directory, use the following command, replacing <TFTP_DIRECTORY> with your chosen location.

sudo chmod ugo+rwx <TFTP_DIRECTORY>

4.1.2 NFS

A network file-system (NFS) server gives other systems the ability to mount a file-system stored on the host and exported over the network. In embedded development, this is essential for quickly testing applications and evaluating different file-system setups.

To begin the installation process use the following command:

sudo apt-get install nfs-kernel-server

Exported filesystems are designated in the "/etc/exports" file and allow you to choose both the directory to be exported and many settings for accessing the exports. Below is an example for exporting a folder called "nfs_export-ex" located in a user's home directory.

sudo gedit /etc/exports

# /etc/exports

/home/<user>/nfs_export-ex  *(rw,sync,no_root_squash,no_subtree_check)

The options (rw, sync, no_root_squash, no_subtree_check) for this folder are essential in setting up the NFS export correctly. For more information on additional options, refer to the man page for 'exports'.

read and write access when the directory is mounted

tells the file-system to handle local access calls before remote access

allows root access when mounting the file-system

reduces the number of checks the server must make to ensure that an exported sub-directory is within an exported tree and also enables access to root files in conjunction with no_root_squash

After modifying this file, in order to mount the directories as an NFS, you must force the NFS server to export all of the directories listed in "/etc/exports".

sudo /usr/sbin/exportfs -va

4.1.3 Samba

Samba servers are an excellent way to access a Linux file-system on a Windows machine via a network connection. Using a Samba server, it is quick and easy to transfer files between systems. To install a Samba server, use the following command:

sudo apt-get install samba

Before the Samba share can be mounted on another machine it's necessary to modify the configuration file to allow write access and access to home directories. Start by editing the "/etc/samba/smb.conf" file.

sudo gedit /etc/samba/smb.conf

Inside this file there are four specific things that need to be uncommented (remove the ';' at the beginning of the line) to enable the sharing of home folders and write access. Below is the section that must be modified:

#======================= Share Definitions =======================

# Un-comment the following (and tweak the other settings below to suit)
# to enable the default home directory shares. This will share each
# user's home directory as \\server\username
;[homes]
;   comment = Home Directories
;   browseable = yes

# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
;   read only = no

The outcomes after the changes are made follow:

#======================= Share Definitions =======================

# Un-comment the following (and tweak the other settings below to suit)
# to enable the default home directory shares. This will share each
# user's home directory as \\server\username
[homes]
   comment = Home Directories
   browseable = yes

# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
   read only = no

NOTE: It might also be necessary to change the "workgroup = " line to match the workgroup for your machine.

To apply the changes, the next step is to restart all Samba-related processes.

sudo restart smbd
sudo restart nmbd

Lastly, each user needs to have a password enabled to be able to use the Samba server. There are no rules for this password. The simplest method for choosing this password is to make it the same as the UNIX user's password, but it is not a requirement. After typing in the command below, you will be prompted to enter the password for the specified user.

sudo smbpasswd -a <user>

As mentioned in the configuration file, the samba share can be connected by accessing "\\<host machine ip>\\<user>" by either mounting a network share or using Windows explorer to navigate to it.

4.2 LinuxLink Tools Setup

LinuxLink, created by Timesys, provides web and desktop factory tools for embedded Linux development to manage toolchains, build environments, and software sources. After registering your kit, access to the BSP as well as to additional resources for Vybrid development will be provided.

4.2.1 LinuxLink Registration

Create a Timesys LinuxLink account for the PHYTEC Vybrid processor:

  1. Go to https://linuxlink.timesys.com/register/phytec/
  2. Complete all required sections on the registration form
  3. Enter the serial number on the SOM for the Vybrid Board MAC ID 
    The serial number will be a 12 digit MAC ID printed on a sticker on the SOM. Enter the 12 hexadecimal digits separating each byte by a ":" or "-"

    Example: MAC ID = 01:23:45:67:89:AB, Enter 01:23:45:67:89:AB or 01-23-45-67-89-AB 

  4. Click the Get Access Now! button to submit the registration form

Once the registration form is submitted, expect a welcome email containing login information including user name and password as well as helpful links to get started.

After logging into LinuxLink [Here], the custom personal dashboard will be brought up which acts as a hub of information for embedded Linux development including relevant software, tools, educational documentation, and links to custom builds.

4.2.2 Desktop Factory Build System

The Timesys Factory Build System allows full access to the target preconfigured build system for customization and development on a host Desktop. For application development, installation of the Factory Build System is not required. If you plan to modify the phyCORE-Vybrid Linux kernel, use the following instructions to download and install the Desktop Factory Build System.

LinuxLink pre-built starting points for the PHYTEC phyCORE-Vybrid include a download for a preconfigured Desktop Factory. Download the installer from the Build Output page under Build the SDK on your host -> Download the Desktop Factory Installer -> pcm052-factory-installer.sh.

Note: See the Linux BSP release notes page for a link to the most recent pre-built Build Output page or view all in LinuxLink from the Download BSP/SDK tab under Pre Built Starting Points -> PHYTEC phyCORE Vybrid Development Kit.

chmod +x pcm052-factory-installer.sh
./pcm052-factory-installer.sh

After successfully installing the Desktop Factory, the tools will be available from the /timesys/pcm052/Factory-<version> directory.

Note: Throughout the Quickstart any reference to <factory_install_dir> refers to /timesys/pcm052/Factory-<version>.

Alternatively, a manual install of the Factory Build Engine can be performed. In the case of an upgrade, it is recommended to back up the existing factory directory and then extract the new release, which allows preservation of the unchanged platform definition. Download and extract factory.tar.gzfrom View All Files on the Build Output page.

tar –zxf factory.tar.gz
cd factory

The Factory Build system requires distribution specific packages on the host that should match the specifications summarized by Timesys [Here].

If using Ubuntu, complete the following:

sudo  apt-get install build-essential libc6-dev libtool sharutils libncurses5-dev libgmp3-dev libmpfr-dev gawk gettext bison flex gperf indent texinfo libgtk2.0-dev libgtk2.0-bin libsdl1.2-dev swig python-dev texlive-latex3 texlive-extra-utils binutils-dev automake guile-1.8 icon-naming-utils libdbus-glib-1-dev wget gtk-doc-tools libxml-parser-perl zip unzip ecj fastjar x11-xkb-utils libglade2-dev libperl-dev python-libxml2 libexpat1-dev gconf2 groff libc6-dev-amd64

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

# For 64-bit host machines only
sudo apt-get install ia32-libs 
sudo apt-get install libc6-dev-i386

To check that the host system has all required software run a checksystem within the factory directory, and follow the instructions for resolving missing requirements if applicable:

make checksystem

4.3 SDK Install

The cross toolchain, pre-built images, and kernel source are all made available from the Software Development Kit (SDK). If you plan to write Linux application software but not modify the phyCORE-Vybrid Linux BSP, use the following instructions to download and install the SDK.

Download the SDK installer, pcm052-development-environment.sh, from the PHYTEC FTP or from LinuxLink on the Build Output page of a pre-built starting point.

Note: See the Linux BSP release notes page for a link to the most recent pre-built Build Output pages or view all in LinuxLink from the Download BSP/SDK tab under Pre Built Starting Points -> PHYTEC phyCORE Vybrid Development Kit.

cd Downloads
chmod +x pcm052-development-environment.sh
./pcm052-development-environment.sh 

The SDK is now installed and located in the destination directory, ex. /home/<user>/timesys/pcm052. From this directory the toolchain, pre-built images, and kernel source can be accessed.

Note: Throughout the Quickstart any reference to <sdk_install_dir> will refer to the SDK installation directory, /home/<user>/timesys/pcm052.

After successful installation, to use the toolchain your PATH environment variable must be updated. Use the following with export or permanently add to your PATH by including it in .bashrc:

PATH=<sdk_install_dir>/toolchain/ccache:<sdk_install_dir>/toolchain/bin:$PATH

4.4 MQX BSP Install

The Freescale MQX Real-Time Operating System with real-time performance also has an easy-to-use API and can be customized by features, size, and speed. The phyCORE-Vybrid MQX BSP utilizes the Vybrid multicore functionality and runs real-time multi-tasking MQX applications on the Cortex-M4 core while supporting communication with Linux running on the Cortex-A5 core. If you plan to modify the phyCORE-Vybrid MQX BSP or write MQX application software, use the following instructions to download and install the latest MQX release and apply pcm052 specific patches.

Download Freescale MQX 4.0.1 RTOS from the LinuxLink repository Here.

cd Downloads
chmod +x FreescaleMQXRTOS4.0.1.sh
./FreescaleMQXRTOS4.0.1.sh

MQX is now installed and located in the destination directory, ex. /home/<user>/timesys/FSL-MQX/FreescaleMQXRTOS4.0.1.

Note: Throughout the Quickstart any reference to <mqx_install_dir> refers to the installation directory of MQX, ex. /home/<user>/timesys/FSL-MQX/FreescaleMQXRTOS4.0.1.

Download the phyCORE-Vybrid specific patch, 0001-pcm052-Release-PD13.2.0-based-on-MQX-4.0.1.patch, to the <mqx_install_dir> from the PHYTEC FTP and apply the patch to the FreescaleMQXRTOS4.0.1 directory.

cd <mqx_install_dir>
patch -p1 < 0001-pcm052-Release-PD13.2.0-based-on-MQX-4.0.1.patch 

4.5 ARM Development Studio 5 (DS-5)

ARM Development Studio 5 (DS-5) is a set of software tools optimized for ARM processor-based embedded system development. If you plan to modify the phyCORE-Vybrid MQX BSP or write MQX application software, use the following instructions to download, install, and obtain a license for DS-5.

DS-5 is downloadable and available free of charge for one year through the DS-5 Starter Kit for Vybrid Controllers. The starter kit will allow immediate access to the ARM specific DS-5 Compilation Tools and DS-5 Debugger on a customized Eclipse IDE. Go to http://ds.arm.com/vybrid/vybrid-tower-starter-kit/ for the DS-5 installation file download and license activation code.

Download and Install DS-5:

Note: Linux is recommended to follow along with the Quickstart instructions

Note: Replacewith the version downloaded, ex. DS500-BN-00004-r5p0-1rel1.tgz, andwith the corresponding architecture value for the host platform, ex. install_x86_32.sh for a 32-bit architecture.

tar –xvzf <DS500-BN-Version>.tgz
sudo ./install_x86_<arch>.sh

Note: It is recommended to install the device drivers prompted during installation.

After successful installation, to start using ARM DS-5 from the command line add /usr/local/DS-5/bin to your PATH.

To permanently add to your PATH, include the following to .bashrc:

# To use ARM DS-5 at the command prompt 
PATH=$PATH:/usr/local/DS-5/bin

Start ARM DS-5 and activate the Starter kit license:

Note: If upgrading from the 30-day free trial to the Vybrid Starter kit license be sure to complete the scatter file modifications described in Section 4.2.4

eclipse & 

To manually open the License Manager, in Eclipse DS-5 select Help -> ARM License Manager

4.5.1 TimeStorm

The Timesys TimeStorm tools allow customization of the Linux kernel, filesystem, and applications on an Eclipse based IDE. If you plan to write Linux application software, use the following instructions to download and install the TimeStorm plug-in for DS-5.

Note: If you are not using ARM DS-5, the option to download the TimeStorm IDE or plug-in for Eclipse is available on LinuxLink from the Get IDE tab.

Download the installer from the LinuxLink dashboard under Private Downloads -> TimeStorm plugins 4.3.1 - 32 bit.

cd Downloads
chmod +x tsplugins-x86.sh
sudo ./tsplugins-x86.sh

The TimeStorm plug-in is now installed and available through Eclipse DS-5.

5 Debugging

5.1 Linux Application Debugging

This section provides an example of using DS-5 tools with the TimeStorm plug-in to debug a HelloWorld Linux application, downloadable from the PHYTEC FTP PHYTEC FTP.

Note:

A Linux root filesystem including a telnet server, SSH server that supports scp, or booted with a NFS mounted filesystem is required to remotely download and run applications on the target. All demo images and pre-built starting points include a SSH server with scp support in the root filesystem. To incorporate a SSH server with scp support in a custom root filesystem be sure to include the dropbear or openssh packages. This can be done using either the Timesys Web Factory Wizard or Desktop Factory.

Setup the remote settings on the phyCORE-Vybrid:

passwd
<new password>
<re-enter new password>
Note:

An error message indicating the password is too weak is only warning, the password will still change.

ifconfig eth0

The network settings can be modified. To permanently retain modified network configurations even after reset and power cycles, add network configuration commands to the S20-network start up script located in the root filesystem /etc/init.d/.


Create a new hardware target in Eclipse DS-5, if one does not already exist:

eclipse &

Verify the connection to the target by clicking Check Link and viewing the output on the Raw Log tab.

Open the HelloWorld demo in Eclipse DS-5:

Build the application:

The Linux application, HelloWorld, is located in the build output, <HelloWorld_dir>/Debug/.

Setup the debug configuration:

Launch and debug the demo application from the Debug Configurations menu by clicking Debug.

Automatically, DS-5 is switched into the debug perspective and the application will be loaded to the device. The debug configuration, HelloWorld Debug [TimeStorm C/C++ Remote], in the Debug control window displays the current state of the application. Continue using the Eclipse debugger to set breakpoints, step through a project, watch and change content of variables, and use the memory monitor to view the content at a memory address.

Note:
There will be a warning message: 'Can't find a source file at "dl-debug.c" Locate the file or edit the source lookup path to include its location.' Click the Resume icon to bypass. This will happen twice.

5.2 MQX Application Debugging

PHYTEC provides a simple serial, sserial_example_pcm052-m4, sample application to walk through building, loading, and debugging an application using DS-5.

These instructions require the following pre-compiled libraries in Debug configuration; see Section 7 for more information on how to build the libraries:

Open the simple serial project in DS-5:

eclipse &

Build the application:

Note: There are two modes to build in; Int Ram Release and Int Ram Debug. Int Ram Debug is suitable for debugging because it turns compiler optimizations off.

The build output is located in <mqx_install_dir>/mcc/examples/sserial/build/ds5/sserial_example_pcm052_m4/Int Ram Debug/.

Note: sserial_example_pcm052_m4.axf will be used when loading the MQX application from DS-5 and sserial_example_pcm052_m4.bin can be used when loading and executing the MQX application from Linux.

Setup debug configuration:

Note: If a debug launch configuration is not available, one can be created by clicking "New launch configuration" when DS-5 Debugger is selected in the navigation pane.

Launch and debug the demo application from the Debug Configurations menu by clicking Debug.

Automatically, DS-5 is switched into the debug perspective and the application will be loaded to the device. The debug configuration, sserial_example_pcm052_m4_Int_Ram_Debug, in the Debug control window displays the current state of the application. It should read connected. Set breakpoints in the code and use the icons in the Debug Control menu to control the application, ex. play icon to run.

To disconnect the target from the debugger:

Note: Switch back and forth between C/C++ Perspective and Debug Perspective using the icons in the top right corner.

6 Building the Linux BSP

6.1 Web Factory Wizard

The LinuxLink cloud-based development environment provides access to current build tools, configuration data, and platform prototypes providing elimination of delays attributed with installing, configuring, and maintaining a local build environment.

A workorder is required to use the LinuxLink Web Factory services for the assembly of a customized board support package. As part of the target hardware project, a workorder can be customized in terms of platform configuration options and submitted to be built on the Timesys servers.

To get started with the LinuxLink Web Factory Wizard create a phyCORE-Vybrid Board based project, it will be used to develop web based workorders built for the PHYTEC phyCORE-Vybrid platform:

Create a Project

  1. Go to Build BSP/SDK in LinuxLink
  2. Click Create a Project
  3. Enter a Name and Description
  4. Select PHYTEC phyCORE-Vybrid Development Kit for a Board
  5. Select an Application (optional)
  6. Click Create Project

Create a New Workorder

Create a new workorder to describe a specific BSP:

  1. Open the phyCORE-Vybrid project
  2. Click Create a Workorder
  3. Enter a Workorder Name and Description
  4. Optionally, click Next to be guided through custom options for building a BSP/SDK
  5. Click Save

Copy an Existing Workorder

Copy an existing workorder to take advantage of pre-configured platform specifications. For example, copy the PD13.0.2 MCC Demo workorder to inherit the kernel, toolchain, and a default set of packages selected along with optimized build configurations for a great starting point to add target specific customizations:

  1. Click the copy icon
  2. Enter new workorder Name and Description
  3. Click Save

Modify an Existing Workorder

An existing workorder can be edited:

  1. Click on the name/link of the workorder
  2. For a component, click on the Edit button

6.1.1 Managing Workorders

A workorder process can be customized in terms of the Linux components including the kernel, toolchain, and package versions along with the licensing information, root filesystem optimizations, and build output options. Use the PHYTEC pre-built starting point BUILD-OUTPUT.txt files as a reference for a default configuration including a minimal set of packages to be run on the target application.

The Web Factory Wizard user interface provides simple navigation through sub categories available in the top menu for configuring the BSP/SDK.

Kernel ConfigurationKernel Configuration allows selection of a Linux kernel from the Timesys provided options. By clicking on the kernel version link more information will be displayed about the kernel including the version, revision, estimated build time, license, and device drivers enabled. Additionally, the kernel .config file is available for download for inspection of the options as configured in the Linux kernel.

Toolchain ConfigurationThe Toolchain Configuration menu provides options for toolchain selection. It is recommended to select glibc Recommended because it provides a complete set of toolchain components and versioning. If a different version of toolchain components such as glic, gcc, binutils, and gdb is preferred, the custom toolchain option can be selected. More information including the version, revision, license, and an estimated build time for a toolchain component is available by clicking the component link.

Packages ConfigurationA table format that details the package names, version, license, and size information is available in the Packages Configuration menu. Browse through the Demo, Desktop, Development, Graphics, Multimedia, Networking, Runtimes, System, and Utilities categories or use the Smart Searchfeature to choose packages required for the target application. By clicking on the package, details including version, estimated build time, and license are provided. Additionally, some packages have modifiable build options which are accessed by liking the associated icon in the package listing. Checking the box next to the package name will select the package and automatically any package dependencies. Similarly, unchecking the box next to a package name will deselect the package and automatically any package dependencies. View the left panel for a summary of the both all the packages selected and dependencies as well as the total packages size.

Build Output OptionsThe Build Output Options menu allows the user to tailor the application and root filesystem output by providing options to select the specific file formats. Additionally, optimizations for along with the choice to include the native toolchain and kernel in the root filesystem are provided.

AdviceThe Advice menu or Timesys Recommendations can be used to detect any build and run or logic dependencies based on Timesys Recommendations. A user can Accept which will apply the recommendations or continue with the selections made with risk to having conflicts, incompatibilities, and deficiencies.

SummaryUse the Summary menu to review the workorder. Additionally, and use the Edit buttons as quick links to modify configurations.Based on the custom workorder, an estimated build time is generated and can be viewed at the bottom of the summary. It is important to note that this estimate does not take into account the number of builds currently being processed on the Timesys servers, therefore, a build will generally take longer than the estimated time.

After completing modifications to the workorder, click on the Save button at the bottom of the page to apply changes.

6.1.2 Building Images

A build is initiated on the Summary page of a workorder. To open the Summary from LinuxLink click Build BSP/SDK, select the project and click on the name of the workorder that is to be built. Alternatively, from an open workorder click Summary in the top menu. This menu provides a review of the workorder configuration and an estimated build time. Click the Build button to start the build.

The workorder will be queued for a short amount of time before being built on the Timesys servers. The status of the build can be viewed on the personal LinuxLink dashboard or the Download BSP/SDK page. Additionally, when the build is complete, these pages will display if the build was successful and provide a link to the download. Similarly, a user will receive notification via email when a build is complete with a link to the download.

6.1.3 Downloading Images

After notification of a successful build, links to the download for the BSP are provided via the Build Download Page or the Build Output Page. The BSP Download page can be opened after a successful build via the link provided by email notification or in LinuxLink from the personal dashboard orDownload BSP/SDK page. It highlights relevant files from the Build output along with instructions to support different user intentions including setting up application development on the host, building the SDK on the host, and booting the board. Click the View All Files button at the bottom of the page for the complete Build output.

The Build Output Page is a resource for all information relating to the build of a BSP/SDK. The page includes a build summary; package sources; individual binary files for the kernel, toolchain, bootloader, and root filesystem; and the desktop factory download. The build summary, BUILD-SUMMARY.txt, provides a list of configuration and build instructions associated with the platform including the system specifications, kernel and bootloader versions, toolchain components, host build tools, package selections, and root filesystem options.

6.2 Desktop Factory Build System

The BSP can be built from using the Desktop Factory, setup in Section 4.2.2.

6.2.1 Board Files

All source code is located in the <factory_install_dir>/build-armv7l-timesys-linux-gnueabi/ directory. To integrate and modify features on the system for both driver development and general settings or Carrier Board design, it is necessary to know about the board files summarized by the following:

DescriptionFile
Kernellinux-3.0/arch/arm/mach-mvf/board-pcm052.c
Bootloaderu-boot-2011.12/u-boot-2011.12/board/phytec/pcm052.c

6.2.2 Modifying the Platform

The Desktop Factory uses the kernel configuration (KConfig) system to include the packages, kernel, and toolchain versions and configurations. Make rules, performed on configuration symbols defined in KConfig, are defined to execute commands for the standard configuration, build, and install processes for the kernel, packages, and toolchain components. Therefore, target commands can be used with make directly on the command line.

For more information see the Make documentation provided by Timesys or use the help make target to view a list describing the common target commands.

A set of make rules are defined specifically for configuring targets by updating the configuration file. From Config.in files throughout the Desktop Factory, KConfig keys and their values are listed together in a menu to allow straightforward user configuration and customization of the platform.

Use the menuconfig make target on the command line in the BSP directory, <factory_install_dir>/, to modify the settings for the platform:

make menuconfig

This menu can be used to customize and configure the platform:


When making modifications, it is recommended to begin with the Target Configuration because of the dependencies other platform configuration have based on the chosen target. The options available in this menu range from architecture and CPU choice to root filesystem image types and target build specifications.

Toolchain specific configuration is provided by the Toolchain Configuration menu including customization for each toolchain component and a selection to either build a toolchain, optionally a native toolchain for the target as well, or fetch an existing pre-built toolchain. To customize the target software that can be included in the platform use the Target Software menu which provides sub menus to the Kernel, Bootloader, and Software Packages. Refer to Factory Configuration System Overview for additional documentation provided by Timesys.

To adjust the drivers and support included in a Linux kernel build, invoke the Linux kernel menuconfig interface:

make kernel-menuconfig

When using menuconfig, the location of a name or token can be searched by using the “/” key:

6.2.3 Building Images

The build system is invoked by executing make targets from the command line in the BSP directory, <factory_install_dir>/. With no targets specified, executing make will build the entire BSP through implementing a set of core Factory targets:

make
Note:

Execute make help, the list of included make targets when executing make will be designated by a ‘*’ mark.

All images are then stored in <factory_install_dir>/build_armv7l-timesys-linux-gnueabi/images.

Build Time Optimizations

The build time will vary depending on the package selection and Host performance. After the initial build when modifications to the same BSP are made, a full build is not required and taking advantage of optimized build options specific to modifications will reduce the build time. Use the following as a reference for build commands that for building parts of the BSP:

To rebuild U-Boot:

make u-boot-reconfigure
make u-boot-build
make u-boot-host-install

To rebuild the kernel:

make kernel-restage
make kernel-build
make kernel-install-image

Add an application to the root filesystem:

After selecting the package in make menuconfig:

make application-package
make rfs

To remove an application from the root filesystem:

make rfs-distclean
make rfs

6.3 Enabling Multi-Core Communication

If your application requires MCC support to include a MQX application use either the Web Factory or Desktop Factory tools to include the following packages in the Linux Build:

PackageDescription
mcc-kmodKernel driver module
libmccAPI user-space library
mqxbootUtility to load and boot an MQX image

For more information regarding the MCC subsystem for enabling MQX applications running on the Cortex-M4 core to communicate with Linux applications on the Cortex-A5 core see Vybrid MCC User Guide for MCC Version 1.0.

7 Building the MQX BSP

MQX is a run-time library of functions that programs use to become real-time multi-tasking applications. By simply linking a precompiled MQX library in an application, full functionality of the library is available through an easy-to-use API.

A fresh installation of a MQX release package does not include precompiled libraries. Before starting application development with MQX, determine the set of core libraries your application will require, customize compile time configurations, and compile the libraries from their corresponding project using the Eclipse DS-5 platform.

7.1 Core Libraries

All MQX applications are built on a set of core libraries including the PSP, BSP, RTCS, MCC, and USB.

Every MQX application will be required to include the Platform Support Package (PSP) and Board Support Package (BSP) libraries.

PSP (Platform Support Package)

The PSP library includes platform-specific code and generic MQX core files. The static library enables RTOS features for use in an application.PSP project used to build the PSP library: /mqx/build/ds5/psp_pcm052_m4PSP output library: /lib/pcm052_m4.ds5//psp

BSP (Board Support Package)

The BSP library includes board-specific code and I/O drivers. The static library enables the board and operating system to boot up and use the I/O driver services.BSP project used to build the BSP library: /mqx/build/ds5/bsp_pcm052_m4BSP output library: /lib/pcm052_m4.ds5//bsp

Other software libraries based on the MQX operating system are available. To incorporate additional functionality in a user application, link any of the following phyCORE-Vybrid supported run-time libraries:

RTCS (Real Time Communication System)

The RTCS library enables the application to provide and consume network services of the TCP/IP protocol family.RTCS project used to build the RTCS library: /rtcs/build/ds5/rtcs_pcm052_m4RTCS output library: /lib/pcm052_m4.ds5//rtcs

MCC (Multi-Core Communication)

The MCC library enables the application running on the M4 to communicate with applications on the A5 core.MCC project used to build the MCC library: /mcc/build/ds5/mcc_pcm052_m4MCC output library: /lib/pcm052_m4.ds5//mcc

USB HDK (USBH)

The USB HDK library enables the application to communicate with various USB devices such as keyboard and mouse attached on the USB bus.USBH project used to build the USBH library: /usb/host/build/ds5/usbh_pcm052_m4USBH output library: /lib/pcm052_m4.ds5//usbh

The following provides a description of the libraries required for phyCORE-Vybrid supported MQX demos and can be used as a reference to determine what libraries to link for a user application:

Simple Serial demo application that prints "Hello World (M4)" on the serial console. Operates with Linux on the Cortex-A5 core and MQX on the Cortex-M4 core using the MCC API requires the following libraries:psp_pcm052_m4bsp_pcm052_m4mcc_pcm052_m4

7.2 Managing Configurations

Generally, it is not recommended to modify any of the source files under source and build sub-directories in all MQX, RTCS, MFS, USB, and other core library folders. In some situations BSP source files will need to be modified, but most modifications will be done through compile time configurations.

Compile Time configurations

Major compile-time configuration options are centralized in a single user configuration file located in <mqx_install_dir>/config/pcm052_m4/user_config.h. Add or remove components and change device driver settings by enabling or disabling flags in this file. The user configuration file is included internally by private configuration files in core components such as PSP, BSP, RTCS, USB, and MCC. Changes to this file will affect all libraries.

BSP source files

For driver development and general settings or carrier board design it is necessary to know about the following BSP source directories to help integrate and modify features on the system:

BSP - /mqx/source/bsp/pcm052_m4IO Drivers - /mqx/source/io

Library Build Targets

Multiple compiler/linker configurations or build targets exist for each project. For library builds, two different compiler optimizations are available:

Debug – Compiler optimizations turned off or set to low so that compiled code is easy to debug but may be less effective and much larger than the Release build. Libraries are compiled into /lib/pcm052.ds5/debug/ directories.Release – Compiler optimizations are set to maximum for use in final applications only. Libraries are compiled into /lib/pcm052.ds5/release/ directories.

7.3 Building Libraries

Use the following build process for each library:

eclipse &

For bsp_pcm052_m4 browse to /mqx/build/ds5

For bsp_pcm052_m4, under Projects: select bsp_pcm052_m4

Debug, see Section 7.2.3 for more information

The output directory is of the form <mqx_install_dir>/lib/pcm052.ds5/<build_target>/<component> (For bsp_pcm052_m4 with a Debug build target, <mqx_install_dir>/lib/pcm052.ds5/debug/bsp).

Along with the library itself, all public header files needed by the application are copied to the library output directory. Additionally, in the PSP and BSP build process headers from the config/<board> and config/common directories including user_config.h are copied to the library output file. No changes should be made to header files in the library build output directory (/lib) because the files will be overwritten any time the libraries are built.

8 Managing Images

The SDHC card that comes with the Cosmic Board for phyCORE-Vybrid is pre-loaded with kit demo images. Different images located on the PHYTEC FTP or built images can be installed on a SD Card and run on the target.

To create an SD Card the following images will be required:

Optionally, to include a MQX application, a binary file will be required, ex. sserial_example_pcm052_m4.bin. Since MQX applications are loaded in the root filesystem /home/ directory, a root filesystem may already include MQX demo applications, such as rootfs.tar.gz available in the MQX PD13.1.0 release sserial demo on the PHYTEC FTP Here.
If using a SD card that has already been formatted with this script or a similar method, and the bootloader is not changing, skip to the appropriate steps below-- Step 6 if the Linux kernel is changing; Step 8 if the root filesystem is the only change; or Step 10 if adding a MQX application and continue the steps from there.

Bootloader

1. Make a script to correctly create and format the card

The following is the contents of a personal script, vybrid_sd_card.sh, that uses the dd command in order to place u-boot.imx on the SD/MMC Card.

#!/bin/bash
if [ $# -ne 2 ]
then
  echo "$0 usage: designate the SD card block device to format (e.g /dev/sdb)
$0 usage: supply the location of u-boot.imx file to flash (e.g. ~/images/u-boot.imx)" 1>&2
  exit 1
elif [ ! "$1" = "/dev/sda" ] ; then
  unset LANG
  DRIVE=$1
  BOOTIMG=$2
  if [ -b "$DRIVE" ] ; then
    dd if=/dev/zero of=$DRIVE bs=1024 count=1024
    parted --script ${DRIVE} mklabel msdos
    dd if=$BOOTIMG of=$DRIVE seek=2 bs=512
    parted --script ${DRIVE} mkpart primary ext2 2 52
    parted --script ${DRIVE} mkpart primary fat32 53 100
    parted --script -- ${DRIVE} mkpart primary ext2 101 "-1"
    mkfs.ext2 ${DRIVE}1 -L boot
    mkfs.vfat ${DRIVE}2 -F 32 -n kernel
    mkfs.ext2 ${DRIVE}3 -L rootfs
  fi
fi
Note:
This is a personal script, if executed, a user is at their own risk.

2. Determine the SD card device name

The SD card device name is of the form /dev/sd[b|c|d|e]. Run the following without and with the SD card connected:

ls /dev/sd*

The device that appeared on the call to ls with the SD card but not the call without is the SD card device.

3. Unmount all partitions of the SD card, using the SD card device name from Step 2:

umount /dev/sd[b|c|d|e]*

4. Run the script created in Step 1 specifying the SD card device name from Step 2 and location of the bootloader, u-boot.imx:

sudo ./vybrid_sd_create.sh /dev/sd[b|c|d|e] <path to u-boot.imx>/u-boot.imx

5. Mount all partitions

Remove and reinsert the SD card, automount will mount /media/boot, /media/kernel, and /media/rootfs

Kernel

6. If modifying the Linux kernel, remove the existing uImage-3.0-ts-armv7l file:

rm -rf /media/kernel/*

7. Load the new Linux kernel to the SD Card:

cp <path to uImage-3.0-ts-armv7l>/uImage-3.0-ts-armv7l /media/kernel; sync

Root Filesystem

8. If modifying the root filesystem, remove the existing:

sudo rm -rf /media/rootfs/*

9. Load the new filesystem to the SD Card:

sudo tar -zxvf <path to rootfs.tar.gz> -C /media/rootfs/; sync

MQX Application (optional)

10. The root filesystem may already include MQX demo applications, check the root filesystem /home/ directory

sudo ls /media/rootfs/root/*.bin

11. Load the MQX application binary file, <mqx_application>.bin, to the root filesystem /home/ directory

sudo cp <path to MQX application> /media/rootfs/root/; sync

12. Unmount each partition before removing the SD Card:

umount /media/boot /media/kernel /media/rootfs

9 Boot Configurations

9.1 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 (u-boot.imx). Set the boot mode according to the following:

SD Card

S5-1 to S5-4 ONS5-5 to S5-8 OFF

 



NAND

For SOM revisions 1374.0, hardware rework is required for NAND boot. Please see the Hardware Errata for additional information.

S5-1, S5-2, S5-5 ONS5-3, S5-4, S5-6 to S5-8 OFF


9.2 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:

Set U-boot's network environment variables to match your required network settings:

setenv ethaddr ##.##.##.##.##.##
setenv ipaddr ###.###.###.###
setenv serverip ###.###.###.##.
setenv gatewayip ###.###.###.###
setenv netmask ###.###.###.###

setenv tftploc <TFTP image location>
setenv nfs_root /<NFS mount location> 

ethaddrMAC address for the device. Set this to the MAC ID, which is printed on the sticker on the SOM.

ipaddrA dedicated IP address for the SOM. This is crucial if TFTP will be used for updating the device's images at any point.

serveripIP address of the host or another machine where the TFTP directory, if it exists, is located.

gatewayipGateway IP for the network. This is only necessary if the TFTP directory is located on another network.

netmaskNetmask for the network: typically 255.255.255.0. This is only necessary if the TFTP directory is located on another network.

tftploc (required for TFTP)Location of the path to the images on the TFTP server on the host system, setup in Section 4.1.1. Set the variable accordingly by referencing the following examples:

File PathU-Boot Command
/var/lib/tftpboot/PHYTEC/Vybrid/PD13.0.2
 setenv tftploc PHYTEC/Vybrid/PD13.0.2 
/var/lib/tftpboot
 setenv tftploc 

nfs_root (required for NFS)Location of the path to the NFS directory on the host system, setup in Section 4.1.2. For example: /home//phyCORE-NFS

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

pcm052 u-boot> printenv 

baudrate=115200
bootargs_base=setenv bootargs rw mem=256M console=ttymxc1,115200n8 init=/sbin/init
bootargs_net=setenv bootargs ${bootargs} root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfs_root},v3,tcp
bootargs_sd=setenv bootargs ${bootargs} root=/dev/mmcblk0p3 rootwait rootfstype=ext2
bootcmd=run bootcmd_sd
bootcmd_net=run bootargs_base bootargs_net; tftpboot ${loadaddr} ${tftploc}${bootfile};bootm
bootcmd_sd=run bootargs_base bootargs_sd; mmc rescan; fatload mmc 0:2 ${loadaddr} ${bootfile}; bootm ${loadaddr}
bootdelay=3
bootfile=uImage-3.0-ts-armv7l
eth1addr=00:e0:0c:bc:e5:61
ethact=FEC0
ethaddr=00:e0:0c:bc:e5:60
gatewayip=192.168.3.1
ipaddr=192.168.3.10
loadaddr=0x80010000
mem=260096k
netmask=255.255.255.0
nfs_root=/path/to/nfs/root
serverip=192.168.3.11
stderr=serial
stdin=serial
stdout=serial
tftploc=/path/to/tftp/directory

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

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

9.3 Stand-Alone Boot

By default, the phyCORE-Vybrid kit is setup 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 bootcmd_sd'
saveenv

9.4 Remote Boot

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

setenv bootcmd 'run bootcmd_net'
saveenv

9.5 Other Boot Options

You can create a unique boot 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 bootcmd_tftp ‘run bootargs_base bootargs_sd; tftpboot ${loadaddr} ${tftploc}${bootfile}; bootm’
setenv bootcmd ‘run bootcmd_tftp’
saveenv

10 Flashing Images

10.1 Bootloader

The phyCORE-Vybrid kit does not come with U-Boot pre-loaded on NAND flash, if you wish to boot from NAND follow the steps below:

1. Obtain a U-Boot image for NAND, u-boot.nand. It is recommended to download the pre-built image available on the PHYTEC FTP. If you have custom U-Boot requirements, or are interested in seeing the version you built in action, complete the following to create a u-boot.nand file from an existing u-boot.imx. The u-boot.imx file that is built with the factory does not have the correct image vector table offset required for NAND boot and must be padded with zeros. This step is only required if you are using your own built images and can be skipped if you use a pre-built u-boot.nand image.

dd if=/dev/zero of=u-boot-pad bs=1024 count=1
cat u-boot-pad u-boot.imx > u-boot.nand

2. Copy u-boot.nand from the previous step to the /kernel partition of your SD Card using your Linux Host PC.

cp u-boot.nand /media/kernel

Unmount all paritions before removing the SD Card from your Host PC:

umount /media/boot /media/kernel /media/rootfs

3. Place the SD Card into the connector on your board and make sure the boot settings are set to SD Card.

4. Connect the serial RS-232 cable from a free port on your Host PC to the connector, X10 on the Carrier Board.

5. Start your favorite terminal software (Windows: PuTTY or TeraTerm; Linux: Minicom) on your Host PC and configure it for 115200 baud, 8 data bits, no parity, and 1 stop bit (8n1).

6. Power on your board by plugging the kit supplied 5V power adapter to connector X2 on the Carrier Board.

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

7. Type the following at the prompt to mount the /kernel partition of the SD Card and copy the u-boot.nand image to NAND Flash:

nand erase 0x40000 0x40000
mw.b 0x80400000 0xff 0x40000
fatload mmc 0:2 0x80400000 u-boot.nand
nb_update 0x80400000 0x40000 0x40000

You should now be able to boot your board from NAND using the instructions specified previously in this Quickstart. Please note that hardware modification is required to support NAND boot on phyCORE-Vybrid SOMs with PCB revision 1374.0.

11 Additional Demos

11.1 Vybrid Theatre Demo

1. Insert the SD card with the vybrid-theatre root filesystem in to the SD card slot connector X9 on the phyCORE-Vybrid Carrier Board.

2. Connect the kit supplied serial cable from a free serial port on your host PC to the DB9 connector X10 on the Carrier Board. This is the SCI_1 communications channel with the Vybrid at RS-232 levels.

3. 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.

4. Plug the LCD-017-070W add-on into the LCD power (X30B) and data connectors (X30A).

5. Plug the kit supplied 5 V power adapter into the power connector X2 on the Carrier Board. LEDs D3, D14, and D20 on the phyCORE-Vybrid Carrier Board light up and boot messages will be printed on the terminal. If everything was done correctly the board should boot completely into Linux, arriving at a # prompt and automatically starting the Vybrid Theatre Demo. Note that the first time the board is booted the system will run ts_calibrate before loading the Vybrid Theatre. Press the boxes on the screen as they appear to calibrate the touchscreen controller.

6. Interact with the Qt application demo on the display by touching the screen.

The buttons are "Video", "Camera", and "Exit". The drop down menu selects between "Big Buck Bunny - mpeg 4" and "Big Buck Bunny - theora"*.

Touch the screen to select "Video" to begin playing the mpeg 4 or theora selection.

While the video is playing, touch the screen again to bring up additional information and options to control the behavior of the demo.

Displayed Information:Threads: 0-149 -- the number of threads added to increase the load of the CPU. This value can be manipulated using the + and - buttons on the left side of the screen.CPU 0: 0-100% [On] -- a total percentage of CPU usage. This value will change based on the number of threads, video progress, and system programs running parallel to the demo.FPS: ##.# -- the frames per second for the video. This value will change based on video progress, and potentially, the CPU usage.

Interactive Buttons:Select Core: 0 (dropdown) -- allows a user to select what cores are affected by the thread control and general playback. 0 is the only core supported.Disable Core -- allows a user to disable the core. This is an unsupported feature since disabling the active core will cause a system crash.Add 50 threads: (+) -- allows a user to increase the CPU load by 50 threads at a time, up to a maximum of 149 threads. This is used to help measure performance of the video based on CPU usage.Remove CPU load: (-) -- allows a user to remove the CPU load, setting the threads to zero. This is used to help measure performance of the video based on CPU usage.Play/Pause -- pause/resume the video. Resuming the video with this button will remove the overlay, but not modify the actual settings.Stop -- exit the video and return to the main menu of the demo.

In the main menu of the demo, the "Camera" button is unsupported. The application will crash if this is pressed.

The "Exit" button will gracefully close the application.

If the "Exit" button is hit, the Vybrid Theatre demo can be relaunched by running the following from the Linux command line:

/etc/init.d/S98-timesys-theatre start &

7. When finished with the kit demo, use the reboot command to restart, or the poweroff command to shutdown the system. Please note that failure to use these commands to end a session could result in a corrupted file system.