Home

Linux User Manual

image

Contents

1. 32 7 U BOOT 1 34 8 NFS MOUNTING THE ROOT FILE SYSTEM 4 4 0 2 41 8 1 VERIFY THE HOST HAS NES 5 2 2 00 0000000000000000 42 8 2 SETUP THE EXPORTS FILE 42 8 3 CREATE ROOT FILE SYSTEM AND RESTART THE NFS 43 8 4 CONFIGURE AND REBUILD THE 2 0000 43 8 5 LOAD THE KERNEL ON THE TARGET PLATFORM AND REBOOT 44 Porting Linux to XSCALE SBC Platform 9 HOW TO BUILD YOUR 45 9 1 INSTALL CROSSCOMPILER cccccssecceccescececceccececceceececceeccccnseececceseceeensneess 45 9 2 EXAMPLE PROGRAM cccssceccccsceccccecceccaceseecccssecccccececcasseeceaseseeceaaesecens 45 APPENDIX CAN BUS 47 MESSAGE 47 A 2 OPEN enis 47 M ERE en AIT ET 48 INA READS UM E EC DIM D E LE MCI E 48 s aso cad 48 SELECT e ne
2. Coated Widor Help 1 1 1 Dec 3 2004 17 28 20 F i BI BES gt Cond i WB 0 kB IDOI d kB 3 ae d kB lach XP WB Warning bed GRC using defaulk environment serial serial rr grial key dE Book ing image al Wario Auber Figure 15 U boot Command mode At the prompt type the following command to upload the kernel tftp 0xa0008000 ulinux After the kernel image transfer is complete burn the uploaded file system image onto flash Before burning erase the orignal images on flash Z protect off 1 1 4 erase 1 1 4 Then burn the image in RAM to flash cp b a0008000 00040000 100000 protect on 1 0 4 Term COMI 153088 ies Seckorz 0 0 im Bank 1 M erase Flach Sectors 0 Bank 9 1 Erecting Har D dora M cpb mibi 4010 done pn 1 Protect Flash Saclork D Bank E 1 Figure 16 Writing file to Flash Porting Linux to XSCALE SBC Platform PAGE 21 Load the file system image lubbock 262 16M jffs2 to the target platform s RAM tftp 0xa0008000 lubbock 260 QTE 16M jffs2 Burn uploaded file system image onto flash Before burning erase the original images on flash protect off 1 5 82 erase 1 5 82 cp b a0008000 140000 1000000
3. Linux version 2 4 20 root localhost localdomain gcc version 3 3 1 MontaVista Porting Linux to XSCALE SBC Platform PAGE 23 3 3 1 3 0 10 0300532 2003 12 24 366 Wed Jan 19 16 20 07 CST 2005 CPU XScale PXA255 69052d06 revision 6 ARMv5TE CPU D undefined 5 cache CPU cache 32768 bytes associativity 32 32 byte lines 32 sets CPU D cache 32768 bytes associativity 32 32 byte lines 32 sets Machine 5 SBC Platform Ignoring unrecognised tag 0x00000000 Memory clock 99 53MHz 27 Run Mode clock 398 13MHz 4 Turbo Mode clock 398 13MHz 1 0 inactive On node 0 totalpages 16384 zone 0 16384 pages zone 1 O pages zone 2 0 pages Kernel command line root dev mtdblock2 console ttyS0 115200 Calibrating delay loop 397 31 BogoMIPS Memory 64MB 64MB total Memory 63312KB available 1200K code 232K data 44K init XScale Cache TLB Locking Copyright c 2001 MontaVista Software Inc Dentry cache hash table entries 8192 order 4 65536 bytes Inode cache hash table entries 4096 order 3 32768 bytes Mount cache hash table entries 1024 order 1 8192 bytes Buffer cache hash table entries 4096 order 2 16384 bytes Page cache hash table entries 16384 order 4 65536 bytes POSIX conformance testing by UNIFI X Linux NET4 0 for Linux 2 4 Based upon Swansea University Computer Society NET3 039 Initializing RT netlink socket Version ID 0 LSP Revision 1 Starting kswapd Disabli
4. Porting Linux to XSCALE SBC Platform PAGE 35 gie Edi ew Teena Ge printeny 0 cu soloe rty d 115200 houirmi hnatin 40000 1 haudr amp r s115216 e amp hasizir 708 DG 25 Da 1b Epaddrz132 L68 100 21 142 168 1 netmask 255 255 0000 jandineserial Tate rial ial 1242 ea bytes E seteny merwerig 197 188 100 16 printenv dev edb leche como 8 hicatcnmd hnatn hoodie lapped baudrates125205 atheros SE Lpaddra132 188 10021 n Lnasks755 235 D D 1 ardoutsgerinl ial aerwertp 132 458 100 Ervirbnmenb aise ME IAID bytia Figure 24 Printenv bootargs Support kernel s command line Bootcmd Boot kernel from address 0x40000 bootdelay Delay time at power on baudrate the baudrate of serial port console ethaddr Ethernet hw address ipaddr Ethernet address sererip TFTP Server s ip address netmask Subnet mask addres stdin console input stdout console output You can create short shell scripts by storing a sequence of U Boot commands separated by semicolons in an environment variable To execute the script use the run command followed by the variable name This can be handy to automate repetitive tasks during developmen
5. editing the config file directly Use the menus to set the configureation items General Setup Default kernel command string set to console ttyS0 115200 root dev nfs ip dhcp nfsroot 192 168 100 25 tftpboot source CONFIG Networking Options IP kernel level autoconfiguration set to Y CONFIG PNP DHCP Support set to Y CONFIG IP DHCP BOOTP Support set to Y CONFIG IP File Systems Network File Systems NFS file system support set to Y CONFIG NFS FS Root file system on NFS set to Y CONFIG ROOT NFS Then make the kernel 8 5 Load the kernel on the target platform and Reboot The kernel zl mage can be loaded on the target platform either by burning in to flash see the 3 3 and then reboot the Nuwa Porting Linux to XSCALE SBC Platform PAGE 44 9 How to Build your application In this chapter we will introduce how to install crosscompiler for Nuwa platform to your host PC and how to compile the sample application 9 1 Install Crosscompiler Firstly extract tarball that cross compiler tar gz files are compressed with tarball cross compilertar gz tarball source is located at mnt cdrom gcc directory and place cross compliler in the directory usr local xscale Add the usr local xscale bin directory to the PATH environment variable in your linux PATH PATH usr local xscale bin 9 2 Example program For this example use t
6. memory m It provides interface to send commands to target board or to inform users state of target board First of all extract tarball now that uboot files are compressed with tarball Uboot tarball source is located at mnt cdrom uboot directory PATH PATH usr local xscale bin tar zxf uboot tar gz Porting Linux to XSCALE SBC Platform PAGE 10 etae localhost dayeocket opt montavisra pro devkit arm xscale la bin localhost devrorket tar zxf aboot tar rnut lncalheost devrocket r cd ronrBlaralkest u hont r Figure 2 Build U Boot cd u boot make le 1d T froot soetarista doyrecket Lubbock jabar lda T ekt 5YM cpus pad Y start groep lib pgenerir libgenerir s boards Lobbocks liblubbock cpu paa libpxa a lib arm libarm a fe cranfs libcrosfs a fTs Tat libfat a fe Ta jffar Llihjffuz a a net lihnet a diak liba rtr lihrtr s dtt libdzt a drivere Libdrivers a drivers skn mnlim libsknnlin post libpnst a poat cpu librpu a2 common libcommon a no warn mismatceh L msatavista pra devkit agm xerale Iuy bln 1ib gec 1 b armv5rel hardhat
7. protect on 1 5 82 Tere Term VT Edit Coni Hip 0 rising El resing done dre dra dra dra dome dre dos dre dou dom done cr b iigiin Fach B pred on 1 i aE Proieci Flesh Sectors 5 2 Bank T Figure 17 Erasing Flash Porting Linux to XSCALE SBC Platform PAGE 22 4 Boot Linux On every board RESET or power up do not press any key on keyboard You should see the following message on your terminal emulator U Boot 1 1 1 Dec 8 2004 17 38 28 lt Boot Loader Start U Boot code A3080000 gt A3099988 BSS gt A309DF88 RAM Configuration Bank 0 0000000 64 MB Bank 1 4000000 0 Bank 2 8000000 0 Bank 3 000000 0 Flash 32 Warning bad CRC using default environment In serial Out serial Err serial Hit any key to stop autoboot 0 Booting image at 00040000 Image Name name lt move kernel to SDRAM Image Type ARM Linux Kernel Image gzip compressed Data Size 640849 Bytes 625 8 kB Load Address a0008000 Entry Point a0008000 Verifying Checksum OK Uncompressing Kernel Image OK Starting kernel lt Kernel Running
8. the funcitions for slot c and they can be divided into eight parts for ease of use 1 System Information Functions System Information Functions Digital Input Output Functions Watch Dog Timer Functions EEPROM Read Write Functions Analog Input Functions Analog Output Functions Encoder Functions 2 axis Stepper Servo Functions The functions the Libi8k a are specially designed for LinCon 8000 Users can easily find the functions they need for their applications from the descriptions in Lincon manualand in the demo programs developed by ICPDAS Porting Linux to XSCALE SBC Platform PAGE 33 7 U BOOT Boot Loader The user interface to U Boot consists of a command line interrupter much like a Linux shell prompt When connected via a serial line you can interactively enter commands and see the results After power on the initial u boot prompt looks like this oni iranis ieor ye Go 1 1 0 Dec H 2004 BT dE z3 U Boat code gt EAA Eib AGEDEEH Coafigeratien Wank s aDOOWHwR 4 Bank Fi a4onOQ Bank 7 0 Bank i acODOOX O kH Flash OF Warning bad using default eneibeonmatt serial Mut serial serial Hit any key atop af Figure 22 Power on screen shot You can receive more information a
9. DHCP 2 1221 Fired DHCP Age Weg kr UP LOL LIT 2 00 06 90 00 0 Precu alloc aed sddsess ached Connection impie hon 152 168 152 100 irs HE request how bini Mode Convert Feadan Figure 13 Downloading kernel Porting Linux to XSCALE SBC Platform PAGE 19 There s no need to specify a WINS DNS server address or default router unless your Ethernut application requires direct Internet access In case it does you probably know what to enter Make sure that the network mask and the IP pool addresses fit your local network configuration Finally press Save to let TFTPD32 store the values in the Windows registry and select the Tftp Server tab to return to the initial window Now press the reset switch on your Ethernut board an watch the magic things happening 3 3 boot loader Burn u boot bin onto flash starting at 0 0000 0000 You may use the J Flash utility D jtag gt xuboot D WT bp T MIMIELA ZHHH DHPERSS5 bin HOD D Version 5 DAPYAISS revision m Flash type Figure 14 Burning u boot onto Flash Start your terminal emulator TERA TERM Reset the Target Platform Porting Linux to XSCALE SBC Platform PAGE 20 Tem Term COWI VT gt Hi
10. EEN SHOT 34 FIGURE 2T U BOOT 35 FIGURE 22V PRINTEN 36 Porting Linux to XSCALE SBC Platform PAGE 4 1 Building Development Environment This document provides a step by step guide on how to put an embedded computer NuWa 470 into operation Although some knowledge about LINUX and IP networking is advised an introduction into IP Networking is also provided in this document This document concentrates on the use of the software integrated into the NuWa 470 and less on the hardware Throughout this manual the evaluation board NuWa 470 is used The NuWa 470 is a complete system on chip that enables the design engineer to implement complex hard and software designs in their own products It is designed as a microcontroller drop in replacement and contains the microprocessor core the Ethernet controller all necessary memory components the power management and the glue logic The NuWa 470 implements a full embedded computer system with a preinstalled bootloader and a fully featured LINUX 2 4 20 on a very small standard 3 5 27 x 84mm platform It can be used in a wide variety of applications that require remote control and monitoring via the ethernet are most suitable for the NuWa 470 since control and monitoring can be done through the use of a standard Web browser such as Internet Explorer Netscape Mozilla or Konqueror The NuWa 470 provides all required basic hard and software environment allow you d
11. Linux 3 lger mmd greup 4 Map u bont mip 0 u bnot l amp la hjcopy gap Till teff 0 aroc amp boot o boot_srec kecal ls nh copy 0 binary u lhnut reot localhost w boot arm config mk drivers BAKEALL KEHE hoard Baksfils examples microblaze_config ek commen nips cnnfig mk lg mk 1858 canfig mk mkcanfig parring dude nefn jfinz liB net ERTS lib_ganaric ndlos_config ink config mk post MATINTATNERS ppc config mk roor lacalhonsz u bout 1 Figure 3 u boot bin Porting Linux to XSCALE SBC Platform PAGE 11 If compiling uboot progresses well u boot binary file is created under uboot directory 2 2 Kernel If you are using the command line tools to create and populate your project directories follow the steps included in the sections below kernel sources are compressed by the name of linux 2 4 20 tar gz under mnt cdrom kernel directory Extract this then move to linux 2 4 20 directory created by extraction ad r a devrockrafenux 2 4 20 de Terminal Go reot localhost devrocket FATH SPATW upt mrontavixta nrn devktt a rm xsenle In bin L rootOlocalhast devrocket tar zxt limnux 2 4 20 tar gz raatvGlacalhest devracket as 2 4 20 root localhast limgx 2 4 20 5 make menucunfig Figure 4 Configuring kernel under
12. Perrgners hai bet kong Hantie Lire file ramas Theda anky on thie ikre vius m _ Figure 11 Setting up TFTPD32 The Ethernet boot loader will request an address from the DHCP pool Porting Linux to XSCALE SBC Platform PAGE 18 Enter the IP pool starting address and the number of available addresses in the pool The sample above will offer addresses from 192 168 100 100 up to and including 192 168 100 109 Tite 32 by Fh Jonna Directoy Emp Bree Server ineshaces 192 168 100 16 Show fir starting 197 DER 100100 Sine pool File ban 0000 caster Had 255 255 0 Donan Hane Dpaon Figure 12 Setting up DHCP Server The boot file is the name of the raw binary image of the application you want to upload to the Ethernut board When using WinAVR AVRGCC you simply enter make install on the command line This will automatically compile and link your code and copy the resulting hex file and binary file to the subdirectory bin atmegal28 is not able to create raw binary images A tool named robi has been created which will be explained later bem n ER Ed xj File nize AEE 056 Ayan ree
13. Porting Linux to XSCALE SBC Platform Contents 1 BUILDING DEVELOPMENT ENVIRONMENT 5 1 1 GETTING STARTS tetro ea LEM IDEE 6 1 2 DEVELOPMENT 2 060 0000 00 10000000 6 1 3 INSTALE TOO S 8 1 4 FICE EST ON CDROM 9 2 BUILDING LINUX 2 2 2 242222 2 10 2 1 BOOTLOADER 10 2 2 RTL 12 2 3 FILESYSTEM Sie AD LN LUE 14 3 BURN FILE ONTO FLASH ON THE 16 SEMING CONSOLE 16 3 2 17 3 3 BOOT ORDERS citar ileal Seal A E et s 20 4 0100 MI Cr 23 4 1 USING THE ETHERNET ccccccccssescsccccccccesessssseccccsccesssssssececcscesseessscsccsseeeees 26 4 2 USING THE ete ai ee De IRR qe ten 27 4 3 JUJSINGIHE USB HOST iesu ee tt 27 445 USING THE DISPLAY SR HALE aas 27 4 5 USING THE PCMCIA amp 2 00000 00 nea 28 be Dae ee eae tes 28 5 CAN BUS AND 104 BUS 0 29 6 THEISK MODULE
14. adfds NULL NULL amp timeout Porting Linux to XSCALE SBC Platform PAGE 50
15. another is invisible to user File systems can be freely mixed so for example an ext2 file system on a hard disk could be mounted into a JFFS2 file system in Flash However the first file system is special This is called the root file system and is where the root directory resides This is mounted by the kernel as it boots so the first program which the system executes init must be read from the root file system For development purposes we find having the root file system as a remote file system accessed across the network the most convenient option In this way we can make a directory and all the files and directories contained in it appear as the root file system on the target To do this we use a protocol called NFS Network File System and we need to set up a server on the PC to allow the target access to these files Porting Linux to XSCALE SBC Platform PAGE 41 8 1 Verify the host has NFS support To do this query the portmapper with the command rpcinfo p to find out what services it is providing You should get something like this This says that we have NFS versions 2 and 3 rpc statd version 1 network lock manager the service name for rpc lockd versions 1 3 and 4 There are also different service listings depending on whether NFS is travelling over TCP or UDP Linux systems use UDP by default unless TCP is explicitly requested however other OSes such as Solaris default to TCP If you do not at least
16. bout what command u boot support In the following the commands typed You will see the command list Porting Linux to XSCALE SBC Platform PAGE 34 oaoa munbayssli he rote formic Err eT ial Hit any key to stop mutobont 0 Booting image ot HEHH Magic Hunter alias for elp pum Script irom memury print or set address nffner print Board Into structure bopt default ren boctcmd boot default i e rum beet boot application irage fron memory bost image vis netwurk umisg HnastF TFIP pratnral print console devices and informations Copy Checks calculation invoke DEEP client tn IP bant parems echo erbe args tn console epus erase FLASH memory exit exit script flinfo print FLASH memory information start application at mddrers gdd r print line help Figure 23 U boot s help Much like a traditional Linux shell the U Boot shell uses environment variables to tailor its operation The U Boot commands to manipulate environment variables have the same names as the BASH shell For instance printenv and setenv behave the same as their BASH shell counterparts In the following example you will dump the current environment variables using the printenv command and change the IP address of the TFTP server using the setenv command u boot printenv
17. console To set the set points do make menuconfig command The results are reflected on zl mage binary finally In here we will not set all values instead we will load default configuration file which includes the set points adjusted to target board well Under arch arm def configs directory there are default configuration files for NuWa 470 target board tar zxf linux tar gz cd linux Porting Linux to XSCALE SBC Platform PAGE 12 make menuconfig localhost mantavisca diet ket 2 23 20 de maturity level Figure 5 Configuration menu under console Setting for compiling kernel is over Compile embedded kernel as following devrecket tar zxf limux 2 29 20 tmr gpz rect loralbest dawrecket cd ligex 2 4 20 limux 2 4 20 9 nabe memuronfip Tn include ood include Im sf asm arn make C scriprs lw ialog all make 1 Entering directory root montavista devrocket limux 2 3 20 scripts lxd daleg make 1 Lewing directory root montmvista devrorket limux 2 3 20 scripts lxdi alag Using defaults found im Preparing mcripts fumcticmz parsing Your kernel configuration changes were MOT saved resteloecalhest limwx 2 4 20 make clean dep zImmsge modules modules Figure 6 Making kernel
18. e CAN IOCSAMASK set acceptance mask Use a 32 bit value to set it long long amask Oxfffffffd ioctl CAN IOCSAMASK amp amask Porting Linux to XSCALE SBC Platform PAGE 48 CAN_IOCSACODE set acceptance code Use a 32 bit value to set it EX long long acode 0xfffffffe ioctl can CAN_IOCSACODE amp acode CAN_IOCCRBUF clear read buffer CAN_IOCCWBUF clear write buffer CAN_IOCRREG read a SJA1000 register It can be any of the available registers The most useful ones for applications are ERROR_CODE_CAPTURE RX_ERROR_COUNTER TX_ERROR_COUNTER EX int outcome unsigned long reg reg RX_ERROR_COUNTER outcome ioctl can CAN IOCRREG amp reg printf RX ERROR COUNTER dd n outcome CAN IOCRTTS read the timestamp of the last transmitted message The timestamp is returned in a timeval structure CAN IOCSACTIVE set active mode CAN IOCSPASSIVE set passive mode CAN IOCRAPS get current active passive status CAN IOCSBTR set bit timing registers directly The parameters are passed through the following structure typedef struct unsigned char bt0 unsigned char btl canconfig EX canconfig bconfig bconfig bt0 0x0 bconfig bt1 0 1 1 CAN_IOCSBTR amp bconfig Porting Linux to XSCALE SBC Platform PAGE 49 A 7 select Example for checking for received messages ret select cantl amp re
19. ed flash sector This allows your environment variables to persist across power cycles and reboots You might want do this after updating the server IP address or when adding a new script Type saveenv to save your environment u boot saveenv Saving Environment to Flash Un Protected 1 sectors Erasing Flash Porting Linux to XSCALE SBC Platform PAGE 39 Erasing Sector 5 0x01020000 done Erased 1 sectors Writing to Flash ur done Protected 1 sectors As you can see the saveenv command bundles together the un protect erase copy and protect steps you covered in the previous example Porting Linux to XSCALE SBC Platform PAGE 40 8 NFS mounting the Root File System Fundamental to Linux is the concept of a file system i e an area where files are stored Even when used in an embedded system you will still need a file system A file system can be stored on various media for example a floppy or hard disk RAM Flash or ROM and can also be accessed remotely across a network connection Linux supports several different file system organisations These have different characteristics which make them suitable for different applications For example one may be faster than another but be less efficient in how it uses the available storage space A file system is made available by mounting it This makes the new file system visible as a directory in an existing file system For most purposes crossing from one file system to
20. eveloping individual applications for the NuWa 470 The main features of the NuWa 470 Board are B 3 5 Platform for NuWa 470 32bit RISC Microcontroller with 400MHz 64MB SDRAM 32MB Flash and 1MB SRAM One CF Slot One PCMCIA Slot and One SD MMC Slot TFT or STN LCD and CRT Display interface Audio Interface Line in Line out and MIC in 4 ports USB 2 0 slot 7 serial RS232 and one RS485 Port Dual 10 100Mbit ethernet interface B High speed CAN Bus up to 1Mbit s Porting Linux to XSCALE SBC Platform PAGE 5 Support 87K IO slot Not only the hardware is supplied to you with features such as ethernet serial port and programmable 1 0 pins the software to use these interfaces is already implemented in the NUWa 470 The main important features included in the Embedded Linux distribution are m Embedded Linux 2 4 20 Bootloader uboot 1 1 1 A full TCP IP stack with application interfaces for UDP and TCP sockets DHCP client B server SSH Telnet server W Driver support for CAN Bus USB and etc B Journaling flash file driver JFFS2 for the internal flash disk drive 1 1 Getting Start Before you start please check the NuWa package to ensure all components are present The NuWa 470 contains A NuWa 470 platform B 5V DC power supply CD ROM containing original sources with synertronixx modifications with PXA255 cross toolchain and documentation 1 2 Development Environment First of all you should ha
21. g connection First create the following character device if it does not already exist mknod dev can c 120 0 To verify that the device is working you can check the status of the can bus with cat proc can The can driver provide 2 sample file operations Cansend is the example is designed to send out the CAN message and canmon is designed to receive the CAN message Porting Linux to XSCALE SBC Platform PAGE 29 Pan d Erw rens do a airan 1 pner a gardio comme ih tan hi Mie EX AL car I aru MIDE PIERDE re ZAFFURE ii 00 areir ee ml T EJ Les bo pikara den Liisa Peri Fori 2 Pars Pon al Eh niger reu NPL M l i emilibc E mh 18 cari EST sd ae arzur 1 Lh et eee ism dela frum Eg ee Kul dria Fram BI Au TERR dala Pree lt 2 690 Ra RUE Dod E S 3 4 Figure 20 Canmon The NuWa 430 support 104 bus These sample can be to apply to the 8 bit ISA card the 16 bit ISA card the 8 bit PC 104 card and the 16 bit PC 104 card To reference the driver you mu
22. h memory your board has enter the flinfo command u boot flinfo Bank 1 AMD Am29LV160DB 16KB 2x8KB 32KB 31x64KB Size 2048 KB in 35 Sectors Porting Linux to XSCALE SBC Platform PAGE 37 Sector Start Addresses 500 0x01000000 01 0x01004000 502 0x01006000 03 0x01008000 S04 0x01010000 SO5 0x01020000 S06 0x01030000 507 0x01040000 532 0x011D0000 33 0x011E0000 534 0x011F0000 The output carries quite a lot of information Immediately you see the flash manufacturer part number and sector layout This particular part begins with a 16KB sector at address 0x01000000 followed by two 8KB sectors a 32KB sector and 31 64KB sectors for a total of 2 megabytes in 35 sectors The exclamation points following sectors 0 through 5 indicate that those sectors are protected In this example sectors 0 through 4 contain the code for U Boot itself and sector 5 is used to store the environment variables Any attempt to program these sectors without first unlocking them will fail This offers some level of protection from rm rf type mistakes when programming the flash Continuing the TFTP example let s assume the file you uploaded is a new version of U Boot You need to first unlock flash sectors 0 through 4 before programming the flash Type protect off 1 0 4 which instructs U Boot to allow write access to flash bank 1 sectors 0 through 4 u boot protect off 1 0 4 Un Protect Flash Sectors 0 4 in Ban
23. he simple hello world program saved as hello c include lt stdio h gt int main int argc char argv Printf hello world n Using the cross compiler tools build the executable Use the following command xscale_le gcc hello hello c Copy the executable to an NFS mounted location on the target For example cp hello tftpboot source home Porting Linux to XSCALE SBC Platform PAGE 45 on the target change to the directory where your program is located For example cd home Run your program on the target For example hello Hello world Porting Linux to XSCALE SBC Platform PAGE 46 Appendix A CAN BUS API A 1 CAN messages CAN messages are defined as a struct with the following content typedef struct id identifier 11 or 29 bits int type standard 0 or extended frame 1 Use the predefined values STANDARD and EXTENDED int ttr remote transmission request 1 when true int len data length 0 8 unsigned char d 8 data bytes struct timeval timestamp timestamp in the format timestamp tv sec seconds timestamp tv usec microseconds since Epoch January 1 1970 canmsg A 2 open Open the device The driver supports both blocking and non blocking modes For Blocking mode use EX int can can open dev can O_RDWR The non blocking mode must be specified in the open fi
24. ications yourself Porting Linux to XSCALE SBC Platform PAGE 31 6 The I8K Module SDK In this section we will focus on examples for the description of and application of the functions found in the Libi8k a The Libi8k a functions can be clarified into 3 groups which are listed in Fig 19 Functions of 18000 Modules 17000 8000 8 700 Modules in LonCon Slot m Serial Communication n Parallel Communication d Functions of COM PORT Sioc 7000 2 18000 IK 7000r Like Uartdll Like 17000 dll In Windows In Windows Structure of LibiSk a Figure 21 structure of Libi8k a Functions 1 and 2 in the Libi8k a are the same as with the DCON DLL Driver including Uart dll and 17000 dll as used in the DCON modules 1 7000 1 8000 1 87000 in serial communication You can refer to the DCON DLL Driver manual which includes the functions on how to use DCON modules The DCON DLL Driver has already been wrapped into the Libi8k a Functions 3 of the Libi8k a consist of the most important functions as they are specially designed for 8000 modules in the LinCon 8000 slots They are different from functions 1 and 2 because the communication of l 8000 Porting Linux to XSCALE SBC Platform PAGE 32 modules in the LinCon 8000 slots are parallel and not serial Therefore ICPDAS rewrote 18000 to Slot c especially 8000 modules in the LinCon 8000 slots Here we will introduce all
25. k 1 Next you must prepare the flash sectors for programming by erasing them Enter erase 1 0 4 which tells U Boot to erase sectors 0 through 4 of flash bank 1 u boot erase off 1 0 4 Erase Flash Sectors 0 4 in Bank 1 Erasing Sector 0 0x01000000 done Porting Linux to XSCALE SBC Platform PAGE 38 Erasing Sector 1 0x01004000 done Erasing Sector 2 0x01006000 done Erasing Sector 3 0x01008000 done Erasing Sector 4 0x01010000 done end courier To program the flash memory you need to copy the image from RAM to the address of flash sector 0 0x01000000 using the cp command You will use the byte version of the command to copy the specified number of bytes In this case you can use the fileaddr and filesize environment variables which contains the RAM address and number of bytes loaded by the last TFTP command cp b fileaddr 1000000 filesize at the u boot prompt u boot cp b fileaddr 1000000 filesize Copy to Flash done Finally restore the write protection on flash sectors 0 through 4 by typing protect on 1 0 4 at the U Boot prompt u boot protect on 1 0 4 Protect Flash Sectors 0 5 in Bank 1 You have just updated the U Boot code for you board The next reboot will run the newly uploaded U Boot code Well done The final flash related command is the saveenv command which like the name implies saves your current environment variables to a reserv
26. le operation with the flag O_NONBLOCK in the last parameter Ex can open dev can O_RDWR O_NONBLOCK After open SJA1000 is set to 1Mbit s with single filter mode The acceptance mask is set to Oxffffffff which means that all messages will be accepted WARNING only one application is allowed to use the driver at a time If the open operation is called by a second application an EBUSY error code is returned Porting Linux to XSCALE SBC Platform PAGE 47 A 3 close Close the device Ex close can A 4 read Read a message Return 32 size of the canmsg struct when a message is available and EAGAIN when there is no message amp msg sizeof msg 5 write Write a message Return 32 size of the canmsg struct when the message is successfully stored in the driver s transmit buffer and EAGAIN when the buffer is full Ex write can amp msg sizeof msg A 6 ioctl This command provides the following operations CAN_IOCSBAUD set baud rate Use the following constants to set it B1000 1 Mbit s B500 500kbit s B250 250kbit s B125 125kbit s B20 20kbit s The standard bit timing register values are BTRO BTR1 baud rate 0x00 0x14 1 Mbit s 0x00 1 500 kbit s 0x01 0 1 250 kbit s 0x03 0 1 125 kbit s 0x18 0 1 20 kbit s unsigned long baud_rate B1000 ioctl can CAN IOCSBAUD amp baud rat
27. mici Pe ots nd uiuit E i eee ies 50 Porting Linux to XSCALE SBC Platform PAGE 3 Figures and Tables FIGURE 1 DEVELOPMENT ENVIRONMENT etsi cta 7 BIGURE 2 BUIED U BOOT rr giint e t ea 11 FIGURE 320 BOOT BIN Dd iere aM om do aee ad 11 FIGURE 4 CONFIGURING KERNEL UNDER CONSOLE 12 FIGURE 5 CONFIGURATION MENU UNDER 8 13 FIGURE 6 MAKING KERNEL 13 FIGURE T INSTALLING RPM 15 FIGURE 8 SETTING UP COM PORT PARAMETER 0000 enne nenne 16 FIGURE 9 SETTING UP MINICOM 17 EIGURE 10 TETPD TE TP SEVER 18 FIGURE LL SETTING 2 18 FIGURE 12 SETTING UP DHCP SERVER 19 FIGURE 13 DOWNLOADING KERNEL ad css Gale dou denas 19 FIGURE 14 BURNING U BOOT ONTO 20 FIGURE 15 U BOOT COMMAND MODE sada eee 21 FIGURE 16 WRITING FILE TO FLASH 21 FIGURE 17 ERASING FLASH E s duit n bas ota 22 FIGURE 18 CAN WIRING CONNECTION 29 FIGURE 19 STRUCTURE OF LIBISK A 32 FIGURE 20 POWER ON SCR
28. ng the Out Of Memory Killer JFFS2 version 2 1 C 2001 2002 Red Hat Inc designed by Axis Communications AB Serial driver version 5 05c 2001 07 08 with MANY PORTS enabled Porting Linux to XSCALE SBC Platform PAGE 24 ttySOO at Oxf8100000 ttySO1 at 0 8200000 1 502 at 0xf8700000 ttyS03 at 0xf4200000 1 504 at 0xf4300000 505 at 0xf4400000 506 at Oxf4500000 1 507 at 0 4600000 1 508 at 0xf4700000 117 is a 16450 1 509 at 0 4800000 118 is 16450 ttyS10 at 0 4900000 119 is a 16450 SA1100 Real Time Clock driver v1 02 SA1100 PXA Watchdog Timer timer margin 60 sec DM9000 9000 46 at 0xf1000300 00 0 60 00 00 8 IRQ 108 eth1 DM9000 9000 46 at 0 1100300 00 0 60 00 00 58 IRQ 109 SCSI subsystem driver Revision 1 00 ac97 codec AC97 Audio codec id NSC72 National Semiconductor LM4548A Probing ICPDAS SYSTEM Flash at physical address 0x00000000 32 bit buswidth cfi cmdset 0001 Erase suspend on write enabled irq 15 is a XSCALE UART irq 14 is a XSCALE UART irq 13 is a XSCALE UART irq 112 is a 16450 irq 113 is a 16450 irq 114 is a 16450 irq 115 is a 16450 irq 116 is a 16450 Using buffer write method RedBoot partition parsing not available cmdlinepart partition parsing not available Probing ICPDAS DATA Flash at physical address 0x04000000 16 bit buswidth cfi_cmdset_0001 E
29. ow Cu amp trel Setters Flows font Change which setting screen and kegbaarx Saws setup ae ofl Sate alip Exit Figure 9 Setting up minicom 3 2 Setting TFTP After having installed and started TFTPD32 click on the button labeled Settings This will open a new dialog window Select the options shown in the picture above Your base directory may differ Click on the browse button to select the subdirectory e ftp of your Linux OS installation Finally click OK and restart TFTPD32 Porting Linux to XSCALE SBC Platform PAGE 17 Tid S Fh Joanin Cnet Directoy Sarees interlaced 195 163 100 16 a __ Figure 10 Tftpd TFTP Sever If your network doesn t support DHCP you will need to setup DHCP server It is required to configure the DHCP server Select the DHCP server tab If more than one network interface has been installed on your computer you can select the server interface your Ethernut board is connected to Bare Global Server Sereni TTPO DHCP Server ec mide serve Glande Hh We E T Peed Cindy Adwanced 5 reegntistion Window PSE Compsst ty de pa Files 54 Ehe
30. rase suspend on write enabled Using buffer write method Probing ICPDAS DATA SRAM at physical address 0x08000000 32 bit buswidth Using static partitions on ICPDAS SYSTEM Flash Creating 3 MTD partitions on ICPDAS SYSTEM Flash 0x00000000 0x00040000 U BOOT 0x00040000 0x00140000 KERNEL 0x00140000 0x02000000 JIFF2 RFS Registering ICPDAS DATA Flash as whole device Registering ICPDAS DATA SRAM as whole device Porting Linux to XSCALE SBC Platform PAGE 25 usb c registered new driver usbdevfs usb c registered new driver hub hc_isp116x c USB starting hc_isp116x c USB 15 116 at f4100000 0 IRQ 104 Rev 10 ChiplD 6122 usb c new USB bus registered assigned bus number 1 USB HC dev alloc 384 bytes Product USB 15 116 Root Hub SerialNumber 0 hub c USB hub found hub c 2 ports detected usbdcore usbdcore 0 1 034 2002 06 12 20 00 dbg NET4 Linux TCP IP 1 0 for NET4 0 Protocols UDP TCP IGMP routing cache hash table of 512 buckets 4Kbytes TCP Hash tables configured established 4096 bind 8192 NET4 Unix domain sockets 1 0 SMP for Linux NET4 0 NetWinder Floating Point Emulator 0 95 1998 1999 Rebel com VFS Mounted root jffs2 filesystem readonly lt Mount Root file system Freeing init memory 44K INIT version 2 78 booting INIT Entering runlevel 3 PXA Linux Preview Kit Kernel 2 4 20 on an armv5tel Linux login root lt type
31. rite utility to image directory which the images are collected in Then transfer all things in image directory to target board FLASH32 Image write utility is located under tools directory on CDROM 3 1 Setting Console Connect a serial cable between your PC and the NuWa serial port Start a terminal emulator on the PC and set it to 115200 baud 8 bit no parity and no flow control Lu Tera Termo VI Tere Serial port sefug Bart com Baad rate 115200 ot Data E bil Cancel home hw El Help Elie Transmit delay maecichar n maercfline Figure 8 Setting up com port parameter Porting Linux to XSCALE SBC Platform PAGE 16 If you use Desktop Linux to download file to target you have to know minicom usage first Desktop Linux has minicom program for serial communication It is used for command prompt of uboot or shell prompt of embedded linux Set up the values before using minicom program Select Serial port setup item Push A key for setting Serial Device then write serial port which is connected to target board If using COMI write dev ttySO if COM2 write dev ttyS1 dae Fe he Yew Ge Serial Device foe Leckfll Location LOEk Collin Fregram Callout Fregram Bpe Eits 115200 EN Pl
32. root login 51 root login ttySO root Linux root lt Bash Running 4 1 Using the Ethernet As you are rebooting watch the console for error messages Use the ping Porting Linux to XSCALE SBC Platform PAGE 26 command to test your connectivity Try to ping the gateway machine address first This will test local connectivity on the LAN If you cannot ping the gateway you are not going to be able to connect to the Internet If you can ping the gateway try pinging a known host on the Internet For example ping www yahoo com will test both the ability to do a DNS lookup from your name server as well as your ability to connect to the Internet 4 2 Using the Audio Change to folder home sound Then you can play an mp3 file by specifying its name mp3player moon mp3 4 3 Using the USB Host the bash shell you should be able to plug a USB mouse into the USB slot on the taget board and receive input To verify that the device is working you can examine the input through the event interface device First create the following character device if it does not already exist mknod dev input eventO 13 64 A program evtest is provided to read from this device file Run it with the following command evtest dev input eventO As you use move the mouse for instance it should produce the following type of output Event time 946695141 507730 type 2 Relative code 0 X value 1 Event
33. rootfs root lecalhost nkIs jIT amp 2 r rootf amp o rootfIs jiIfs2 e 40000 ded LOCC mkfz jffzz rantfz such file or directory roob localhost rootfs mkfs jffez2 r o rootfs jffs e 0 0 Le You have new mail in var spaol mail raaot roorelocalhost roatfs 18 bin atc libaxec mnt ront sbin tmp var dev lib mkfs jffsz proc rnoatfs jffs2 share usr roor localhost rpn root root mseontavista dewvracket roatfs Uvh for nadeps ignorearch nascripts fant cdrom nfs utilsn 3 1 1 rpm Figure 7 Installing RPM compress file system as jffs2 format tar zxf rfs tar gz mkfs jffs2 r fs o rootfs jffs2 e 0x40000 pad 0x01000000 if you want to add RPM to your root file system please type the following command rpm root root montavista devrocket rootfs Uvh force nodeps ignorearch no scripts mnt cdrom nfs utils 0 3 1 1 rpm Object File rootfs jffs2 Porting Linux to XSCALE SBC Platform PAGE 15 3 Burn file onto flash on the target Now we will write uboot bootloader ulinux kernel image root_file system rootfs jffs2 to FLASH on target board by using J Flash32 utility This method can be used after booting target board so it s used for writing images on FLASH newly or writing images to new FLASH Transfer the images and the needed utilities to target board because all works are progressed in target board Copy image w
34. s command Porting Linux to XSCALE SBC Platform PAGE 13 make clean dep 21 mage modules modules install If above steps are done without problems kernel image is created in linux 2 4 20 arch arm boot directory by the name of zl mage make modules command compiles the parts selected for Module in kernel setting menu Modules mean the part undertaking independent function under big program and before linking to the big program modules can not do any work According to there is advantage that we can reduce the size of kernel by modularity make modules install command creates kernel pcmcia directories under lib modules linux 2 4 20 directory build directory in there is not related to module it s just symbolic linked to lib modules linux 2 4 20 directory for easy work Finally we need to build ulinux format for u boot fu Object File ulinux 2 3 File system If you are using the command line tools to create and populate your project directories follow the steps included in the sections below Root filesystem of NuWa is composed by J FFS2 Compressed ROM file system FFS2 is designed small and simple The size is restricted to 16MB but it doesn t act on a defect in embedded system Porting Linux to XSCALE SBC Platform PAGE 14 localhost montavistaidewrockeb nods Ele Temmnal Go Help root lecalhost devrocket tar zxf rontfs tar gz root localhost devracket amp cd
35. see a line that says portmapper a line that says nfs and a line that says mountd then you will need to backtrack and try again to start up the daemons 8 2 Setup the exports file Edit the file etc exports If this file already has conent then NFS mount points have already been setup and may be in use Leave them in place Append the content of the reference etc exports file and then save You can also manage verify the mount point by running redhat config nfs in RedHat 9 Porting Linux to XSCALE SBC Platform PAGE 42 gt reium ohare sure fod 8 3 Create root file system and restart the nfs server The root file system You will also need to restart NFS the portmap daemon and resync the exported filesystems NOTE if you change the link to the file system you may will need to resync The easy rule is to restart the NFS service each time you change the link to a new filesystem If you have added a new entry to the dhcpd conf file then you need to restart DHCP too 8 4 Configure and rebuild the kernel To change the configuration of the kernel you can use the make menuconfig command and follow the menus Or you can edit the config file directly Whichever way you choose the following configuration options must be set You can use Make menuconfig to set the config options Use this method Porting Linux to XSCALE SBC Platform PAGE 43 if you are unsure of
36. st have loadable module support enabled in your kernel If you have kernel running and do a make install as above kernel should load the module on demand for you To load the module manually without kernel type insmod On most systems insmod kito alone will do after you have done a make install Use the complete path if insmod kito alone comes up Porting Linux to XSCALE SBC Platform PAGE 30 with a file not found error To unload the module manually type rmmod kito Here are a few things you may need to edit in kito h for your specific installation e define KITO IRQ Make sure this matches the Number on your card Make sure it doesn t conflict with other cards define KITO IOADDR Make sure this matches the value set via dip switches on your card Make sure it doesn t conflict with other cards e define KITO MEMADDR Use this to define where in memory you want the card to map in 0x0000 is the most common default The driver will softset the card to the value specified here when the driver is inserted via insmod or by kernel Make sure this value doesn t conflict with a memory block used by another device After you have compiled the driver and inserted it into the kernel as a module you are ready to run the utility applications in this package and talk to your pc104 c from Linux The library just is a sample application to show the number on 7 Seg LED but you ll have to write the appl
37. t Network Commands Having a network connection on your boot loader is very convenient during Porting Linux to XSCALE SBC Platform PAGE 36 development If your project requires several networked boards they can all download and boot the same kernel image from a centralized server When you update the kernel you only need to update the single copy on the server and not each board individually U Boot supports TFTP Trivial FTP a stripped down FTP that does not require user authentication for downloading images into the board s RAM The tftp command needs two pieces of information the name of the file to download and where in memory to store the file as shown in the following example u boot tftp 8000 u boot bin From server 10 0 0 1 our address is 10 0 0 11 Filename u boot bin Load address 0x8000 Loading done Bytes transferred 95032 17338 hex The size and location of the downloaded image are stored in the fileaddr and filesize environment variables for possible latter use by other shell commands and scripts Flash Commands Some embedded projects only have access to a network while being programmed in the factory When deployed in the field the boards boot a kernel stored in the flash memory The board can be updated in the field by reprogramming the flash memory with a new kernel U Boot offers several commands for programming erasing and protecting the flash memory To see what type of flas
38. t board processor Tool chain is collection of various utilities and libraries which are needed to compile embedded program sources Normally Tool chain offered by GNU is used for developing Linux gcc compiler for GNU C C GNU binary utilities assembler linker and various object file utilities GNU C library 1 3 1 nstall tools Cross Compiler If you are not using DevRocket for your application you will need to install Cross Compiler for NUWA first and to set up the compiler s path mnt cdrom cross compiler tar gz tar zxf cross compiler tar gz PATH PATH usr local xscale bin JFlashMM JFlashMM is a generic JTAG flash memory programmer that uses configuration data files to describe the target development platform J FlashMM is a Windows console application that uses various cables to interface a parallel port to the JTAG TAP on a development system The supported cable types are as follows Insight 1 C 1 connector and 1 C 2 cable o Intel JTAG cable Click on the setup to install J flash utility Now you have to configure your hardware to use the J flash utility Installing the GIVEIO SYS driver on Windows NT and Windows Porting Linux to XSCALE SBC Platform PAGE 8 2000 f Copy the included GIVEIO SYS file to your C WINNT system32 drivers directory g Open the Control Panel and select Add Remove Hardware Wizard h Follow the directions for adding a new device i Select Select hard
39. time 946695141 507734 type 2 Relative code 1 Y value 1 4 4 Using the Display Change to folder home fbv Then you can display a picture file by specifying its name fov 6 jpg Porting Linux to XSCALE SBC Platform PAGE 27 4 5 Using the PCMCIA amp CF Card You should be able to insert a CF IDE Card FAT32 format into the Compact Flash slot on the taget board Then you should type those command below cardmgr mount t vfat dev hdal mnt Finally you can see the files in the folder mnt 4 6 SRAM We use the mke2fs command to create a standard EXT2 Linux filesystem and to read and write access on the SRAM device mke2fs dev mtdblock5 mke2fs 1 19 13 Jul 2000 for EXT2 FS 0 5b 95 08 09 Filesystem label OS type Linux Block size 1024 109 0 Fragment size 1024 log 0 128 inodes 1024 blocks blocks 0 00 reserved for the super user First data block 1 1 block group 8192 blocks per group 8192 fragments per group 128 inodes per group Writing inode tables done Writing superblocks and filesystem accounting information done To add files and folders first mount the file system as ext2 mount t ext2 dev mtdblock5 mnt Porting Linux to XSCALE SBC Platform PAGE 28 5 CAN Bus and PC 104 Bus Application The Nuwa Family support CAN Controller Area Network and PC104 Bus There is a sample environment appears as in the diagram below PISO CAN200 Nuwa Series Figure 18 Can wirin
40. ve a development environment appears as in the diagram below Porting Linux to XSCALE SBC Platform PAGE 6 PC BC 2 Hoard Figure 1 Development Environment As show in figure 1 there are three component in the development environment 1 is for downloading file such as bootloader and kernel image to target PC2 is for developing linux program Target board is NUWA This manual is written on the assumption that you install Red Hat Linux 9 0 by workstation type on your host PC If you install other distributions on your PC some problems related to library etc can be happened So if you want to prevent getting into trouble and spare development time install Red Hat Linux 9 0 by workstation type on your PC To develop embedded Linux kernel device driver application etc you have to construct cross compile environment Cross compile environment is development environment that is embodied in host PC to develop linux for embedded system To create embedded program we would have to compile the program directly in target board or compile that in host PC for target board processor But because of restricted resources lack of memory or storage compiling in target board is not easy Porting Linux to XSCALE SBC Platform PAGE 7 So we construct cross compile environment to compile embedded program sources in host PC instead of target board To construct the environment install tool chain for targe
41. ware from list and then choose NEXT j Select Ports from the hardware list and then choose NEXT k Select Have Disk and browse to the giveio inf file O Confirm and finish the installation by choosing NEXT and then FINISH With this Installation of J flash is complete 1 4 File list on CDROM Now we explain each directory on CD ROM very simply B Application Software B compiler Cross compiler for target board B kernel Linux kernel for target board rootfs Root file system for target board RPM for target board u boot Boot loader for target board tools Tools software for PC drivers ts Touch screen driver for X Windows Porting Linux to XSCALE SBC Platform PAGE 9 2 Building Linux Code 2 1 Boot Loader In embedded system differently in general PC general firmware like CMOS does not exist So to boot embedded system for the first time we have to make bootloader which adjusted well to target board Bootloader plays a very important part in embedded system We explain the roles of bootloader simply below Copy kernel to RAM from flash memory and execute kernel Initialize hardware B Bootloader have the function that writing data to flash memory Downloading kernel or Ram disk by serial port or other network hardware data is stored in RAM But RAM lost all data downloaded if you cut power supply so to avoid this work you have to store to flash

Download Pdf Manuals

image

Related Search

Related Contents

Manual de usuario  E3NC-LA0 - Manual  DRM036, Sine Voltage Powered 3  TFT LCD COLOR MONITOR User`s manual  WQLoader USER MANUAL  Manual Zeeko Notus 2009  Baño de calibración Modelo CTB9400, baño caliente Modelo  CH? (Query Only)  Operating Instructions for "Kabi" Well done, and thank you.  victron energy  

Copyright © All rights reserved.
Failed to retrieve file