background image

 

 

 

 

 

 

 

   

AN10476 

   

Getting started Linux with LPC3180 

   

Rev. 013 — 21 Dec 2006 

Application note

 

 

 

     

 

Document information 

Info 

Content 

Keywords 

Linux, ARM9, LPC3180 

Abstract 

This application note describes how to start Linux with Philips LPC3180 
MCU(ARM926EJ-S core), including how to setup the system and make 
small modifications and how to add user applications to the system. 

Summary of Contents for LPC3180

Page 1: ...note Document information Info Content Keywords Linux ARM9 LPC3180 Abstract This application note describes how to start Linux with Philips LPC3180 MCU ARM926EJ S core including how to setup the system and make small modifications and how to add user applications to the system ...

Page 2: ...sing LPC3180 Loader Add the method of modifying rootfs and creating new rootfs More explanation about NFS usage for application debugging 03 20061221 Support for Phytec LP3180 development board Contact information For additional information please visit http www semiconductors philips com For sales office addresses please send an email to sales addresses www semiconductors philips com 12NC Koninkl...

Page 3: ...es to make a connection over the serial command port to allow an external program to take over the boot process If this connection is not made the bootstrap code will start loading the code in block zero of the NAND flash This block contains the SIBL secondary boot loader that will initialize the main functions of the LPC3180 After initialization SIBL will continue scanning the NAND flash for imag...

Page 4: ... You can get the release 3 4 0 vfp directory which includes the arm linux xx tools Note If user would like to use new version compilers downloaded from internet please pay attention that the kernel and the libraries in the root file system must be built with the same compiler That means you must re compile not only the Linux kernel but also all libraries and executable files in the root file syste...

Page 5: ...nfig make make u boot axf This will give you the files u boot which you can run using the ARM Debugger or convert into a U Boot image i e must be one line tools mkimage A arm O u boot T Firmware C none a 81EC0000 e 81EC0000 n My U Boot v0 1 d u boot bin uboot_phytec ubt 3 3 Building kernel The Linux kernel patch can be found on src kernel directory Make sure the following environment variables are...

Page 6: ...modifications required in mnt_rootfs Below are the instructions on adding user application updating loadable modules and modifying network settings E g When we intend to add a new application program as hello see chapter 6 on how to develop such a new application just copy it to the mnt_rootfs bin directory then the program can be used as a command directly under Linux Shell cp apps hello mnt_root...

Page 7: ...sary library files executable files startup script files from original mounted mnt_rootfs by root_fs_arm ext2 phytec Be careful When the file size of root_fs_arm ext2 phytec gz is not aligned on word 4 bytes size you will have a problem when downloading the file using Realview debugger A work around is to enlarge the file with 1 byte with the command echo root_fs_arm ext2 phytec gz echo until the ...

Page 8: ...sor again press F10 F5 or using command in the Realview debugger go And in the serial terminal window type Phytec bootm 0x80600000 The Linux will start up and root file system will be mounted Boot reached stage 1 Booting image at 80600000 Boot reached stage 2 Boot reached stage 3 Image Name Linux 2 6 10 Image Type ARM Linux Kernel Image uncompressed Data Size 1176680 Bytes 1 1 MB Load Address 8000...

Page 9: ...0 SCSI subsystem initialized usbcore registered new driver usbfs usbcore registered new driver hub LPC3180 I2C 0 Master at 0xc0199780 irq 51 USB I2C 0 Master at 0xc0199980 irq 63 NetWinder Floating Point Emulator V0 97 double precision Serial 8250 16550 driver Revision 1 2 2 5 4 ports IRQ sharing disabled ttyS0 at MMIO 0x0 irq 9 is a 16550A ttyS1 at MMIO 0x0 irq 7 is a IP3106 ttyS2 at MMIO 0x0 irq...

