You are on page 1of 18

NXP Linux 2.

6 LH7A40x BSP

NXP LH7A40x Linux Users Manual

2008-2009 NXP Semiconductors. All rights reserved.

NXP Linux 2.6 LH7A40x BSP Version history Release 1.00

Date 10/23/2009

Comments Initial release

2008-2009 NXP Semiconductors. All rights reserved.

NXP Linux 2.6 LH7A40x BSP

Table of contents
1 Introduction......................................................................................................................................... 5 1.1 1.2 Copyrights and limitations .......................................................................................................... 5 Where to start .............................................................................................................................. 5

1.3 Required hardware and software ................................................................................................ 5 1.3.1 Host system requirements....................................................................................................... 5 1.3.2 Target board requirements ...................................................................................................... 6 1.4 2 About this document .................................................................................................................... 6

BSP overview....................................................................................................................................... 7 2.1 Supported hardware .................................................................................................................... 7

2.2 BSP information .......................................................................................................................... 7 2.2.1 LTIB integration ..................................................................................................................... 7 2.2.2 Apex 1.6.8 .............................................................................................................................. 7 2.2.3 Linux 2.6.29.6......................................................................................................................... 8 3 Building your Linux system ............................................................................................................... 9 3.1 Downloading and installing LTIB ............................................................................................... 9

3.2 Configuring LTIB ........................................................................................................................ 9 3.2.1 First time running LTIB.......................................................................................................... 9 3.2.2 LTIB options ........................................................................................................................ 10 3.2.3 LTIB build cycle................................................................................................................... 11 3.2.4 Re-building the system ......................................................................................................... 11 3.2.5 More on LTIB....................................................................................................................... 11 4 Linux deployment methods .............................................................................................................. 12 4.1 Load and install Apex on the board........................................................................................... 12 4.1.1 Booting Apex from a Compact Flash card ........................................................................... 13 4.1.2 Booting Apex from a TFT server over the network.............................................................. 13 4.1.3 Booting Apex from a NOR FLASH ..................................................................................... 13 4.2 Booting the Linux kernel ........................................................................................................... 13 4.2.1 Kernel command line............................................................................................................ 13 4.2.2 Automating Apex boot ......................................................................................................... 14 4.2.3 NFS mounted root filesystem ............................................................................................... 14 4.2.4 EXT2 mounted root filesystem............................................................................................. 14 5 Additional information..................................................................................................................... 15 5.1 Getting the BSP files.................................................................................................................. 15 5.1.1 Where to get the Linux Apex and kernel patches ................................................................. 15 5.1.2 LTIB and GCC toolchain compatibility and dependency issues .......................................... 15 5.1.3 Known issues........................................................................................................................ 15 5.1.4 TFTP and NFS help.............................................................................................................. 15 5.1.5 ALSA device support ........................................................................................................... 16 5.1.6 Compact Flash (IDE) support............................................................................................... 16 5.1.7 Other links ............................................................................................................................ 17
2008-2009 NXP Semiconductors. All rights reserved.

NXP Linux 2.6 LH7A40x BSP

2008-2009 NXP Semiconductors. All rights reserved.

NXP Linux 2.6 LH7A40x BSP

1 Introduction
This document details the Linux 2.6.29.6 BSP for the NXP LH7A40x SoC (System on Chip). The BSP provides a complete Linux port for the Logic PD LPD7A404 platform using the LH7A404 MCU, but can be easily ported to other platforms. This document covers many aspects of the Linux and the Linux operating system. Some of the areas covered include: System and target board setup on the Logic PD LH7A40x board Using LTIB to build a complete Linux system Deployment methods for the target board

1.1 Copyrights and limitations


The LH7A40x BSP is provided free of charge and with no support from NXP. Portions of the BSP are copyrighted by NXP Semiconductors.

1.2 Where to start


If you have limited or no experience with building Linux based systems, you should start with using LTIB (Linux Target Image Builder). LTIB handles most of the hard work for you deploying a complete Linux system with an easy to use menu interface. If you are this type of user, start at Section 3. If you already have experience setting up, building, and deploying a Linux system, you may want to skip to just getting the necessary patches for Apex and the Linux kernel. These patches are available on the NXP website.

1.3 Required hardware and software


