Sei sulla pagina 1di 17

NXP Linux 2.

6 LPC32X0 BSP

NXP LPC32XX Linux 2.6 BSP instructions Installation, building, and deploying Linux on the LPC32x0 MCU

2006-2007 NXP Semiconductors. All rights reserved.

NXP Linux 2.6 LPC32X0 BSP

Table of contents
1 Introduction......................................................................................................................................... 4 1.1 1.2 1.3 2 Copyrights and limitations .......................................................................................................... 4 Host system requirements............................................................................................................ 4 About this document .................................................................................................................... 4

BSP overview....................................................................................................................................... 5 2.1 Supported hardware .................................................................................................................... 5

2.2 BSP information .......................................................................................................................... 5 2.2.1 LTIB integration ..................................................................................................................... 5 2.2.2 UBOOT .................................................................................................................................. 5 2.2.3 Linux....................................................................................................................................... 5 3 Preparing your host machine............................................................................................................. 8 3.1 3.2 4 Downloading and installing LTIB ............................................................................................... 8 Downloading and installing the LPC32X0 Linux BSP................................................................ 8

Building Linux..................................................................................................................................... 9 4.1 Start LTIB to start the build process ........................................................................................... 9

4.2 Configuring LTIB for building Linux for the Phytec 3250 board................................................ 9 4.2.1 Tool chain options ................................................................................................................ 10 4.2.2 Boot loader choice ................................................................................................................ 10 4.2.3 Linux kernel revision choice and options ............................................................................. 10 4.2.4 Root filesystem package list selection .................................................................................. 11 4.2.5 Target system configuration ................................................................................................. 11 4.2.6 Target image generation ....................................................................................................... 11 4.3 4.4 4.5 5 Selecting Linux kernel configuration options ............................................................................ 11 The root filesystem..................................................................................................................... 11 Re-building the system............................................................................................................... 12

Deploying Linux ................................................................................................................................ 13 5.1 Phytec 3250 board setup ........................................................................................................... 13

5.2 Setting up the Phytec 3250 board to execute u-boot ................................................................. 13 5.2.1 Setting up u-boot to boot from an SD card ........................................................................... 13 5.2.2 Setting up u-boot to boot from an NAND FLASH............................................................... 13 5.3 Loading and starting the Linux kernel from u-boot................................................................... 14 5.3.1 Booting the Linux kernel over the network .......................................................................... 14 5.3.2 Setting up NFS...................................................................................................................... 14 6 Issues and notes ................................................................................................................................. 16 6.1 6.2 Pre-built configuration for an NFS based system ..................................................................... 16 SD card support and device nodes ............................................................................................ 16

2006-2007 NXP Semiconductors. All rights reserved.

NXP Linux 2.6 LPC32X0 BSP


6.3 6.4 Mounting the /proc file system .................................................................................................. 16 Sample u-boot environment setup for automatic boot ............................................................... 16

2006-2007 NXP Semiconductors. All rights reserved.

NXP Linux 2.6 LPC32X0 BSP

1 Introduction
This document covers the Linux 2.6.25 BSP for the LPC32X0 MCU. This free BSP has been developed to support the LPC32X0 MCU from NXP. The BSP provides an initial port for the Phytec PHY3250 platform using the LPC3250 MCU, but can be easily ported to other platforms. The document explains the host system requirements, installation instructions, build procedure, and deployment options for the BSP.

1.1 Copyrights and limitations


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

1.2 Host system requirements


To develop Linux for the LPC32X0, 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 Linux release. Although other releases may work fine, they are currently untested.

1.3 About this document


The intended use of this document is to provide initial help in developing a Linux operating system for the LPC32X0 MCU. The steps required to download the BSP all the way to deploying Linux to the Phytec PHY3250 board are covered. This document is broken into the following sections: BSP overview Preparing your host machine (LTIB, BSP download and installation) Building the boot loader and the Linux system Deploying Linux Issues and notes

2006-2007 NXP Semiconductors. All rights reserved.

NXP Linux 2.6 LPC32X0 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.25.

2.1 Supported hardware


This BSP supports the NXP LPC32X0 MCU and the PHY3250 board. The PHY3250 board includes the Stage 1 Loader (S1L), which is used to initialize the board and kickstart uboot (the Linux booatloader).

2.2 BSP information


This BSP provides basic drivers for some of the LPC32X0 peripherals and the Phytec PHY3250 interfaces. Although the drivers may work in a specific application, they may require additional work or modifications in a production system.

2.2.1 LTIB integration