Page 10: ...l8150 usbcore registered new driver usbnet drivers usb net pegasus c v0 5 12 2003 06 06 Pegasus Pegasus II USB Ether net driver usbcore registered new driver pegasus spi lpc3180 SPI Test Dec 14 2006 CS driver running on platform premo Found clock frequency for spi 1 is 104000000 initialising CS table Found clock frequency for spi 2 is 104000000 initialising CS table isp1301_generic 1 002d chiprev ...

Page 11: ...bit Scanning device for bad blocks Bad eraseblock 478 at 0x00778000 Bad eraseblock 1520 at 0x017c0000 Creating 1 MTD partitions on NAND 32MiB 1 8V 8 bit 0x01000000 0x01f00000 LPC3180 NAND PART 0 CSLIP code copyright 1989 Regents of the University of California PPP generic driver version 2 4 2 PPP Deflate Compression module registered PPP BSD Compression module registered mmc lpc3180 mmc sd driver ...

Page 12: ...ed_mode Then the connected USB devices e g a USB mass storage disk can be recognized by the board Linux system E g mount t auto dev sda1 mnt usbdisk If user wants to make the USB boot with host mode just add the above forcing command to the startup script file in rootfs The command can be executed before system start up The way the USB gadget system works has also been modified to allow you to cha...

Page 13: ...and the board Connect PC and the board using a network cable Set up the PC IP address as 192 168 0 1 The board IP address has been set as 192 168 0 2 by default We can test the connection by using Linux ping command ping 192 168 0 1 PING 192 168 0 1 192 168 0 1 56 data bytes 64 bytes from 192 168 0 1 icmp_seq 0 ttl 128 time 2 5 ms 64 bytes from 192 168 0 1 icmp_seq 1 ttl 128 time 0 8 ms 64 bytes f...

Page 14: ... Remark This function is not fully tested since my company s network doesn t allow a Linux OS machine 4 5 Mounting file systems Based on the root file system user can mount other file systems for various purposes 4 5 1 Mounting an external file system using NFS Using the Ethernet you can mount an external drive by typing when Linux is running one line intended mkdir mnt NFS_WORK_PATH mount o noloc...

Page 15: ...2 mount point mkdir mnt nand0 mount t jffs2 dev mtdblock0 mnt nand0 A new JFFS2 file system can be easily made in your PC Linux environment by using should be one line mkfs jffs2 eraseblock 0x20000 pad 0x01e00000 n d your_directory o nand0 jffs Note that the directory contents must not exceed 15 MB The final JFFS2 image will always be 15 MB in size Appendix A Default Flash Layout can give you an i...

Page 16: ...00660000 0x040000 u boot Note 1 For nand write command the size must be larger than the image size and should be page aligned multiple of 0x200 2 If there are bad blocks please avoid writing them 3 Please reserve at least 1 block for SIBL from the flash start address 5 2 Flashing SIBL Besides some initialization routines SIBL switches from one nand flash controller MLC to another NDF SIBL is loade...

Page 17: ...IARM Address of s_eroms bin should be 0x0 while the Flash Address of sibl_phytec bin should be 0x200 Press the Program Flash button Reset the board when a dialog pops up the download process will start automatically The whole download process should not take longer than a minute 12NC Koninklijke Philips Electronics N V 2004 All rights reserved Application note Rev 03 21 Dec 2006 17 of 28 ...

Page 18: ...eware and corresponding Nohau Emulator can be used to program SIBL Below figures reflect the basic settings for the function For details of the tool usage please refer the Nohau s related user manual 12NC Koninklijke Philips Electronics N V 2004 All rights reserved Application note Rev 03 21 Dec 2006 18 of 28 ...

Page 19: ... 0x00778000 Bad eraseblock 1520 at 0x017c0000 Using default environment In serial Out serial Err serial Hit any key to stop autoboot 0 Boot reached stage 1 Booting image at 80600000 Boot reached stage 2 Boot reached stage 3 Image Name Linux 2 6 10 Image Type ARM Linux Kernel Image uncompressed Data Size 1344044 Bytes 1 3 MB Load Address 80008000 Entry Point 80008000 Boot reached stage 4 Boot reach...