1.3.1 Host system requirements
To develop Linux for the LH7A40x, a host PC running the Linux operating system is needed. Because of the many variations of Linux releases and supported packages, it is unknown if the tools included with the BSP will work correctly on a specific release of Linux. This BSP and the supporting tools have been tested with the Fedora 9 and 10 and Ubuntu Linux releases. Although other releases may work fine, they are currently untested. In some cases, default Linux distributions may lack all the necessary packages to build Linux. When installing or building your system, examine the error messages closely they usually indicate if the error occurred due to a missing package. If this type of error occurs, add the missing package using yum or the software manager and try the build again.
2008-2009 NXP Semiconductors. All rights reserved.

NXP Linux 2.6 LH7A40x BSP

1.3.2 Target board requirements


The LH7A40x Linux port supports the following boards.

1.3.2.1 Logic PD LPD7A404 and LPF7A400 boards


The Logic PD LH7A404 board has been tested with the Linux port. The boards include a bootloader called Lolo that sets up the target hardware prior to the Linux bootloader. Lolo is used to initially setup the board and then boot into Apex. More information about Lolo is included with the documentation that comes with the Logic PD boards or can be downloaded from Logic PDs website.

1.4 About this document


The intended use of this document is to provide initial help in developing a Linux operating system for the Lh7A40x MCU. The steps required to download the BSP all the way to deploying Linux to the Logic PD LPD7A404 board are covered. This document is broken into the following sections: BSP overview Getting the BSP Where to get the patches, toolchain, and LTIB Building your Linux system Using LTIB to configure and build Linux, Linux kernel configuration Linux deployment methods NFS deployment, SDMMC (EXT2) card deployment, MTD (JFFS2) deployment Additional information Other resources, links, and other information

2008-2009 NXP Semiconductors. All rights reserved.

NXP Linux 2.6 LH7A40x BSP

2 BSP overview
This section gives a brief overview of the BSP contents, features, and supported peripherals. This BSP has been developed to support Linux kernel 2.6.29.6. The term BSP refers to the files specific to the LH7A40x Linux port. These include the kernel and u-boot patch file(s), pre-built GCC toolchain, and necessary LTIB files to build a Linux distribution. Note that most of the drivers and architecture files for the LH7A40x SoC are part of the Linux mainline. Developers are welcome to use their own toolchains or develop a Linux system without using LTIB.

2.1 Supported hardware


This BSP supports the NXP LH7A40x SoC and most of its built-in peripherals. Several external peripherals that may be required to use optional interfaces are also supported.

2.2 BSP information


2.2.1 LTIB integration
LTIB (Linux Image Target Builder) provides a convenient method to build the bootloader, kernel image, and root filesystem and then deploy them to your target. LTIB provides an environment that allows easy setup, configuration, and build of the boot loader, Linux kernel, deployment methods, build tools, etc. If LTIB is used to develop a complete Linux system, the work of downloading and installing packages, building the root filesystem, and an assortment of other tasks is greatly simplified.

2.2.2 Apex 1.6.8


The LPD7A40x Linux kernel requires the Apex bootloader to load and boot the kernel. Apex is built as a part of the LTIB build procedure.

2.2.2.1 Apex-1.6.8 for LPD7A40x boards


Apex initializes most of the peripherals on the LPD7A404 board, but relies on an external bootloader to setup memory. The LPD7A404 board come pre-installed with a bootloader called Lolo that provides low level board and memory initialization. Lolo can be configured to automatically load and run a program after board initialization is complete. The LPD7A40x version of Apex provides the following features: Persistent configuration of Apex and boot parameters Kernel image boot from NOR FLASH or Ethernet Ethernet network configuration

2008-2009 NXP Semiconductors. All rights reserved.

NXP Linux 2.6 LH7A40x BSP

2.2.3 Linux 2.6.29.6


This section describes the system and driver support included with the LH7A40x Linux 2.6.29.6 BSP.

2.2.3.1 LH7A40x architecture support


The following LH7A40x peripherals are supported as part of the core system architecture: Timer (system tick) Interrupt controller DMA

2.2.3.2 LH7A40x driver support


The following Linux drivers are provided as part of the BSP: Color LCD controller (AMBA CLCD driver) Touchscreen controller UARTs (up to 3) AC97 audio playback USB host USB gadget