This BSP integrates with LTIB. LTIB provides a environment that allows easy setup and configuration of the boot loader, Linux kernel configuration, deployment methods, build tools, etc. LTIB is similar to BUILDROOT, but provides more overall system coverage options and is better maintained. Releasing the BSP with LTIB integration allows a smaller BSP image to be released and makes future support and changes easier to maintain.

2.2.2 UBOOT
Uboot is the Linux bootloader supported by this BSP. UBOOT provides support for booting the Linux kernel through Ethernet or from NAND FLASH. Uboot relies on the Stage 1 Loader (S1L) to pre-initialize the board and memory prior to executing. See the phy32xx_bl.pdf file included with the LPC32X0 BSP for more information on S1L. Once S1L has initialized the board, it will load and start Uboot from one of the supported S1L boot sources. Although Uboot relies on S1L for system preinitialization, the pre-initialization code is available for free from NXPs website and can be easily added to the startup code of the Uboot source, The PHY3250 version of Uboot supports the following features: Persistent configuration of Uboot and boot parameters Kernel image boot from NAND FLASH or Ethernet Ethernet network configuration

2.2.3 Linux
This section describes the system and driver support included with the PHY3250 Linux 2.6.25 BSP.
2006-2007 NXP Semiconductors. All rights reserved.

NXP Linux 2.6 LPC32X0 BSP

2.2.3.1 Architecture and board support


The following LPC32X0 peripherals are supported as part of the core system architecture: Timer 0 (system tick) Interrupt controller Clock and power manager (Clock query and control for various drivers) Standard UARTs (up to 4) The following support is provided for the PHY3250 board: MMC card detect LCD backlight control and QVGA LCD configuration

2.2.3.2 LPC32X0 driver support


The following Linux drivers are provided as part of the BSP: Watchdog timer (modified PNX4008 driver) Color LCD controller (AMBA CLCD driver) SD card controller (modified AMBA driver MMC driver with DMA) Ethernet controller Touchscreen controller Battery backed RTC

2.2.3.3 Important driver notes


As this is a beta release, the drivers may be missing functionality or may not be complete. Currently, issues exist for the following drivers: Ethernet driver Link status and detection do not currently work. If using Ethernet, connect the PHY3250 board to a 100MBPS switch with a full-duplex connection. If a different connection type is required, the driver will need to be slightly modified. Do not removed the Ethernet cable during use as the cable insertion/removal detection does not work. These issues will be fixed in a later driver release. Note the Ethernet driver currently uses a fixed MAC address defined in the Ethernet driver. If running more than 1 board on a network, this address should be set as a unique value on each board. Touchscreen controller driver This driver is completely untested. Battery backed RTC driver Currently, time is not persistent across power and reset cycles. Initial board time may not be set correctly. SD card controller driver
2006-2007 NXP Semiconductors. All rights reserved.

NXP Linux 2.6 LPC32X0 BSP The DMA portion of the driver is built into the driver. This quick and dirty fix allows SD card functionality to work, but doesnt follow the DMA driver conventions. This will be fixed in a later driver release. As of this release, write protect is not supported.

2006-2007 NXP Semiconductors. All rights reserved.

NXP Linux 2.6 LPC32X0 BSP

3 Preparing your host machine


This section explains how to setup your host machine to build the PHY3250 Linux operating system. It assumes that a suitable Linux host machine is already available with a compatible version of the Linux operating system running on it. The tools and the BSP have only been tested with Fedora 9.

3.1 Downloading and installing LTIB


LTIB (Linux Target Image Builder) is the tool used to build and deploy the LPC32X0 BSP to the PHY3250 board. Download and install the LTIB package. As of this document, the latest version of the package (ltib-8-1-2a) can be found at http://www.bitshrine.org/#ref_4. The tarred and zipped package should be unzipped and untarred in your home directory. Installation of LTIB should be followed as per the instructions on the www.bitshrine.org website. The LPC32X0 BSP is installed after the LTIB packages have been installed from the web. This means that LTIB must be executed once to install the host packages, but prior to perform a Linux system build. 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. Press ctrl-c here without selecting a platform to return to the shell prompt. You may need to close your shell and reopen a new one before proceeding to the next step.

3.2 Downloading and installing the LPC32X0 Linux BSP


