LPC3250 – Getting Started with Linux Copyright 2009 © Embedded Artists AB Getting Started With Linux on the LPC3250 OEM Board
Getting Started With Linux on the LPC3250 OEM Board Page 2 Embedded Artists AB Södra Promenaden 51 SE-211 38 Malmö Sweden info@EmbeddedArtists.com http://www.EmbeddedArtists.com Copyright 2009 © Embedded Artists AB. All rights reserved.
Getting Started With Linux on the LPC3250 OEM Board Page 3 Table of Contents 1 Introduction ........................................................... 5 1.1 Organization of this Document ..................................................... 5 1.2 Conventions in This Book ............................................................. 5 2 Getting Started ...................................................... 6 2.1 Introduction ............................................................................
Getting Started With Linux on the LPC3250 OEM Board Page 4 4.3.5 Root File System in NAND Flash ................................................ 29 4.3.6 Root File System on MMC/SD Card ............................................ 30 4.4 Use DHCP...................................................................................... 32 4.5 Known Problems .......................................................................... 32 4.5.1 Unable to Access USB Memory Stick ............................
Getting Started With Linux on the LPC3250 OEM Board Page 5 1 Introduction This document provides you with step-by-step instructions to get Linux up-and-running on the LPC3250 OEM Board / LPC3250 Developer’s Kit. The instructions cover everything from building the bootloader, kernel, root file system to transfer the built software to the target board. Additional documentation you might need is. • LPC3250 OEM Board User’s Manual – This document is available for download at Embedded Artists support site.
Getting Started With Linux on the LPC3250 OEM Board Page 6 2 Getting Started 2.1 Introduction This chapter describes how you get-up-and running with prebuilt images of the u-boot, Linux kernel and root file system. Necessary images can be downloaded from Embedded Artists support site or you can follow the instructions in chapter 3 to build the images yourself. • u-boot.bin – The Universal Bootloader, known as u-boot for short. • uImage – The Linux kernel image. • rootfs.
Page 7 Getting Started With Linux on the LPC3250 OEM Board 4 3 5 Figure 1 Top Part of the QVGA Base Board Figure 2 S1L Bootloader Console 2.3 Load the u-boot From MMC/SD Card In this section you will load the u-boot from the memory card and store it in the NAND flash on the target board. Make sure you have followed the instructions in section 2.2 and that you have output in your terminal application similar to the output shown in Figure 2. If you don’t have access to an MMC/SD card go to section 2.
Getting Started With Linux on the LPC3250 OEM Board Page 8 4. Set the boot delay to 2 seconds (the system prompt must be set at the same time). EA3250> prompt EA3250> 2 2.4 Load the u-boot From UART In this section you will load the u-boot from UART and store it in the NAND flash on the target board. Make sure you have followed the instructions in section 2.2 and that you have output in your terminal application similar to the output shown in Figure 2. 1.
Getting Started With Linux on the LPC3250 OEM Board Page 9 Figure 3 Send File via Tera Term Figure 4 Transfer progress in Tera Term 2.5 Boot the u-boot The u-boot has been loaded to the target and saved in the NAND flash. It is now time to boot and setup the u-boot. 1. Issue the boot command to start u-boot. EA3250> boot 2. The u-boot will now start and you will see something similar to the output below. Hit any key to stop the u-boot from auto booting. U-Boot 2009.
Page 10 Getting Started With Linux on the LPC3250 OEM Board *** Warning - bad CRC or NAND, using default environment In: serial Out: serial Err: serial Hit any key to stop autoboot: uboot> 0 3. There is no need to worry about the warning message. It just means that the u-boot environment hasn’t been saved to persistent storage (NAND flash). 4. Enter print in the u-boot console to see the u-boot environment. Only a portion of the variables are displayed below. uboot> print bootargs= bootcmd=run mtdboot .
Getting Started With Linux on the LPC3250 OEM Board Page 11 NAND write: device 0 offset 0x500000, size 0x400000 4194304 bytes written: OK 2. When the root file system has been stored in NAND Flash it is time to load and boot the Linux kernel. A variable named mtdboot is available in the default environment. This variable will setup the boot arguments to use a root file system in NAND flash (in an MTD partition), load the kernel and then boot it.
Getting Started With Linux on the LPC3250 OEM Board Page 12 sd 0:0:0:0: [sda] Write Protect is off sd 0:0:0:0: [sda] Assuming drive cache: write through sda: sda1 sd 0:0:0:0: [sda] Attached SCSI removable disk scsi 0:0:0:1: CD-ROM SanDisk Cruzer 8.02 PQ: 0 ANSI: 0 mount: mounting usbfs on /proc/bus/usb failed: No such file or directory Starting syslogd and klogd Running sysctl Setting up networking on loopback device: Setting up networking on eth0: /etc/rc.d/init.
Getting Started With Linux on the LPC3250 OEM Board Page 13 3 Using the Linux Target Image Builder 3.1 Introduction The Linux Target Image Builder (LTIB) system will be used to build the u-boot, Linux kernel and root file system. LTIB ease the build and deployment process of several components needed in a Linux system. Besides the bootloader and kernel a lot of needed utilities, modules and libraries are included and will be configured and built automatically by LTIB.
Getting Started With Linux on the LPC3250 OEM Board Page 14 Figure 5 Fedora Login Screen 3.2.2 Customize Fedora and Setup a New User 1. By default the keyboard layout is a US Layout. If you have a different keyboard layout change it like this: a. Go to the System Preferences Keyboard menu. b. Click on the Layouts tab. c. Click the “Add” button. d. Select your keyboard layout (country) and click the “Add” button. e. Select which layout to be the default layout.
Getting Started With Linux on the LPC3250 OEM Board Page 15 c. Give a new password to the user “user” by using the passwd command. Select the password of your choice (a password you will remember). $ sudo passwd user 3. Now we also need to give administrator rights to this user and also prepare rights needed by LTIB. a. Start the visudo tool to edit the sudoers file (where rules are specified). $ sudo visudo b. The sudoers file will be opened. Locate the lines that looks like below.
Getting Started With Linux on the LPC3250 OEM Board Page 16 Please note that we don’t display the output and progress of an installation of a package in the instructions below. You will, for example, be asked if it is ok to download a package. Answer ‘y’ on these questions. 1. Install a CVS client in order to checkout LTIB files. $ sudo yum install cvs 2. LTIB is using Perl and need some Perl related modules. $ sudo yum install perl-libwww-perl $ sudo yum install perl-ExtUtils-MakeMaker 3.
Getting Started With Linux on the LPC3250 OEM Board Page 17 $ sudo /etc/init.d/iptables stop $ sudo /etc/init.d/ip6tables stop 7. You also need to configure SELinux. a. Go to System Administration SELinux Management. b. Enter “bagside” as password. c. Select “Process Domain” and type tftp in the filter box and press Enter. d. Select the tftpd and then click on the “Permissive” button. 8.
Getting Started With Linux on the LPC3250 OEM Board 3.3.1 Page 18 Download and Start the VMware Appliance 1. Download Ubuntu 9.04 as a VMware appliance from http://chrysaor.info/?page=ubuntu. When writing this document it was packed in a tar-gz compressed file named ubuntu904desktop.tgz. 2. You can use 7-Zip to unpack the file. This utility can be downloaded from http://www.7zip.org. 3. In order to use the VMware appliance you need to install VMware Player. Download it from http://www.vmware.
Getting Started With Linux on the LPC3250 OEM Board Page 19 a. Go to the System Preferences Keyboard menu. b. Click on the Layouts tab. c. Click the “Add” button. d. Select your keyboard layout (country) and click the “Add” button. e. Select which layout to be the default layout. You can also remove the layouts you don’t intend to use. f. Click the “Close” button. 2. A user with name “user” has already been added to the system which means that we don’t have to add this user as was done in section 3.
Page 20 Getting Started With Linux on the LPC3250 OEM Board c. Right-click again on the Terminal and select “Add this launcher to desktop”. 6. Change screen resolution. The default resolution is quite low. Change it like this: a. Go to System Preferences Display. b. Select the Resolution you want. c. Click the Apply button. 3.3.3 Install Necessary Packages LTIB will require a number of packages to be installed in your Linux distribution before you can actually use LTIB.
Getting Started With Linux on the LPC3250 OEM Board Page 21 5. The TFTP server is now ready to be used. 3.3.5 Setup an NFS Server An NFS (network file system) mounted root file system is quite convenient to use during development of a Linux system. The actual root file system will then be located on the development computer and not on the target board, but the target board gets access to the file system using the NFS protocol. 1. Install the NFS server.
Getting Started With Linux on the LPC3250 OEM Board Page 22 Figure 8 LTIB Platform Selections Menu 10. In the “platform choice” menu select “Embedded Artists LPC3250 OEM Board with the NXP LPC32XX SoC”. Figure 9 LTIB Platform Choice Menu 11. Click the “Exit” button. 12. Select “Yes” when asked to save the configuration. 13. A new configuration menu will appear, see Figure 10. For now just click the Exit button and go with the default configuration.
Getting Started With Linux on the LPC3250 OEM Board Page 23 Figure 10 LTIB Platform Configuration Menu 14. Select “Yes” when asked to save the configuration. LTIB will now download necessary packages, build u-boot, build the Linux kernel and create a root file system. 15. If everything builds successfully you will have something similar to the example below in your terminal.
Getting Started With Linux on the LPC3250 OEM Board Page 24 19. Copy the images to the /home/user directory ensuring that they are accessible by the TFTP server. $ cp /home/user/ltib/rootfs/boot/uImage /home/user $ cp /home/user/ltib/rootfs/boot/u-boot.bin /home/user $ cp /home/user/ltib/rootfs.jffs2 /home/user 20. To be able to use the touch screen the device table file must be altered. By default this file does not enable the input/eventX device files.
Getting Started With Linux on the LPC3250 OEM Board 3.6 Page 25 Useful Linux Commands 3.6.1 Obtain IP Address The IP address of your Linux host can be obtained by using the ifconfig command. $ sudo ifconfig 3.7 eth1 Link encap:Ethernet HWaddr 00:0c:29:40:d2:db inet addr:192.168.5.58 Bcast:192.168.5.255 Mask:255.255.255.
Getting Started With Linux on the LPC3250 OEM Board Page 26 4 Universal Boot Loader - u-boot 4.1 Introduction The Universal Boot Loader also known as Das U-boot or u-boot for short is an open-source boot loader that supports a wide range of different architectures such as ARM, PowerPC, XScale, x86, MIPS, Coldfire, 68k, and MicroBlaze. Many board configurations have been made available, for each architecture, by an active community.
Getting Started With Linux on the LPC3250 OEM Board Page 27 run – execute the commands found in an environment variable. • Below are examples of the commands described above. uboot> setenv serverip 192.168.0.110 uboot> saveenv uboot> run mtdboot 4.2.2 Network Related Variables The u-boot environment contains a number of variables that are network related, i.e., related to communication over a network. Make sure these variables are correctly setup for your network.
Getting Started With Linux on the LPC3250 OEM Board Page 28 loadkernel_usb=usb start; fatload usb 0 $(loadaddr) uImage; usb stop 1. First the USB interface must be initialized with the usb start command. 2. Using the fatload command the kernel image (uImage) is then loaded via the USB interface, device 0 and to the load address specified by the loadaddr variable. 3. The final step is to stop the USB interface.
Getting Started With Linux on the LPC3250 OEM Board Page 29 In the default environment there is a variable named loadkernel_nand which illustrates how to load the kernel from NAND flash. loadkernel_nand=nboot.jffs2 $(loadaddr) 0x0 $(nand_kernel_off) 1. The nboot command is used to load the kernel from NAND device 0x0 and offset nand_kernel_off to SDRAM at address loadaddr.
Page 30 Getting Started With Linux on the LPC3250 OEM Board 3. The update_fs variable has been setup to update the NAND flash with the root file system. First the loadrootfs variable will be used to load the root file system to SDRAM. Then the NAND flash will be erased at the offset specified by nand_rootfs_off and size specified by nand_rootfs_sz. The last step is to write the file system to the NAND flash. update_fs=run loadrootfs; nand erase $(nand_rootfs_off) $(nand_rootfs_sz); nand write.
Getting Started With Linux on the LPC3250 OEM Board Page 31 $ sudo umount /dev/sde1 4. Run fdisk to edit the partition table on the memory card. $ sudo fdisk /dev/sde1 5. List the existing partition table using the p option. Command (m for help): p 6. Use the d option to delete all partitions on the memory card. 7. Create a new partition using the n option. 8. Select p to create a primary partition. 9. Select 1 for partition number. 10.
Getting Started With Linux on the LPC3250 OEM Board 4.4 Page 32 Use DHCP If you don’t want to or are able to assign a static IP address to the target board you can instead use dynamically assigned IP addresses by using the DHCP protocol. Please note that a DHCP server must be available on your network. In the u-boot you need to exchange the tftpboot command for the dhcp command to load the images using DHCP.
Page 33 Getting Started With Linux on the LPC3250 OEM Board 5 Peripherals and Drivers 5.1 Introduction This chapter describes some of the peripherals on the LPC3250 OEM Board, their drivers and how to use the peripherals from within Linux. 5.2 Display 5.2.1 Hardware A 3.2 inch QVGA color TFT LCD display is mounted on the QVGA Base Board together with a Solomon Systech SSD1289 LCD controller. The SSD1289 is attached to the SPI bus.
Page 34 Getting Started With Linux on the LPC3250 OEM Board 3. The LTIB configuration menu will appear, see Figure 10. Go to the “Package List” option and hit the Enter key (or click Select button). 4. You will now see a long list of packages. Scroll down to the option called fbv and press Spacebar on your keyboard to select the package. 5. Click the Exit button. 6. Click the Exit button. 7. Select “Yes” when asked to save the configuration. 8.
Page 35 Getting Started With Linux on the LPC3250 OEM Board 5.3.3 Usage These instructions show how to use the touch screen through the tslib library. Tslib is an abstraction layer for touch screen panel events, as well as a filter stack for the manipulation of those events, for more information visit the tslib website: http://tslib.berlios.de/. 1. The /dev/input/event0 device node must be available. If it isn’t it can be created by using the mknod utility. # mknod /dev/input/event0 c 13 64 2.
Getting Started With Linux on the LPC3250 OEM Board Page 36 TX packets:1131 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2829202 (2.6 MiB) TX bytes:190332 (185.8 KiB) Interrupt:29 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.
Page 37 Getting Started With Linux on the LPC3250 OEM Board 5.5 Memory Card 5.5.1 Hardware The LPC3250 has a Secure Digital (SD) interface that conforms to the SD Memory Card Specification Version 1.01. The MMC/SD card interface on the LCP3250 is compatible with the ARM PrimeCell MMCI PL180/1. 5.5.2 Device Driver and Configuration The driver for the LPC3250 MMC/SD card interface is located here in the source tree: /drivers/mmc/host/mmci.c.
Page 38 Getting Started With Linux on the LPC3250 OEM Board usb 1-1: new full speed USB device using usb-ohci and address 2 usb 1-1: configuration #1 chosen from 1 choice scsi0 : SCSI emulation for USB Mass Storage devices scsi 0:0:0:0: Direct-Access SanDisk Cruzer 8.
Getting Started With Linux on the LPC3250 OEM Board Page 39 input0 This file reflects the state of the device pins (inputs 0 to 7). Writing to this file will have no effect. input1 This file reflects the state of the device pins (inputs 8 to 15). Writing to this file will have no effect. ls0 LED select 0 controls LED (output pin) 0 – 3. ls1 LED select 1 controls LED (output pin) 4 – 7. ls2 LED select 2 controls LED (output pin) 8 – 11. ls3 LED select 3 controls LED (output pin) 12 – 15.
Page 40 Getting Started With Linux on the LPC3250 OEM Board The LPC3250 microcontroller has two NAND Flash controllers, one multi-level controller (MLC) and one single level controller (SLC). 5.8.2 Device Driver and Configuration The driver for the LPC3250 SLC NAND driver is located here in the source tree: /drivers/mtd/nand/lpc32xx_nand.c. The NAND MTD partitions are setup in the board specific file (/arch/arm/machlpc32xx/board-ea3250.c) and have the following layout.