2.2.3.2.1 LPD7A404 board driver support


The following additional support is provided for the LPD7A404 board: Ethernet controller Compact FLASH (IDE) support

2008-2009 NXP Semiconductors. All rights reserved.

NXP Linux 2.6 LH7A40x BSP

3 Building your Linux system


This section explains how to configure and build a Linux system for the Logic PD LPD7A404 board using LTIB. Deployment of the root filesystem will be handled via NFS.

3.1 Downloading and installing LTIB


LTIB needs to be downloaded and installed on the Linux host machine. To start this process, go to http://www.bitshrine.org/ and follow the instructions there to download and install LTIB. It is highly recommended to use the netinstall script to install LTIB or use a direct CVS download (explained in the LTIB FAQ). Using a fixed snapshot image may not get you the latest files. Installation of LTIB should be followed as per the instructions on the www.bitshrine.org website. The LH7A40x BSP will be automatically downloaded and installed after the LTIB packages have been installed from the web and the Logic PD LPD7A404 board has been selected in the LTIB platform selection menu. The LTIB installation package can take a few hours or more to install. Per the LTIB instructions, make sure you perform your build with a user account do not use root! After installation is complete, a screen will appear that will allow you to select a platform. Select the NXP LH7A404 on the Logic PD LPF7A404 board platform and save the configuration. You will then be passed to the LTIB configuration menu.

3.2 Configuring LTIB


3.2.1 First time running LTIB
If this is the first time you are running LTIB, a default configuration will be provided for you that will setup the pre-built toolchain, build Apex, build a kernel image, and setup a root filesystem. A pre-selected Linux kernel configuration is also provided with most of the supported interfaces selected for the LH7A40x and the LPD7A404 board. A preselected set of packages has also been made for your root filesystem image. One of the pre-selected packages is busybox, which will provide most of the basic system command line functions and the console shell. Busybox is also preconfigured as part of LPD7A404 port of LTIB. Deployment options have also been setup, with NFS being the default root filesystem mount setup. Although each LTIB configuration items is explained here, it is recommended that the default selections and configurations be tried for the first build to verify that everything is working. This is the fastest way to verify that your host system is correctly configured and that you target board is working properly. For now, just exit the menu and save the configuration. Once you exit the menu, the build process will start.
2008-2009 NXP Semiconductors. All rights reserved.

NXP Linux 2.6 LH7A40x BSP

The next time you LTIB, the LTIB configuration menu will not show up and the build process will start again with the previously saved options. You can show the menu again with the LTIB config option.

3.2.2 LTIB options


The LTIB configuration menu allows some customization over how your Linux system is built. The options are broken into the following categories toolchain, bootloader, kernel, package list, system configuration, and deployment. Specific options for each category are selected from the LTIB menus. A general overview of each section is provided.

3.2.2.1 Toolchain selection and setup


You can either select a pre-built toolchain or setup your own toolchain with LTIB. Start by selecting the Target C library type). Selecting it will enter into a submenu that will allow choices between GLIBC and UCLIBC. Your choice of a pre-built toolchain is tailored by this option. Currently, only GCC 4.3.2 with GLIBC 2.7 is supported as a prebuilt toolchain option. If you select GLIBC as the C library, you have an option of selecting a toolchain of GCC-4.3.2-glibc-2.7 or custom. If you select the custom option, you will need to provide your own toolchain as well as the toolchain path, toolchain prefix, and toolchain build options.

3.2.2.2 Bootloader selection and options


With the bootloader choice option, you can select either the u-boot bootloader or none. If you select none, the bootloader and its patches will not be downloaded and built.

3.2.2.3 Kernel build options


You can choose which kernel (version and board) in the kernel section of the menu. Selecting the Configure the kernel option will bring up the kernel configuration menu before the kernel starts building. If the Leave the kernel sources after building option isnt selected and the Linux source tree hasnt been built yet, the Linux source tree will be erased after the Linux kernel has been built.

3.2.2.4 Package list


This submenu allows you to select the packages you want in your Linux system. Some options are important for building a root filesystem. A few select packages have been pre-selected including busybox and the device nodes. It is possible that the some packages may not compile with the ARM architecture.
2008-2009 NXP Semiconductors. All rights reserved.

10

NXP Linux 2.6 LH7A40x BSP

3.2.2.5 Target system configuration


This submenu allows customization of the kernel startup. You can set up kernel options such as networking addresses, custom startup, or start services. Depending on which packages you install, the menu may change to provide additional options for selected packages.

3.2.2.6 Target image generation


This submenu allows further customization of the target image. You can specify the image type to build (such as JFFS2, compressed EXT2, or a flat NFS tree) and specify if the target filesystem is read-only. Regardless of which image type you choose, a flat image suitable for NFS will be located in the ./rootfs directory.

3.2.3 LTIB build cycle


After all the LTIB options are selected and you exit LTIB (and save the configuration), the LTIB build cycle will start. The build cycle downloads and builds any packages enabled in the LTIB configuration and then generates the target root filesystem image. LTIB will only build packages that have changed since the last build (generally). A shortened build cycle is similar to this: Download and install toolchain (if not using custom toolchain) Download, build, and install support packages Build root filesystem skeleton Move target libraries to root filesystem Download u-boot and patches and build it move u-boot to root filesystem Download Linux kernel and patches and build it move kernel to root filesystem Download needed target packages and build them move to root filesystem Setup kernel boot configuration Buld root filesystem image (ie, JFFS2) The generated root filesystem area is in your LTIB directory under ./rootfs. You can usually NFS mount this directory. The apex.bin (bootloader image) and zImage (kernel image) files are located in boot directory of the root filesystem.

3.2.4 Re-building the system


To rebuild the system, invoke ltib again. Note that some options on the LTIB configuration menu may need to be selected to force builds of some components (such as the Linux kernel). The LTIB configuration menu can be shown with the config option.

3.2.5 More on LTIB


Go to http://www.bitshrine.org/ for more detailed information on the use of LTIB.

2008-2009 NXP Semiconductors. All rights reserved.

11

NXP Linux 2.6 LH7A40x BSP

4 Linux deployment methods


One the Apex bootloader, the Linux kernel, and root filesystem are built as explained in Section 3, the images can be deployed to the board. This section explains how to get the Linux running on the board once the Linux system images are built. On powerup or reset, the LPD7A40x boards loads and start Lolo, the built-in bootloader included on the board. Lolo will need to be configured to boot Apex either from the network via TFTP, NOR FLASH, or from the CF card. Once Apex has booted, Apex needs to be configured to load and boot the Linux kernel from the network via TFTP or NOR FLASH. The command line for Linux also needs to be setup prior to booting Linux. Apex will then boot the kernel. Once the kernel is up and running, the root filesystem is mounted. The filesystem can be mounted from RAM, a Compact Flash card, or over the network using NFS.

4.1 Load and install Apex on the board


Before the Linux kernel can be booted, the Apex bootloader needs to be installed on the target board. Development boards from Logic PD ship with the Lolo bootloader already installed. Lolo may be used to load APEX from a tftp server, from a CompactFlash card or via TeraTermPro running on a Windows host. Note Apex doesnt replace Lolo, but loads and runs from Lolo. Once Apex is installed and running, the first UART port on the board is used to execute Apex commands. This port needs to be configured for 115.2K-8N1 operation. APEX Boot Loader 1.6.8 -- Copyright (c) 2004-2008 Marc Singer compiled for Logic Product Development LPD7A404 on 2009.Oct.22-09:56:19 APEX comes with ABSOLUTELY NO WARRANTY. It is free software and you are welcome to redistribute it under certain circumstances. For details, refer to the file COPYING in the program source. apex => mem:0xc0200000+0x11178 (70008 bytes) env => nor:256k+64k (no-write) Use the command 'help help' to get started. #
2008-2009 NXP Semiconductors. All rights reserved.

12

NXP Linux 2.6 LH7A40x BSP

4.1.1 Booting Apex from a Compact Flash card


Format a CF card (fdisk and mkfs.msdos) with at least one FAT partition. It doesn't have to be the first one. (Since CF cards come out of the package with one FAT partition, so you may not have to do this part.) Locate the apex.bin file generated with LTIB in the ./ltib/rootfs/boot/ directory. Copy apex.bin to the FAT partition of the CF card. Flush the data to CF card and then eject it. Insert it into the SDK board CompactFlash slot. Reset the SDK board and you should see the LogicLoader startup message followed by the losh> prompt. Loading APEX requires a few steps. Mount the CF, load the apex.bin file and execute it. The steps are detailed below: losh> mount fatfs /cf losh> load raw 0xc0200000 0x00030000 /cf/apex.bin losh>exec 0xc0200000

4.1.2 Booting Apex from a TFT server over the network


Setup the apex.bin file in your TFTP servers file transfer area. Use the steps to transfer the file to the board and start it: Be sure to replace the IP addresses in the steps below with your addresses suitable for your network. losh>ipconfig sm0 192.68.1.55 losh>load raw 0xc0200000 0x00030000 /tftp/192.168.1.51/zImage losh>exec 0xc0200000

4.1.3 Booting Apex from a NOR FLASH


Once Apex has been transferred to the board using the network or Compact Flash approach, the image can be saved in NOR FLASH and booted from there. See the Logic PD board documentation for the latest procedure on how to do this. Be careful with programming NOR FLASH. You can inadvertently erase the Lolo bootloader on the board and the board will no longer boot.

4.2 Booting the Linux kernel


Apex can be used to load and boot the kernel from NOR FLASH, a Compact Flash card, or over the network using TFTP. The basic steps for each procedure are shown in the following sections.

4.2.1 Kernel command line


Regardless of which approach you use to load and boot the kernel, the Linux command line passed to the kernel during kernel boot needs to be configured in Apex before the kernel is booted.
2008-2009 NXP Semiconductors. All rights reserved.

13

NXP Linux 2.6 LH7A40x BSP The cmdline environment variable in Apex is used to setup the kernel command line parameter. The following is an example of how it is setup in Apex. apex>setenv cmdline console=ttyAM1,115200n81 rw root=/dev/hdc1 ip=dhcp For most setups, the default initial console will be on ttyAM1, but the mount point for the root filesystem may be located on an EXT2 partition of the Compact Flash card or over the network using NFS.

4.2.2 Automating Apex boot


Apex can be setup to automatically load and start the kernel with the startup environment variable. The example below will setup Apex to load and boot the kernel image over a network using TFTP and then start it with the command line in the cmdline environment variable. apex>setenv startup ipconfig 192.168.1.55; copy tftp://192.168.1.51/zImage 0xc0010000; boot -g 0xc0010000

4.2.3 NFS mounted root filesystem


The LTIB filesystem image is location in the ./ltib/rootfs directory. If you are going to use NFS for mounting your root filesystem, you can setup your Linux command line to use the root filesystem area as follows. Be sure to change the IP addresses and paths to suitable values for your environment. setenv cmdline console=ttyAM1,115200n81 rw root=/dev/nfs nfsroot=192.168.1.51:/home/usb10132/ltib/rootfs ip=dhcp

4.2.4 EXT2 mounted root filesystem


You can also partition a CF card with an EXT2 partition and install the root files there. The following Linux command line shows an example of how to use the Compact Flash card (first partition) for the root filesystem mount point. setenv cmdline console=ttyAM1,115200n81 rw root=/dev/hdc1 rootfstype=ext2 ip=dhcp

2008-2009 NXP Semiconductors. All rights reserved.

14

NXP Linux 2.6 LH7A40x BSP

5 Additional information
5.1 Getting the BSP files
5.1.1 Where to get the Linux Apex and kernel patches
A comprehensive patch that contains all the necessary support and updates to the 2.6.29.6 kernel can be downloaded from NXPs website.

5.1.2 LTIB and GCC toolchain compatibility and dependency issues


LTIB and the pre-built GCC toolchain have been tested on a Fedora Core 9 and 10 and Ubuntu Linux systems. Although they should run fine on modern Linux distributions, it is not possible to test it with every Linux distribution and version. Per field and customer tests, other non-Fedora Linux distributions seem to work fine. Some older versions of Fedora had issues running the pre-built toolchain.

5.1.3 Known issues


The USB gadget driver is not functional. USB host works fine.

5.1.4 TFTP and NFS help


There is a lot of great information on the internet for setting up a tftp sor NFS server. The general steps required to get them going are explained here.

5.1.4.1 Setting up a tftp server


As a general setup procedure, a tftp server is setup by editing the flags and values in the /etc/xinit.d/tftp file. Several import flags are shown below: disable = no server_args = -s /tftpboot/ Make sure the disable flag is set to no or your tftp service wont be enabled. Also set the server_args value with the directory where your files are located when a tftp request occurs. In this specific setup, the /tftpboot directory is used to store files for the tftp server. If a tftp client requests a path/file, the path/file needs to be located or linked here . When the target board powers up, it will request the kernel image file uImage from the host via tftp if tftp kernel boot is setup on the target. If uImage is not located or linked in /tftpboot, the transfer will fail. If tftp continues to fail, verify that your tftp service is running on the host machine.

2008-2009 NXP Semiconductors. All rights reserved.

15

NXP Linux 2.6 LH7A40x BSP

5.1.4.2 Setting up an NFS server


As a general setup procedure, the /etc/exports file needs to be edited to add the root filesystem directory for NFS. The change will appear similar to the entry below: <ROOTFS-PATH> 192.168.1.* (rw,no_root_squash,no_subtree_check,sync) After the edits are made, you will need to restart the NFS server (or enable it if it is disabled). For example, if LTIB is installed in your home directory. The following entry would export your LTIB root filesystem to IP clients in the range of 192.168.1.*. /home/user/ltib/rootfs 192.168.1.* (rw,no_root_squash,no_subtree_check,sync)

5.1.5 ALSA device support


If your kernel image is setup for audio playback, you may need to setup the ALSA device nodes before ALSA will work correctly. Use the following steps from the kernel shell to setup the ALSA device nodes. [root@nxp /]# cat /proc/asound/devices 0: [ 0] : control 16: [ 0- 0]: digital audio playback 33: : timer [root@nxp /]# mkdir /dev/snd [root@nxp /]# cd /dev/snd [root@nxp snd]# mknod controlC0 b 116 0 [root@nxp snd]# mknod pcmC0D0p b 116 16 [root@nxp snd]# Note the device minor numbers for the control and digital audio playback nodes may differ on your system. When doing the mknod command, use the numbers that appear on your system.

5.1.6 Compact Flash (IDE) support


The device node for the Compact FLASH device may not already be statically built in the root filesystem. If the IDE device doesnt work on your system, do these steps to create the correct device nodes. [root@nxp snd]# cat /proc/devices Character devices: 1 mem 2 pty 3 ttyp 4 /dev/vc/0 4 tty 5 /dev/tty
2008-2009 NXP Semiconductors. All rights reserved.

16

NXP Linux 2.6 LH7A40x BSP 5 /dev/console 5 /dev/ptmx 7 vcs 10 misc 13 input 14 sound 29 fb 90 mtd 116 alsa 128 ptm 136 pts 180 usb 189 usb_device 204 ttyAM 254 usb_endpoint Block devices: 3 ide0 259 blkext 7 loop 22 ide1 31 mtdblock [root@nxp snd]#cd /dev [root@nxp snd]#mknod hdc b 22 0 [root@nxp snd]#mknod hdc1 b 22 1 [root@nxp snd]#mknod hdc2 b 22 2

5.1.7 Other links


Other related links are shown below. The LH7A400 and LH7A404 Common Driver Library (CDL) can be found at http://www.standardics.nxp.com/support/documents/microcontrollers/zip/code.package.l h7a400.sdk7a400.zip and http://www.standardics.nxp.com/support/documents/microcontrollers/zip/code.package.l h7a404.sdk7a404.zip. These packages provide a generic set of reference drivers, startup code, and examples for the LPD7A40x Socs and supported boards. More information about the Logic PD LPD7A40x boards can be found at http://www.logicpd.com/. The NXP standard ICs website is a good resource to get Users Manuals, training materials, or other information. http://www.standardics.nxp.com/ Link to the LTIB project at savannah.org
2008-2009 NXP Semiconductors. All rights reserved.

17

NXP Linux 2.6 LH7A40x BSP https://savannah.nongnu.org/projects/ltib Link to the GPP used for the LTIB package pool http://www.bitshrine.org/

2008-2009 NXP Semiconductors. All rights reserved.

18

You might also like