Currently, the BSP is not provided on the NXP website and must be requested through the NXP field and sales staff. A full-featured downloadable version of the Linux BSP will be available soon. The BSP is provided as a tarred and zipped file that contains the cross platform tools and LTIB patch file. Installation of the tools and the patch file requires several sub-steps as detailed in the instructions below. Before installing the LTIB patches, LTIB must be installed as per the previous instructions! Unzip and Untar the BSP in a safe directory. The untarred/unzipped BSP will have a directory structure that appears similar to the following: gcc-3.4.5-glibc-2.3.6 ltib-8.1.2a-lpc3250-patch Using a root account, copy the gcc-3.4.5-glibc-2.3.6 directory to the /opt/ directory. Although these tools can be placed anywhere, this path is used later when selecting the cross build tool chain when configuring the build environment.
2006-2007 NXP Semiconductors. All rights reserved.

NXP Linux 2.6 LPC32X0 BSP cp r <path>/gcc-3.4.5-glibc-2.3.6 /opt To patch LTIB, open a shell and switch to the ltib-8-1-2-sv directory. Make sure you are on your user level account. Issue the following command to install the patch: patch p1 < ltib-8.1.2a-lpc3250-patch After patching, switch to the ltib-8-1-2-sv/config/platform directory and make sure the phy3250 directory and its associated files are all owned by the user account. If they are not owned by the user, then switch to the root user and issue the chown command to change the file permissions to the correct user ID. Also make sure the main.lkc in the ltib8-1-2-sv/config directory is owned by the user. At this point, the installation is complete. Proceed to the next step.

4 Building Linux
This section explains the steps necessary to build the boot loader (u-boot), the Linux kernel image, and the root file system. If all the steps in the previous sections occurred without errors, the images should build without and problems. Depending on what you want in your kernel image and how the image and root filesystem are deployed, some changes may be necessary in the configuration of the build.

4.1 Start LTIB to start the build process


To start the build process, enter the ltib command inside the ltib-8-1-2-sv directory. This command should not be issued with the root user account. After a few seconds, a selection menu will appear that will allow you to select the system for which you want to develop Linux. At tthis menu, select the Phytec PHY3250 board (LPC32X0) and then select the EXIT menu item. If asked to save the configuration, select YES. After a few more seconds, another larger menu (titled LTIB: NXP LPX3250 on the Phytec board) will appear customized to the LPC3250 and Phytec PHY3250 platform. This menu is used to setup the tool chain, which packages and images need to be built, and how the file system will be deployed. Options for this menu are explained in the next section.

4.2 Configuring LTIB for building Linux for the Phytec 3250 board
After selection of the system type for LTIB, the LTIB system configuration menu will appear. This menu allows setting up the following options: Tool chain options Boot loader choice Linux kernel revision choice and options Root filesystem package list selection Target system configuration
2006-2007 NXP Semiconductors. All rights reserved.

NXP Linux 2.6 LPC32X0 BSP Target image generation (deployment)

The LTIB configuration menu is usually shown only once on the first configuration, After the first build, the menu can be manually displayed by using the config option when invoking ltib. Before exiting this menu, go through the following sections to setup the LTIB configuration. After all options are setup, select EXIT from the menu and save the configuration. The build process will now start and can take up to several hours to complete. If the Linux kernel is being configured for the first time, the Linux kernel configuration menu will eventually appear to allow the kernel configuration options to be setup.

4.2.1 Tool chain options


A pre-built version of GCC 3.4.5 and GLIB 2.3.6 (with soft-float only) are provided with this BSP. In previous steps, the tool chain was installed in the /opt directory. Verify that the installed toolchain is selected and configured for LTIB by making sure the following parameters are setup correctly: Target C library type -> Select glibc C Library package -> from toolchain only Toolchain component options -> <Varies based on Linux configuration> Choose your toolchain -> custom Supply your toolchain path -> o /opt/gcc-3.4.5-glibc-2.3.6/arm-linux-gnu Enter your cross tools prefix -> arm-linux-gnu Enter any flags for gcc/g++ -> -O2 fsigned-char msoft-float

4.2.2 Boot loader choice


Only 1 boot loader choice is available. Make sure the u-boot-1.3.3 bootloader option is selected.

4.2.3 Linux kernel revision choice and options


Linux kernel selection is made with the kernel option. If you dont want to built the Linux kernel, select the Dont build the Linux kernel option. If you have your own kernel revision you want to build, select the Local Linux directory build option and enter the kernel path. If you use this option, you will be required to manually patch the Linux kernel with the Linux patch file for the LPC32X0 MCU. The LPC32X0 Linux patch has only been tested with the 2.6.25 kernel source. Select the Linux 2.6.25 for LPC3250/Phytec 3250 to use the Linux 2.6.25 kernel with the LPC32X0 kernel patch.
2006-2007 NXP Semiconductors. All rights reserved.

10

NXP Linux 2.6 LPC32X0 BSP If you are doing repeated builds of the Linux kernel, make sure the Always rebuild the kernel option is selected. This will force LTIB to make the kernel on each execution instead of just the first time. Note that only the changed files of the kernel will be built. The Configure the kernel option can be selected to enable the Linux kernel configuration menu. After the kernel has been successfully built, this option will automatically disable itself, so it will need to be manually selected of the kernel configuration is being frequently modified.

4.2.4 Root filesystem package list selection


The Package selection/Package list - - -> option allows selecting the package list that makes up the root file system. Select the packages you want for your Linux system (such as Busybox).

4.2.5 Target system configuration


The Target system configuration option selects how the Linux system will startup. Select options as needed for your system configuration.

4.2.6 Target image generation


The Target image generation option selects how the root filesystem is deployed. Options for NFS, cramfs, or EXT2 based drives (such as SD/MMC) can be selected. As of this release, only the NFS option has been tested.

4.3 Selecting Linux kernel configuration options


After LTIB has been configured from its menu, the system will start building and the kernel configuration menu will eventually appear (if the kernel is being built). This menu usually only appears once but can be manually selected to appear in the LTIB configuration menu. The task of selecting options to build a Linux kernel image is beyond the scope of this document. An example configuration is provided with the BSP that will be loaded automatically on the first kernel configuration. This configuration selects the correct MCU and platform as well as various drivers and kernel support options to make a working NFS mountable file system image with console support on UART 5.

4.4 The root filesystem


An image of the root file system will be placed in the ./ltib-8-1-2-sv/rootfs directory. Most files in this area will be automatically updated when a build or re-build is performed. The Linux u-boot (u-boot.bin) and kernel (uImage) images can be found in the boot directory in the root file system.

2006-2007 NXP Semiconductors. All rights reserved.

11

NXP Linux 2.6 LPC32X0 BSP

4.5 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).

2006-2007 NXP Semiconductors. All rights reserved.

12

NXP Linux 2.6 LPC32X0 BSP

5 Deploying Linux
This section covers the deployment of Linux to the board.

5.1 Phytec 3250 board setup


To prepare the Phytec 3250 board for Linux, an SD card is needed. Currently, only the networked kernel image and root file system deployment methods are explained in this section, although all the deployment methods should work.

5.2 Setting up the Phytec 3250 board to execute u-boot


5.2.1 Setting up u-boot to boot from an SD card
To boot the u-boot from an SD card, copy the u-boot.bin file generated for your design into the root directory of an SD card. Insert the SD card into the board SD card slot. Power up or reset the board and press any key to get to the S1L prompt. At the prompt, type the following commands to setup for SD card boot. Aboot blk u-boot.bin raw 0x83fc0000 Prompt PHY3250> 1 The next time the board is powered up or reset, u-boot will attempt to load and execute from the SD card after a 1 second delay.

5.2.2 Setting up u-boot to boot from an NAND FLASH


To boot the u-boot from NAND FLASH, copy the u-boot.bin file generated for your design into the root directory of an SD card. Insert the SD card into the board SD card slot. Power up or reset the board and press any key to get to the S1L prompt. At the prompt, type the following commands to setup for SD card boot. load blk u-boot.bin raw 0x83fc0000 nsave aboot flash raw 0x83fc0000 Prompt PHY3250> 1 The next time the board is powered up or reset, u-boot will attempt to load and execute from the NAND FLASH after a 1 second delay. S1L manages where in FLASH the u-boot.bin image is saved to and loaded from. Once programmed into FLASH, the SD card isnt needed to boot u-boot and can be removed. If the SD card is not working for any reason, the u-boot-bin image can be sent to S1L using a terminal program. Use the command load term raw 0x83fc0000 to start S1L waiting for the transfer and use Send binary file on the terminal side to send the binary
2006-2007 NXP Semiconductors. All rights reserved.

13

NXP Linux 2.6 LPC32X0 BSP data to S1L. Be careful not to press any extra keys before or after the transfer. Send a break sequence to the terminal to get back to the S1L prompt. The nsave, aboot, and prompt commands can then be used to setup execution of u-boot.

5.3 Loading and starting the Linux kernel from u-boot


Once u-boot has been setup to load and execute via S1L, reset or power up the board and wait for the u-boot header string (U-Boot 1.3.3). When the header string appears, press any key to get to the u-boot prompt.

5.3.1 Booting the Linux kernel over the network