Page 20: ...tly under Linux Shell hello Hello World Hello LPC3180 7 NAND flash porting In the Phytec reference board a ST NAND256R32 32Mbyte NAND flash is mounted Users may use different NAND flashes with it This section gives a guide on how to port the NAND flash drivers for new type devices For frequently used keywords as page block small large page bad block and more related information on NAND flash the t...

Page 21: ...ck static int crc_check image_header_t iheader UInt32 oob_check_ff_on_byte5 UInt8 p_buf Void waitForReady void For a new NAND flash device these functions should be modified according to its user manual 7 2 1 Loading image algorithm For better understanding in reading and modifying the source code this section gives detailed descriptions on SIBL loading image algorithm Just for your reference In f...

Page 22: ...ile name Description lpc3180_nand_phytec c Deal with low level access to the specific nand flash on the board lpc3180_nand_abi_phytec c Interface between the Linux NAND driver MTD and the U boot NAND command nand_base c NAND low level MTD interface functions nand_ecc c Contain an ECC algorithm that detect and correct 1 bit errors in a 256 byte block data nand_bbt c Bad block table support for the ...

Page 23: ...ontroller 3 LPC3180_nand_write_buf_8 Write len bytes data to Data Register then the data are written to the Nand Flash Device sequentially 4 LPC3180_nand_read_buf_8 Read len bytes from Data Register 5 LPC3180_nand_verify_buf_8 Verify len bytes data 6 LPC3180_nand_select_chip A NULL function 7 LPC3180_device_ready Function for checking on device ready signal 8 LPC3180_nand_command_lp Resolve the co...

Page 24: ...AND flash to SDRAM In the file sibl sibl_startup s SDRAM size and working frequency are defined Sdram init TMBT_SDRAM_SZ EQU 256 Mbit IMPORT tmbtSdramInit MOV r0 TMBT_AHB_FREQ 13 1 4 MOV r1 TMBT_SDRAM_SZ 128 1 4 BL tmbtSdramInit The overall implementation of SDRAM initialization is in sibl lpc3180_sdram s including the functions of SDRAM controller control mode control memory control bus control e...

Page 25: ...define PHYS_SDRAM_1 0x80000000 define PHYS_SDRAM_1_SIZE 0x02000000 32 MB In u boot board phytec config mk define the TEXT section start address of u boot image file image should be loaded at 32M 256k TEXT_BASE 0x81EC0000 In u boot board phytec u boot lds align the TEXT section start address with that defined in config mk ENTRY _start SECTIONS 0x81EC0000 ALIGN 4 In u boot board phytec phytec c ther...

Page 26: ...ibl size approx 0xd44 3 396 Rootfs ubt Miniboot 52 bytes Program 0x200 because of ECC 0x0000 0200 0x0049 0000 uImage ubt uboot ubt 0x0000 8000 0x0066 0000 15 MB partition for JFFS2 filesytem 0x0100 0000 0x00EF FFFF 12NC Koninklijke Philips Electronics N V 2004 All rights reserved Application note Rev 03 21 Dec 2006 26 of 28 ...

Page 27: ... mask work right infringement unless otherwise specified Application information Applications that are described herein for any of these products are for illustrative purposes only Philips Semiconductors make no representation or warranty that such applications will be suitable for the specified use without further testing or modification 10 Licenses Purchase of Philips I2 C components Purchase of...

Page 28: ... external file system using NFS 14 4 5 2 JFFS2 support 15 5 Flashing images 15 5 1 Flashing new images 15 5 2 Flashing SIBL 16 5 2 1 Using LPC3180 Loader 16 5 2 2 Using Seehau software 18 5 3 Starting from NAND flash 19 6 Adding user applications 20 7 NAND flash porting 20 7 1 Content list 20 7 2 NAND flash support in SIBL 21 7 2 1 Loading image algorithm 21 7 3 NAND flash support in U Boot 22 7 3...

Reviews: