GSG: AM35x EVM Software Setup
From Texas Instruments Embedded Processors Wiki
^ Up to main AM35x EVM Getting Started Guide Table of Contents
Contents |
PSP SDK Contents
The PSP SDK comes as a compressed tar archive. The latest version can be downloaded here.
The contents can be extracted using the following command
- tar xvfz AM35x-OMAP35x-PSP-SDK-MM.mm.pp.bb.tgz
The extracted directory structure looks like
AM35x-OMAP35x-PSP-SDK-MM.mm.pp.bb
| Software-manifest.html
| Arago-FS-Software-manifest.html
+----docs
| |----Building-RootFs-Arago.html
| |----DataSheet-MM.mm.pp.bb.pdf
| |----ReleaseNotes-MM.mm.pp.bb.pdf
| |----am3517
| | `----UserGuide-MM.mm.pp.bb.pdf
| |----omap3530
| | `----UserGuide-MM.mm.pp.bb.pdf
+----host-tools
| |----linux
| | `----signGP
| |----src
| | `----signGP.c
+----images
| |----boot-strap
| | |----am3517
| | | `----x-load.bin.ift
| | |----omap3530
| | | `----x-load.bin.ift
| |----fs
| | |----nfs-base.tar.gz
| | |----ramdisk-base.gz
| | |----rootfs-base.jffs2
| | |----am3517
| | | |----nfs.tar.gz
| | | |----ramdisk.gz
| | | `----rootfs.jffs2
| | |----omap3530
| | | |----nfs.tar.gz
| | | |----ramdisk.gz
| | | `----rootfs.jffs2
| |----kernel
| | |----am3517
| | | `----uImage
| | |----omap3530
| | | `----uImage
| |----u-boot
| | |----am3517
| | | `----u-boot.bin
| | |----omap3530
| | | `----u-boot.bin
+----scripts
| |----am3517
| | |----Readme.txt
| | |----initenv-micron.txt
| | `----reflash-micron.txt
| |----omap3530
| | |----Readme.txt
| | |----initenv-micron.txt
| | `----reflash-micron.txt
+----src
| |----boot-strap
| | |----ChangeLog-MM.mm.pp.bb
| | |----ShortLog
| | |----Unified-patch-MM.mm.pp.bb.gz
| | |----diffstat-MM.mm.pp.bb
| | |----x-loader-patches-MM.mm.pp.bb.tar.gz
| | `----x-loader-MM.mm.pp.bb.tar.gz
| |----examples
| | |----examples.tar.gz
| |----kernel
| | |----Readme.txt
| | |----ChangeLog-MM.mm.pp.bb
| | |----ShortLog
| | |----Unified-patch-MM.mm.pp.bb.gz
| | |----diffstat-MM.mm.pp.bb
| | |----kernel-patches-MM.mm.pp.bb.tar.gz
| | `----linux-MM.mm.pp.bb.tar.gz
| |----u-boot
| |----Readme.txt
| |----ChangeLog-MM.mm.pp.bb
| |----ShortLog
| |----Unified-patch-MM.mm.pp.bb.gz
| |----diffstat-MM.mm.pp.bb
| |----u-boot-patches-MM.mm.pp.bb.tar.gz
| `----u-boot-MM.mm.pp.bb.tar.gz
+----test-suite
`----lftb-MM.mm.pp.bb.tar.gz
Software Overview
To begin developing applications, you need to install the AM35x EVM development environment. This section outlines the steps required to load the AM35x EVM software onto the development host.
Command prompts in this guide
Commands are preceded by prompts that indicate the environment where the command is to be typed. For example:
- host $
- Indicates command to be typed into the shell window of the host Linux workstation.
- EVM #
- Indicates commands to be typed into the U-Boot shell in a console window connected to the EVM board’s serial port. (see Setup Terminal Program) .
- target $
- Indicates commands to be typed into the Linux shell in the terminal window connected to the EVM board's serial port.
NOTE: The document lists down various commands that needs to be executed on the target or on
the u-boot prompt for various operations required through out the document. Kindly note that a
direct copy and paste of these commands might result in insertion of lines for a single command.
Hence it would not work on the u-boot prompt or the target. Kindly ensure that you copy the long
commands into notepad, remove the line spaces between them and add a space wherever you
have removed the line spaces, before recopying and pasting it on the command prompts.
Preparing to install
On a host system, copy the .tgz file from the Download page to a temporary location with at least 1 GB free space.
- AM35x-OMAP35x-PSP-SDK-MM.mm.pp.bb.tgz
Installing the software
Installing the software used by the EVM involves performing the following steps:
- Installing the Target Linux Software
- Installing the Toolchain
- Exporting a Shared File System for Target Access
Installing the Target Linux Software
This section explains how to install Linux for use on the target board.
Note that separate versions of Linux are used by the target and your host Linux workstation. The following Linux host operating systems are supported for use with the AM35x EVM.
- Red Hat Enterprise Linux, Workstation V4, x86 32 bit
To install the Linux software, follow these steps:
- Copy AM35x-OMAP35x-PSP-SDK-MM.mm.pp.bb.tgz file (where MM.mm.pp.bb is the current version number) to the location where the PSP SDK needs to be installed.
All references in this document assume that the package is copied to "/home/<useracct>". Once copied extract the contents of the package using "tar" command
host $ cd $HOME host $ tar xvfz AM35x-OMAP35x-PSP-SDK-MM.mm.pp.bb.tgz
Note: The PSP Support Package (PSP) is a multi-platform PSP and is not configured for a particular platform. As shipped, this PSP cannot be used to build the demo or example applications. It must first be copied to a user area and configured/built for the AM35x EVM. Please see the Rebuilding the Linux Kernel section for instructions.
Installing the Toolchain
This guide assumes use of the LITE version of the CodeSourcery toolchain. This version is an unrestricted command line toolchain available free of charge from the CodeSourcery web site.
Alternatively, a full featured IDE 30 Day time limited version of Sourcery G++ can be downloaded from Codesourcery website.
The toolchain used is ARM GNU/Linux 2009q1. It can be downloaded via the following URL: http://www.codesourcery.com/sgpp/lite/arm/portal/release858
For installation on your Host Linux system choose "IA32 GNU/Linux TAR " (MD5 checksum - 1a6e88782f08b09a0e6cef545a1712ec)
To install the toolchain, follow the sequence below. These are to be executed on the Linux host platform.
$ mkdir –p /home/<useracct>/toolchain $ cp arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 /home/<useracct>/toolchain $ cd /home/<useracct>/toolchain $ tar -jxvf arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 $ rm arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
Although the board’s NAND flash contains a file system, during development it is more convenient to have the target board NFS mount a file system on a host Linux workstation. Once you test the application, you can store it on the board’s flash for a standalone demonstration.
Before the board can mount a target file system, you must export that target file system on the host Linux workstation. The file system uses an NFS (Network File System) server. The exported file system will contain the target file system and your executables.
To export the file system from your NFS server, perform the following steps. You only need to perform these steps once.
- Log in with a user account on the host Linux workstation. (In the following steps, we refer to the home user directory as "~".)
- Perform the following commands to prepare a location for the AM35x EVM target file system.
host $ cd ~ host $ mkdir -p workdir/filesys host $ cd workdir/filesys
- Switch user to "root" on the host Linux workstation.
host $ su password:
There will be a prompt for entering the password as shown above. Type the root password, for getting the root permissions
- If you have already prepared a directory tree to use for the NFS root file-system (see Section Rebuilding the NFS Image) you can proceed to the next step. Otherwise, copy the prepared version(for illustration we assume that your custom nfs tarball or nfs.tar.gz from AM35x-OMAP35x-PSP-SDK-MM.mm.pp.bb/images/fs/am3517 folder has been copied to /tmp) to a new directory created in step 2. Perform the following commands.
Note:Un-tar the file with root permissions
$ cp /tmp/nfs.tar.gz . $ tar –xvzf nfs.tar.gz
- Make sure you can write into the opt folder in the file system by setting the permissions of the opt folder within the target file system with your user account. Perform the following command
host $ chown -R <useracct> /home/<useracct>/workdir/filesys/opt
Alternatively, if you want to have permissions to write or create folders within the target file system that you want to export as NFS, perform the following command
host $ chown -R <useracct> /home/<useracct>/workdir/filesys
- Make sure the NFS server is configured and functioning properly. Add the following line to the /etc/exports file of the server. Ensure you have root permission before editing this file.
/home/<useracct>/workdir/filesys *(rw,no_root_squash,no_all_squash,sync)
NOTE: On some systems you may wish to add the no_subtree_check option to avoid warnings like:
exportfs: /etc/exports [3]: Neither 'subtree_check' or 'no_subtree_check' specified for export <export listed here>. Assuming default behaviour ('no_subtree_check'). NOTE: this default has changed since nfs-utils version 1.0.x - Then issue the following command to notify the NFS server about the new exported directory.
host $ /usr/sbin/exportfs –a host $ /sbin/service nfs restart NOTE: On some systems, the NFS server restart is in a different location. If the above command is not found, try: host $ /etc/init.d/nfs-kernel-server restart
- Verify that the server firewall is turned off:
host $ /etc/init.d/iptables status
If the firewall is running, disable it:
host $ /etc/init.d/iptables stop
- Make sure you exit from having the root permissions after completing all the above steps
host $ exit
To test your NFS setup, follow these steps:
- Get the IP address of your host Linux workstations as follows. Look for the IP address associated with the eth0 Ethernet port.
host $ /sbin/ifconfig
- Open a terminal emulation window to connect to the EVM board via RS-232 using the instructions in the Setup Terminal Program topic. If you have a Windows workstation, you can use HyperTerminal. If you have a Linux workstation, you might use Minicom. (You may need to turn on line wrap.)
- Power on the EVM board, and abort the automatic boot sequence by pressing a key in the console window. This gets you into the U-Boot prompt where you can configure how U-Boot will boot the Linux kernel.
- Set the following environment variables in the console window:
EVM # setenv nfshost <ip address of nfs host> EVM # setenv rootpath <directory to mount>
Use the following bootargs:
EVM # setenv bootargs 'console=ttyS2,115200n8 noinitrd rw ip=dhcp root=/dev/nfs nfsroot=$(nfshost):$(rootpath),nolock mem=256M'
Note that the setenv bootargs command should be typed on a single line. Also note that you should avoid using the numeric keypad to enter numbers, as it can sometimes insert extra invisible characters. These environment variables must be typed in perfectly including capitals, if anything is typoed you will likely run into boot errors.
The <directory to mount> must match what you specified in Step 5 of the Exporting a shared file system for target access section. For example, /home/<user>/workdir/filesys.
Hints: If the kernel version stored in the NAND flash on the EVM is out of date you may wish to flash the latest kernel image (using the uImage file in the /home/<useracct>/AM35x-OMAP35x-PSP-SDK-##.##.##.##/images/kernel directory) or Boot using TFTP
Hints: You may want to use the printenv command to print a list of your environment variables. You can also save these setenv commands in a .txt file from which you can paste them in the future.
- Save the environment so that you don't have to retype these commands every time you cycle power on the EVM board:
EVM # saveenv
- Boot the board using NFS:
EVM # boot
- You can now log in as "root" with no password required. See the Alternate Boot Methods section for information about booting with TFTP, NFS, or the board's NAND flash.
Setting up the build/development environment
To set up the development and build environment, follow these steps:
- Log in to your user account (and not as root) on the NFS host system.
- Add the /host/<useracct>/toolchain/arm-2009q1/bin directory to your path. This is typically done by adding an additional line to your shell resource file (~/.bashrc). Open the .bashrc with any text editor (eg. vim ~/.bashrc). For the path given above, the line to add to your .bashrc file is:
PATH=“/home/<useracct>/toolchain/arm-2009q1/bin:$PATH”
This adds the CodeSourcery tools to your path and allows you to execute the tools using arm-none-linux-gnueabi-gcc (or other tools in the tool chain) from any directory.
- Remember to use the following command after modifying your .bashrc file. The source command essentially executes the .bashrc script so that the path you just added to it is added to your environment variables:
host $ source .bashrc
- You can test that the toolchain is installed correctly by starting a new shell and using the following command:
host $ arm-none-linux-gnueabi-gcc –v
When you execute this command, you will get an output like the one shown below.
Target: arm-none-linux-gnueabi Configured with: /scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/src/gcc-4.3/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --with-specs='%{funwind-tables|fno-unwind-tables| mabi=*|ffreestanding|nostdlib:;:-funwind-tables}' --enable-languages=c,c++ --enable-shared --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion='Sourcery G++ Lite 2009q1-203' --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/install/arm-none-linux-gnueabi/libc --with-gmp=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/obj/host-libs-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu/ usr --with-mpfr=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/obj/host-libs-2009q1-203-arm-none-linux-gnueabi-i686-pc- linux-gnu/usr --disable-libgomp --enable-poison-system-directories --with-build-time-tools=/scratch/mitchell/builds/4.3-arm-none-linux- gnueabi-respin/lite/install/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/ lite/install/arm-none-linux-gnueabi/bin Thread model: posix gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203)
Writing a simple program and running it on the EVM
Make sure you have performed the steps in the Exporting a shared file system for target access section and the Setting up the build/development environment section before continuing with the steps in this section.
Perform the following steps on the NFS host system as user (not as root):
-
host $ mkdir –p ~/workdir/filesys/opt/hello
-
host $ cd ~/workdir/filesys/opt/hello
- Create a file called hello.c with the following contents:
#include <stdio.h> int main() { printf("Welcome to AM35x World!\n"); return 0; } - Build the new C file:
host $ arm-none-linux-gnueabi-gcc hello.c -o hello
Perform the following steps on the target board. You may use either the target's console window (see Setup Terminal Program) or a telnet session.
- Move to the new directory on the target:
target $ cd /opt/hello
- Run the new executable:
target $ ./hello
The output should be:
Welcome to AM35x World!
Rebuilding the Software
This section describes how to rebuild pieces of the software delivery. Ensure that the toolchain setup and install has been completed (see Installing the Toolchain).
Rebuilding U-boot
Rebuilding the U-boot is described in more detail in the PSP User’s Guide available at AM35x-OMAP35x-PSP-SDK-##.##.##.##/docs/am3517/UserGuide-##.##.##.##.pdf
Copy the U-Boot source archive from AM35x-OMAP35x-PSP-SDK-##.##.##.##/src/u-boot directory into your working directory
host $ cd ~ host $ mkdir –p workdir/opt host $ cp /home/<useracct>/AM35x-OMAP35x-PSP-SDK-#.##.##.##/src/u-boot/u-boot-##.##.##.##.tar.gz ~/workdir/opt/.
Un-tar the U-Boot source archive by performing the command given below.
host $ cd workdir/opt host $ tar -zxvf u-boot-##.##.##.##.tar.gz
To configure U-Boot for building, issue the following commands:
host $ cd uboot-##.##.##.## host $ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm distclean host $ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm am3517_evm_config
Once ready to build U-Boot, run the command:
host $ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm
The resulting U-Boot image named u-boot.bin will be in the current directory, ready to be loaded on the target.
Rebuilding the Linux Kernel
Rebuilding the kernel is described in more detail in the User’s Guide available at AM35x-OMAP35x-PSP-SDK-##.##.##.##/docs/am3517/UserGuide-##.##.##.##.pdf
Note that building the kernel requires using mkimage, a host side utility built by the u-boot makefile. If you have not already done so please build u-boot using the instructions in the Rebuilding U-Boot section. You will need to build U-boot and place mkimage in your Path. A command like below can be used. If you are using a bash shell, open the .bashrc file with any text editor(eg. vim ~/.bashrc) and add the following in the .bashrc file in your user account.
export PATH=/<path_to_uboot>/tools:$PATH
Copy the Linux kernel source archive from AM35x-OMAP35x-PSP-SDK-##.##.##.##/src directory into your working directory.
host $ cd ~ host $ mkdir –p workdir/opt host $ cp /home/<useracct>/AM35x-OMAP35x-PSP-SDK-##.##.##.##/src/kernel/linux-##.##.##.##.tar.gz ~/workdir/opt/.
Un-tar the Linux kernel source archive by performing the commands given below.
host $ cd /home/<useracct>/workdir/opt host $ tar -zxvf linux-##.##.##.##.tar.gz
In order to prepare the kernel for building, follow these commands:
host $ cd linux-##.##.##.## host $ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm am3517_evm_defconfig
If you need to make changes to the default configuration, perform the following command.
host $ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm menuconfig
Once ready to build the kernel, run the following command
host $ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm uImage modules
The resulting kernel image uImage will be placed under arch/arm/boot and is ready to be loaded on the target. If you will be loading this image onto on-board NAND or an SD/MMC card; please refer to those sections of the Getting Started Guide. If you are going to be accessing the kernel over TFTP (as is common during debug); you can copy the uImage file to your TFTP server directory, which is normally /tftpboot. It is a good idea to rename the uImage file in /tftpboot to something unique and meaningful to you, such as uImage_AM3517EVM_whyIbuiltThis so that the TFTP server can be used to swap between various images as your development progresses.
Once the modules are built they must be installed on the target file system in order to be used. The following command will install the modules to the target file system and create the modules dependency file.
host $ su root host $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- INSTALL_MOD_PATH=<target filesys dir> modules_install.
For example if you have been following the Getting Started Guide you should have created a target file system at /home/<useracct>/workdir/filesys. In the above command you should replace <target filesys dir> with /home/<useracct>/workdir/filesys.
Rebuilding the Initial NAND X-loader
Copy the X-Loader source archive from AM35x-OMAP35x-PSP-SDK-##.##.##.##/src/boot-strap directory into your working directory
host $ cd ~ host $ mkdir –p workdir/opt host $ cp x-loader-##.##.##.##.tar.gz ~/workdir/opt/.
Un-tar the X-Loader source archive by performing the following command.
host $ cd /home/<useracct>/workdir/opt host $ tar -zxvf x-loader-##.##.##.##.tar.gz
Configure X-Loader for AM35x EVM target:
host $ cd xloader-##.##.##.## host $ make am3517evm_config
To build X-Loader, run the command:
host $ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm
The above command produces the x-load.bin file, but in order for the X-Loader to be loaded by the AM35x ROM bootloader, it needs to be signed with the signGP program from the AM35x-OMAP35x-PSP-SDK-##.##.##.##/host-tools/linux directory.
host $ /home/<useracct>/AM35x-OMAP35x-PSP-SDK-#.##.##.##/host_tools/linux/signGP x-load.bin
The resulting signed X-loader is named x-load.bin.ift and should be ready for the target. For MMC/SD Card boot loading this file must be called MLO.
host $ cp x-load.bin.ift MLO
Rebuilding the NFS Image
In order to prepare a directory to be used as NFS file system on the target, follow the steps outlined below.
NOTE: It is recommended to perform these commands with root permissions, as it would be easier to manage special files, such as device nodes.
Create an empty directory
host $ mkdir -p $HOME/filesystem
Extract the contents of the pre-built nfs tarball from the release package (images/fs/am3517/nfs.tar.gz)
host $ sudo tar xvfz nfs.tar.gz -C $HOME/filesystem
This nfs tarball comes with several pre-built packages, arranged in an appropriate hierarchy. Upon extraction, user shoudl be able to see the complete directory structure in the folder mentioned above.
User can also populate this NFS directory with his own package(s) by issuing the following command:
host $ sudo tar -xvfz user_package_01.tar.gz -C $HOME/filesystem
After doing all that, the NFS directory is ready to be exported by the NFS server.
To save the newly created NFS directory for future use, you can use the following commands to create a tarball image of the NFS directory
host $ cd $HOME/filesystem host $ sudo tar cvfz new-nfs.tar.gz
Rebuilding the Full Ramdisk Image
The following steps describe the procedure to build the ramdisk for the target.
NOTE: It is recommended to perform these commands with root permissions, as it would be easier to manage special files, such as device nodes.
Create an empty directory where the file-system will be mounted:
host $ mkdir -p $HOME/ramdisk
Create an empty image file:
host $ dd if=/dev/zero of=ramdisk_file bs=40M count=1
Format the image with ext2 files-system
host $ mkfs.ext2 ramdisk_file You may see warning message like the following. Enter "y" to continue mke2fs 1.35 (28-Feb-2004) <ramdisk_file> is not a block special device Proceed anyway? (y,n) y
Mount the filesystem image to be populated with files:
host $ sudo mount -o loop ramdisk_file $HOME/ramdisk
Now the filesystem can be populated with the required files. Untar the filesystem component archives as described in section Rebuilding NFS image
Now the filesystem is ready and can be saved for mounting on the target
host $ sudo umount $HOME/ramdisk host $ gzip ramdisk_file
Rebuilding the JFFS2 File-System Image
The procedure to build the JFFS2 file-system for the target is similar and consists of the steps below.
NOTE: It is recommended to perform these commands with root permissions, as it would be easier to manage special files, such as device nodes.
Start with the $HOME/filesystem directory that was created in Section Rebuilding NFS image
Package the filesystem into JFFS2 format with the following command
host $ mkfs.jffs2 -lqnp -e 128 -r $HOME/filesystem -o jffs2_image_file.jffs2
NOTE: Some Linux distributions do not have mkfs.jffs2 command installed by default. To obtain this command you will need to either obtain the mtd-utils package for your distribution or you can download the sources from [1] and build them for your host Linux system.
The resulting file jffs2_image_file.jffs2 is in JFFS2 format and can be flashed to the target and used as root file-system.
What's next?
The next chapter of this Getting Started Guide is GSG:_AM35x_EVM_Additional_Procedures.