To configure u-boot to boot the kernel image via tftp over the network, use the following commands: setenv gatewayip <your gateway IP address> setenv ipaddr <Desired IP address of this board> setenv bootfile uImage setenv bootdelay 2 setenv netmask <network mask value> setenv serverip <your TFTP server IP address> tftpboot 80100000 bootm This assumes the server machine is running a TFTP server and can serve the uImage file (kernel image file in the root filesystem boot directory). Values can be saved in memory in u-boot by using the saveenv command. The load sequence can be automated by setting up the bootcmd variable to the following value: Setenv bootcmd tftpboot 80100000; bootm The command line passed to the kernel can be changed by setting up the bootargs variable in u-boot. And example environment setup from TFTP boot is shown in Section 6.

5.3.2 Setting up NFS


To setup the NFS file system requires setting up the command line options for the kernel (from u-boot) to mount and use the root file system and setting up the host PC to allow the file system to be accessible to the system. Setting up the host system usually requires changes the /etc/exports file by adding the pathes and targets that will have access via NFS. NFS setup is beyond the scope of this document. Setting up the Phytec 3250 board to use an NFS mounted file system requires setting up the command line argument to use the /dev/nfs for the root directory. A sample command line argument is shown below (this will have to be changed for any specific machine). The command line is passed by u-boot to the kernel from the u-boot bootargs variable.
2006-2007 NXP Semiconductors. All rights reserved.

14

NXP Linux 2.6 LPC32X0 BSP

setenv bootargs console=ttyS0,115200n81 root=/dev/nfs rw nfsroot=192.168.1.51:/home/user/ltib/rootfs ip=dhcp init=/sbin/init This specific command line tells the kernel to use ttyS0 (UART 5) for the console at 115K-8-N-1 parameters, a read/write filesystem from /dev/nfs with nfsroot pointing to the root filesystem on a machine at IP address with the associated path. The Phytec board will get an IP address via DHCP and then initialize the program at /sbin/init (which will likely link to busybox). There are many variances for boot and mount options. Currently, only NFS has been tested.

2006-2007 NXP Semiconductors. All rights reserved.

15

NXP Linux 2.6 LPC32X0 BSP

6 Issues and notes


6.1 Pre-built configuration for an NFS based system
A pre-built template for Linux configuration is provided with the BSP for the following kernel configuration: LPC3250/PHY3250 system setup (timer, serial, clocks, etc.) Color LCD with frame buffer SD/MMC support Touchscren support Network support To use this template, replace the .config file (or add it if it doesnt exist) in the ./ltib-8-12-sv/rpm/BUILD/linux-2-6-25 with the linux-2.6.25-phy3250.config file. The file will need to be renamed to .config. The next time you run the

6.2 SD card support and device nodes


If using SD card support, you will need to add the device nodes to the root filesystem. These can be added with the following commands at the ./roofs directory: Mknod dev/mmcblk0 b 179 0 Mknod dev/mmcblk0p1 b 179 1 When a card is inserted, it can be mounted using the mount command: Mount /dev/mmcblkp1 <directory>

6.3 Mounting the /proc file system


The proc file system can be mounted with the following command: Mount t proc proc /proc (assumes a procdirectory exists in the root file system) Some commands require the proc file system to be operational at /proc.

6.4 Sample u-boot environment setup for automatic boot


The environment setup loads a file called uImage via TFTP from a server located at IP address 192.168.1.51. Its own IP address is 192.168.1.193. The file is loaded at address 0x80100000. After the file is loaded, the boot argument command line is setup for NFS boot and the bootm command is used to tell u-boot to start the kernel image. baudrate=115200 ethaddr=DE:AD:BE:EF:00:01 gatewayip=192.168.1.1 ipaddr=192.168.1.193 bootfile=uImage bootdelay=2
2006-2007 NXP Semiconductors. All rights reserved.

16

NXP Linux 2.6 LPC32X0 BSP consoledev=ttyS0,115200n81 gatewayip=192.168.1.1 netmask=255.255.255.0 ipaddr=192.168.1.193 serverip=192.168.1.51 bootargs=console=/dev/ttyS0,115200n8 noinitrd root=/dev/nfs rw nfsroot=192.168.1.51:/home/usb10132/dev/ltib/rootfs ip=dhcp fileaddr=80100000 netload=tftpboot 80100000; setenv bootargs $(netbootargs); bootm bootcmd=tftpboot 80100000; setenv bootargs $(netbootargs); bootm netbootargs=setenv bootargs console=ttyS0,115200n81 noinitrd root=/dev/nfs rw nfsroot=192.168.1.51:/home/usb10132/d ev/ltib/rootfs ip=dhcp stdin=serial stdout=serial stderr=serial

2006-2007 NXP Semiconductors. All rights reserved.

17

Potrebbero piacerti anche