嵌入式微處理器系統
This presentation is the property of its rightful owner.
Sponsored Links
1 / 105

嵌入式微處理器系統 PowerPoint PPT Presentation


  • 143 Views
  • Uploaded on
  • Presentation posted in: General

嵌入式微處理器系統. Professor: Mon-Chau Shie 2010/04/09. Topic. 1. RISC 32 bit CPU Architecture Introduction. Outline. 1.1 ARM vs. MIPS MIPS Overview ARM Overview 1.2 S3C4510 (ARM7) Overview Samsung S3C4510B 1.3 IXP (XScale) Overview. MIPS Overview .

Download Presentation

嵌入式微處理器系統

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Professor mon chau shie 2010

嵌入式微處理器系統

Professor: Mon-Chau Shie

2010/04/09


Topic 1

Topic. 1

RISC 32 bit CPU Architecture Introduction


Outline

Outline

1.1 ARM vs. MIPS

  • MIPS Overview

  • ARM Overview

    1.2 S3C4510 (ARM7) Overview

  • Samsung S3C4510B

    1.3 IXP (XScale) Overview


Mips overview

MIPS Overview

  • The MIPS (Million Instruction Per Second) architecture grew out of research started at Stanford University (Professor John Hennessy).

  • MIPS project was one of the first publicly known implementations of a Reduced Instruction Set Computer (RISC) architecture.

  • MIPS processor implemented a smaller, simpler instruction set.

  • MIPS processor used a technique called pipelining to more efficiently process instructions.

  • MIPS used 32 registers, each 32 bits wide.


Mips instruction set overview

MIPS Instruction Set Overview

  • MIPS instruction set consists of about 111 total instructions, each represented in 32 bits.

    • An example of a MIPS instruction is below:

      • add $r10, $r7, $r8

        000000 00111 01000 01010 00000 010100

$r10

$r7

$r8


Mips overview1

MIPS Overview

  • For detail information about the “MIPS

    Architecture”, you can refer to [5]


Outline1

Outline

1.1 ARM vs. MIPS

  • MIPS Overview

  • ARM Overview

    1.2 S3C4510 (ARM7) Overview

  • Samsung S3C4510B

    1.3 IXP (XScale) Overview


Arm overview

ARM Overview

  • Advances RISC Machines (now known as

    ARM) was established in November 1990.

  • ARM (formerly Advanced RISC Machines)

    • ARM7, ARM9, ARM10, ARM 11

    • StrongARM, Xscale (PXA, IXP, IXC, etc.)

  • The standard way to perform I/O functions on ARM systems is by the use of memory-

    mapped I/O.


Arm overview1

ARM Overview

  • ARM is fully 16/32-bit RISC architecture

    • ARM variants are in widespread use in embedded

      and Low-power applications due to their power saving

      design features.

  • Power consumption:

    CPU Power W Clock /MHz

    • ARM7TDMI: < 0.25 60 -110

    • ARM7TDMI-S: < 0.4 >50

    • ARM9TDMI: 0.3 167 - 220

    • ARM1020E: ~0.85 200 - 400

    • IXP (XScale): 1.2 533

    • Inter 486 cpu: 10 50


Arm overview2

ARM Overview

  • ARM incorporates the following typical RISC architecture features:

    • A load/store architecture

      • data-processing operations only operate on register contents, not directly on memory contents.

    • Simple addressing modes

      • all load/store addresses being determined from register contents and instruction fields only.

    • Pipelined

      • (ARM7: 3 stages)

      • (ARM7: 5 stages)

    • Uniform and fixed-length instruction fields,

      to simplify instruction decode.


Arm overview3

ARM Overview

  • The ARM processor has a total of 37 registers:

    • 31 general-purpose 32bit registers.

    • 6 status registers.

    • 16 general registers and one or two status

      registers are visible at any time.

    • The visible registers depend on the processor

      mode.

    • The other registers (the banked registers) are

      switched in to support IRQ, FIQ, Supervisor,

      Abort and Undefined mode processing.


Arm overview4

ARM Overview

  • Registers:

    • R0 to R15 are directly accessible.

    • R0 to R12 are general purpose.

    • R13 is the Stack Pointer (SP).

    • R14 is the Link Register (LR).

    • R15 is the Program Counter (PC).


Arm overview5

ARM Overview

  • Current program status register (CPSR)

    • CPSR is accessible in all processor modes.

    • It contains the following condition code:

      • Flags, interrupt disable bits, the current processor mode, other status and control information.

  • Saved program status register (SPSR)

    • SPSR is used to preserve the value of the CPSR when the associated exception occurs.


Arm overview6

ARM Overview

  • Register organization in ARM state

    • Registers are arranged in partially overlapping banks, with a different register bank for each processor mode, as shown in Figure 1.

Figure.1

Ref. [2]


Arm overview7

ARM Overview

  • For detail information about the ARM CPU Architecture and Register organization, we will introduce in Chap 3.


Arm vs mips

ARM vs. MIPS


Outline2

Outline

1.1 ARM vs. MIPS

  • MIPS Overview

  • ARM Overview

    1.2 S3C4510 (ARM7) Overview

  • Samsung S3C4510B

    1.3 IXP (XScale) Overview


Samsung s3c4510b

Samsung S3C4510B

  • Samsung S3C4510B

    • Samsung S3C4510B 16/32-bit RISC microcontroller is a cost-effective, high-performance microcontroller solution for ethernet-based systems.

    • The S3C4510B is built around an outstanding CPU core: the 16/32-bit ARM7TDMI RISCprocessor designed by Advanced RISC Machines, Ltd.


S3c4510b block diagram

S3C4510B - Block Diagram

S3C4510B CPU core

Ref. [2]


Arm7tdmi overview

ARM7TDMI Overview

  • ARM7TDMI

    • T: THUMB

      • THUMB instruction set: 16 bit re-encoded

        subset of 32 bit ARM instruction set.

    • D: On-chip debug

      • Halt in response.

    • M: Long Multiply Instruction (‘M’ variant)

      • 32 bits x 32 bits = 64 bits.

      • Provide full 64 bit result.

    • I: Embedded ICE

      • On-chip breakpoint.


Arm7tdmi overview1

ARM7TDMI Overview

  • Feature of ARM7TDMI Architecture:

    • 32 bit RISC processor (32-bit data & address

      bus)

    • Big and Little Endian operation modes

    • Fast interrupt response (for real-time applications)

    • Excellent high-level language support

    • Simple but powerful instruction set


Arm7tdmi overview2

ARM7TDMI Overview

  • From the programmer’s point of view, the ARM7TDMI can be in one of two states:

    • ARM state which executes 32-bit, word-

      aligned ARM instructions.

    • THUMB state which operates with 16-bit, half-

      word-aligned THUMB instructions. In this

      state, the PC uses bit 1 to select between

      alternate half-words.


Arm7tdmi overview3

ARM7TDMI Overview

  • 3 stage pipeline:

    • The ARM7TDMI core uses a pipeline to increase the speed of the flow of instructions to the processor.

Ref. [2]


Arm7tdmi overview4

ARM7TDMI Overview

  • 3 stage pipeline:

Ref. [2]


Feature of s3c4510b architecture

Feature of S3C4510B Architecture

  • Important peripheral functions include

    • 8 Kbytes Unified Cache

      • The S3C4510B CPU has a unified internal 8K byte instruction/data cache.

      • Using cache control register settings, you can use part or all of this cache as internal SRAM.

      • To raise the cache hit ratio, the cache is configured using two-way set associative addressing.

      • The replacement algorithm is pseudo-LRU (Least Recently Used).

      • The cache line size is four words (16 bytes). When a miss occurs, four words must be fetched consecutively from external memory.


Feature of s3c4510b architecture1

Feature of S3C4510B Architecture

  • 8/16/32-bit External Bus Support

  • IIC Serial Interface

  • 10/100 Mbps Ethernet Controllerwith Dedicated DMA

    • The S3C4510B has an ethernet controller which operates at either 100-Mbits or 10-Mbits per second in half-duplex or full-duplex mode.

    • In half-duplex mode, the controller supports the IEEE 802.3 carrier sense multiple access with collision detection (CSMA/CD) protocol.

    • In full-duplex mode, it supports the IEEE 802.3 MAC control layer, including the pause operation for flow control.


Feature of s3c4510b architecture2

Feature of S3C4510B Architecture

  • 2 HDLCs with Dedicated DMA

  • 2 General-Purpose DMAs

    • The S3C4510B has a two-channel general DMA controller, called the GDMA.

    • The two-channel GDMA performs the following data transfers without CPU intervention:

      • Memory-to-memory (memory to/from memory)

      • UART-to-memory (serial port to/from memory)

  • 2 UARTs

  • Two 32-bit Programmable Timers


Feature of s3c4510b architecture3

Feature of S3C4510B Architecture

  • toggle mode and interval mode

  • 18 Programmable I/O Ports

  • Memory Controller with Refresh Control

  • PLL for System Clock

  • Package Type : 208 QFP

  • Operating at 3.3V ±10%

  • 5-V-tolerant I/O, 3.3-V output levels

  • Operating Frequency : Up to 50MHz


System manager

System Manager

  • The S3C4510B microcontroller's system manager has

    the following functions:

    • To arbitrate system bus access requests from several master

      blocks, based on fixed priorities.

    • To provide the required memory control signals for external

      memory accesses.

    • To provide the required signals for bus traffic between the

      S3C4510B and ROM/SRAM and the external I/O banks.

    • To compensate for differences in bus width for data flowing

      between the external memory bus and the internal data bus.

    • S3C4510B supports both little and big endian for external memory

      or I/O devices.


S3c4510b system memory map

S3C4510B System Memory Map

  • To control external memory operations, the System Manager uses a dedicated set of special registers

    • The System Manager uses special register settings to control the generation and processing of the control signals, addresses, and data that are required by external devices in a standard system configuration.

    • Special registers are also used to control access to ROM/SRAM/Flash banks, up to four DRAM banks and four external I/O banks, and a special register mapping area.

    • The address resolution for each memory bank base pointer is 64K-bytes (16 bits). The base address pointer is 10bits. This gives a total addressable memory bank space of 16 M words.


Samsung s3c4510b1

Samsung S3C4510B

  • The following integrated on-chip functions are

    described in detail in [2]

    — 8K-byte unified cache/SRAM

    — I2C interface

    — Ethernet controller

    — HDLC

    — GDMA

    — UART

    — Timers

    — Programmable I/O ports

    — Interrupt controller


Outline3

Outline

1.1 ARM vs. MIPS

  • MIPS Overview

  • ARM Overview

    1.2 S3C4510 (ARM7) Overview

  • Samsung S3C4510B

    1.3 IXP (XScale) Overview


Ixp xscale overview

IXP (XScale) Overview

  • Intel XScale core

    • Intel StrongARM V5 compliant

    • 266, 400, and 533 MHz

  • 3 Network Processor Engines (NPE)

    • Ethernet filtering

    • ATM SARing

    • HDLC


Ixp xscale overview con t

IXP (XScale) Overview (con’t)

  • USB 1.1 device controller

    • Full-speed

    • 16 endpoints

  • PCI controller

    • 32-bit interface

    • PCI Spec. Rev. 1.1 compatible

    • Host/option capable

    • Master/target capable

    • Two DMA channels

    • 264 MBps peak data rate


Ixp xscale overview con t1

IXP (XScale) Overview (con’t)

  • 2 Ethernet MACs

  • ADSL support

  • Hardware security accelerator

    • DES, 3DES, SHA-1, and MD5

    • AES 128-bit and 256-bit

    • For VPN, Wireless,... Etc. applications

  • UTOPIA-2 Interface

  • Low Power consumption

    • 1.2W @ 533MHz


Ixp xscale overview con t2

IXP (XScale) Overview (con’t)

  • DSP support for:

    • TI DSPs supporting HPI-8/HPI-16 bus cycles

  • Internal bus monitoring unit

    • Seven 27-bit event counters

    • Monitors internal bus occurrence and duration events

  • High-speed UART

  • Expansion bus interface


Ixp xscale overview con t3

IXP (XScale) Overview (con’t)

  • Typical Applications

    • High performance DSL modem

    • High performance cable modem

    • Residential gateway

    • SME router

    • Integrated access device (IAD)

    • Set-top box

    • DSLAM

    • Access Points 801.11 a/b/g

    • Network Printers


Ixp xscale architecture

IXP (XScale) Architecture

  • IXP425 hardware block diagram


Ixp xscale architecture1

IXP (XScale) Architecture

  • XScale core block diagram


Ixp xscale core

IXP (XScale) Core

  • Intel StrongARM V5TE compliant

  • Seven/eight-stage super-pipeline

    • Integer pipe

    • Multiply-accumulate (MAC) pipe

    • Memory pipe

  • Multiple-accumulate coprocessor

    • Can do 2 simultaneous, 16 bit, SIMD multiplies with 40-bit accumulation


Ixp xscale core cont d

IXP (XScale) Core (cont’d)

  • Management unit

    • 32-entry, data memory management unit

    • 32-entry, instruction memory management unit

    • 32-KByte, 32-way, set associative instruction cache

    • 32-KByte, 32-way, set associative data cache

    • 2-KByte, 2-way, set associative mini-data cache

    • 128-entry, Branch Target Buffer

    • 8-entry write buffer

    • 4-entry fill and pend buffers

      • allow “hit-under-miss” operation with data caches

  • Debug unit

    • JTAG interface


Ixp xscale npe

IXP (XScale) NPE

  • Network Processor Engine

    • Dedicated-function

    • High performance, hardware-multi-threaded

    • Dedicated instruction/data memory bus

  • Used to off load networking functions

  • Additional assist hardware

    • Hardware security accelerator

    • CRC, AAL 2, AES, DES, SHA-1, and MD5


Ixp425 processing power

IXP425 Processing Power


Reference

Reference

[1] http://en.wikipedia.org/wiki/ARM_architecture

[2] http://www.samsung.com/Products/Semiconductor/

SystemLSI/Networks/PersonalNTASSP/Communication

Processor/S3C4510B/um_s3c4510b_rev1.pdf

[3] ARM DUI 0021A “Programming Techniques“, 1995

[4] www.arm.com

[5] http://cse.stanford.edu/class/sophomorecollege/

projects00/risc/mips/index.html


Exercise

Exercise

  • Please describe RISC properties.

  • What is pipeline?

  • Please describe ARM 4510 feature.

  • What is the Branch Target Buffer (BTB) of XScale core?

  • What major function does IXP425 target for? How does IXP425 support it?

  • What is the NPE of IXP4xx processor?


Topic 2

Topic. 2

Embedded Linux Concept


Outline4

Outline

2.1 Linux Overview

  • Unix/Linux History

  • Linux Concept

  • Linux Command

    2.2 Embedded Linux Overview

  • ARM Linux

  • uClinux

  • Embedded Linux Concept


Unix linux history

Unix/Linux History

  • 1985: The “GNU manifesto” is published in the March

    1985 issue of Dr. Dobb's Journal.

  • 1989: SCO ships SCO UNIX System V/386, the first

    volume commercial product licensed by AT&T to

    use the UNIX System trademark

  • 1991 : Linus Torvalds develops Linux as an open source

    Unix clone

  • 1994 : Linux 1.0 is released.

  • 1995: SCO acquires UNIX Systems source technology business from

    Novell Corporation (which had acquired it from AT&T's UNIX

    System Laboratories). SCO also acquires UnixWare 2

    operating system from Novell


Unix linux history1

Unix/Linux History

  • 1996: Real-time Linux designated the RTLinux project released in 1996 by Michael Barabanov under Victor Yodaiken's supervision

  • 1997: Caldera ships OpenLinux Standard 1.1 May 5, 1997,

    the second offering in Caldera's OpenLinux product line

  • 2003: Linux Kernel Archive http://www.kernel.org/.

    The current full-featured version is 2.6 (released

    December 2003) and development continues

  • 2005: The latest stable version of the Linux kernel

    is 2.6.12.4 (released 2005-08)


Outline5

Outline

2.1 Linux Overview

  • Unix/Linux History

  • Linux Concept

  • Linux Command

    2.2 Embedded Linux Overview

  • ARM Linux

  • uClinux

  • Embedded Linux Concept


Linux architecture

Linux Architecture

  • Linux Kernel

    • Provide basic OS mechanisms, file systems, device drivers...etc.

  • Libraries

    • C libraries, run-time libraries...etc.

  • Shell (Command line interface)

    • A user program that provides an environment for user interaction.

  • GUI

    • Graphic User Interface

  • System Services

    • Disk manager, Web server...etc.

  • System Utilities & User Applications

    • vim, ftp, ifconfig, firefox...etc.

System

Services

System

Utilities

User

Applications

Shell

(Bash, Csh…)

GUI

(Gnome, KDE…)

Libraries (glibc)

Linux Kernel

Hardware (PC)


Important concept of linux

Important Concept of Linux

  • You can simply regard a complete Linux system as two major parts:

    • Kernel

    • Root Filesystem

  • A roughly boot sequence of Linux:

Now we can see the directory

structure and files in hard disk

Boot

code

Kernel

Initiate

hardware

Mount

Root FS

Mounted as root (/)

Execute

/sbin/init

Initiate Kernel

functions

Root Filesystem

(Stored in hard disk)

Execute

/sbin/login


Linux root file system

Linux Root File System

Ref. [1]


Typical directories

Typical Directories

  • / : Root of the tree.

    • bin, sbin, usr/bin: software for the shell and most common Linux commands.

    • dev: device files, Linux regards devices as files, for example: HD0  /dev/hd0, printer1  /dev/lpt1.

    • home: contains individual user home directory (/export/home on sun computers).

    • tmp: holds temporary files.

    • var: contains files that vary in size. (Mail directories, printer spool files,logs, etc.)

    • etc: administrative files such as lists of user names and passwords.

    • usr: contains application programs


The linux kernel

The Linux Kernel

  • Task management

  • System calls

  • Memory management

  • Scheduler

  • IPC

  • File system

  • Device driver

  • Network stack

  • SMP support


Linux kernel architecture

Linux Kernel architecture

  • Architecture of a generic Linux system

Ref. [3]


Outline6

Outline

2.1 Linux Overview

  • Unix/Linux History

  • Linux Concept

  • Linux Command

    2.2 Embedded Linux Overview

  • ARM Linux

  • uClinux

  • Embedded Linux Concept


Linux command basics

Linux command -Basics

man command: display online help, type q is exit

  • ls : display Information about files and directories

    -l display detail information

    -a display information for every file including hidden file in a directory

  • cd : move to directory

    • cd ~ : move to home directory

    • cd .. : move one directory up

    • cd dirname : change to directory dirname

  • cp : copy file (cp from-filename to-filename)

  • rm : delete file (rm filename )

  • mv : move file (mv filename ./directory)

  • mkdir : create new directories

  • rmdir : delete empty directories


Linux command basics1

Linux command - Basics

  • df : reports the amount of free disk space on any currently mounted filesystem

  • ln : creates a symbolic link to a files (ln -s originalfile linkfile)

  • more : display file contents in full screen and page by page (more filename)

  • shutdown : shutdown the system

    -h halt the system when the shutdown is complete

    -r reboot the system when the shutdown is complete

  • halt : shutdown the system now

  • reboot : restart computer

  • pwd : report current directory

  • who : show who is logged on

  • passwd : change password

  • login, logout : log in or log out system

  • startx : start X window


Linux command file management

Linux command - File Management

  • chown : change the permissions user and group of file or directory (chown user:groupfile or directory)

  • chmod : change the permissions user and group of file or directory [ex] chmod ug+rx dirname, chmod 755 dirname

  • mount : attach the device to the filesystem

    [ex] mkdir /c (first make directory) mount /dev/hdc /c

  • umount : detach the device from the filesystem

    [ex] umount /c

  • uname : display system information <ex> uname -a

  • mkbootdisk : [ex] mkbootdisk --device /dev/fd0 2.4.20-8

    build floppy boot disk ,kernel Ver. 2.4.20-8

  • cat : concatenates files [ex] cat a.txt >> b.txt

  • fdisk : partition tool

  • mke2fs : format tool [ex] mke2fs /dev/fd0


Linux command network

Linux command - Network

  • ping : send ICMP ECHO_REQUEST packets to network hosts[ex] ping 140.118.123.173

  • telnet : connects the local host with a remote host[ex] telnet 140.118.123.173

  • ifconfig : configure a network interface[ex] ifconfig eth0 140.118.123.173

  • netstat : display network state

  • route : show/manipulate the IP routing table

  • ftp : file transfer tool [ex] ftp 140.118.123.173

    • bin : switch to binary transfer mode

    • ascii : switch to ascii transfer mode

    • get filename : download file

    • put filename : upload file

    • bye : quit ftp

    • ls : list file and directory


Linux command compress decompress

Linux command - Compress & Decompress

For file

  • compress :

    • bzip2 : [ex] bzip2 filename  form filename.bz2

    • zip : [ex] zip filename1 filename  form filename1.zip

    • gzip : [ex] gzip filename  form filename.gz

  • decompress :

    • bzip2 : [ex] bzip2 -d filename.bz2

    • unzip : [ex] unzip filename1.zip

    • gzip : [ex] gzip -d filename.gz


Linux command compress decompress1

Linux command - Compress & Decompress

For directory

  • tar : The GNU version of the tar archiving utility -z: gzip/ ungzip type -c: create a new archive -x: extract files from archive -v: verbosely list files processed -f: use archive file or device F (default "-", meaning stdin/stdout)

  • compress : [ex] tar -zcvf directory.tar.gz directory

    • usegzip to compress directory and generate directory.tar.gz.

  • decompress : [ex] tar -zxvf directory.tar.gz

    • use gzip to decompress and extract directory.tar.gz.


Linux command search

Linux command - Search

  • find : find [pathnames] [conditions]

    • An extremely useful command for finding particular groups of files.

  • grep : grep [options] pattern [files]

    • Search one or more files for lines that match a regular expression pattern.


Linux command process

Linux command - Process

  • ps : ps [options]

    -a : list all processes on a terminal

    -u : display processes for the specified users

    -x : display processes without an associated terminal


Linux command process1

Linux command - Process

  • Kill : kill [options] [PIDs]

    • Send a signal to terminate one or more processes.


Outline7

Outline

2.1 Linux Overview

  • Unix/Linux History

  • Linux Concept

  • Linux Command

    2.2 Embedded Linux Overview

  • ARM Linux

  • uClinux

  • Embedded Linux Concept


Arm linux

ARM Linux

  • ARM Linux [7] is a port of the successful Linux Kernel to ARM processor based machines.

  • ARM Linux is under almost constant development by various people and organizations around the world.

  • It reserves mostly generic Linux Kernel features, such as multi-tasking, memory management, and so on.


Arm linux1

ARM Linux

  • Important features for developers:

    • Multi-tasking

      • Support fork() system call

    • Memory Management Unit (MMU)

      • Support virtual memory

      • Support brk() system call

    • Executable File Format

      • Support standard ELF executable file format


Outline8

Outline

2.1 Linux overview

  • Unix/Linux History

  • Linux Concept

  • Linux Command

    2.2 Embedded Linux Overview

  • ARM Linux

  • uClinux

  • Embedded Linux Concept


Uclinux

uClinux

  • The name ‘uClinux’ [2] comes from ‘Micro(μ)-Controller Linux’.

  • The original uClinux was a derivative of Linux 2.0 kernel intended for micro-controllers without MMUs.

  • uClinux first ported to the Motorola MC68328: DragonBall Integrated Microprocessor.


Uclinux1

uClinux

  • Important features for developers:

    • Multi-tasking

      • fork() system call is not implemented

      • vfork() is used instead of fork()

    • No Memory Management Unit

      • Does not have autogrow stack and no brk()

      • Need to use mmap() to allocate memory

      • Need to set stack size of a program at compile time

      • No memory protection

        • Any program can crash another program or the kernel

    • Executable File Format

      • Only support FLAT executable file format


Outline9

Outline

2.1 Linux overview

  • Unix/Linux History

  • Linux Concept

  • Linux Command

    2.2 Embedded Linux Overview

  • ARM Linux

  • uClinux

  • Embedded Linux Concept


Embedded linux architecture

Embedded Linux Architecture

  • Basically, the embedded Linux architecture is the same as the generic Linux architecture.

  • The software such as glibc, bash, Gnome and KDE ... etc, are too large to be used in embedded system.

  • The common substitution for software in embedded system is listed below:

    • Glibc  uClibc

    • Bash  busybox, Sash

    • Gnome, KDE  Microwindow, Qt Embedded, MiniGUI

    • Login  Tinylogin

    • Standalone Utilities  busybox

NOTE: Busybox is a program that integrates a lot of frequently used utilities into it.


Embedded linux build procedure

Embedded Linux Build Procedure

  • Make a Kernel image for your board

    • The make procedure of distribution of embedded Linux that you are using is different from the others but they are similar.

    • The common make procedure of Linux Kernel:

      • make xconfig (or menuconfig)

        • Configure your Kernel

      • make dep (not necessary in 2.6 Kernel)

        • Check dependency

      • make

        • Compile your Kernel and produce the Kernel image

  • Build a Root Filesystem

    • You can build it manually or automatically build via some tools or scripts.

    • Put all files you want in the Root Filesystem image.

    • Commonly used file systems: ext2 and romfs.

  • Copy Kernel and Root FS to Flash memory


Reference1

Reference

[1] 鳥哥的linux私房菜 鳥哥著 上奇

[2] http://www.uclinux.org

[3] http://www.xml.com/ldd/chapter/book/

bookindexpdf.html

[4] http://linux.about.com

[5] http://linux.vbird.org/

[6] http://www.cs.toronto.edu/~reid/csc209/02f/

[7] http://www.arm.linux.org.uk/


Exercise1

Exercise

  • What kinds of operating systems are popular in embedded systems?

  • What are the advantages of choosing Linux as an embedded operating system?

  • Why uClinux has low memory flexibility?

  • What are the differences between ARM Linux and uClinux?


Topic 3

Topic. 3

U-Boot


Outline10

Outline

3.1 Introduction to U-Boot

3.2 U-Boot commands

  • System information

  • Environment variable

  • Memory

  • File transfer

  • Boot and execute

  • Miscellaneous


Introduction to u boot

Introduction to U-Boot

  • U-Boot [1], The Universal Boot Loader, is a GPL'ed cross-platform boot loader shepherded by project leader Wolfgang Denk.

  • U-Boot supports for hundreds of embedded boards and a wide variety of CPUs including PowerPC, ARM, MIPS, NIOS, and x86 ...etc.

  • You can easily configure U-Boot to strike the right balance between a rich feature set and a small binary footprint.

  • Using U-Boot to take care of the low-level board initializations, allowing you to focus on the core of your embedded application.

  • If the need arises, however, you have the source code, and can add support for new hardware or add a special feature in U-Boot.


Outline11

Outline

3.1 Introduction to U-Boot

3.2 U-Boot commands

  • System information

  • Environment variable

  • Memory

  • File transfer

  • Boot and execute

  • Miscellaneous


System information

System information

  • bdinfo

    • Description: Display board information

    • Usage: bdinfo

    • Example: bdinfo

  • coninfo

    • Description: Display console information

    • Usage: coninfo

    • Example: coninfo

  • arch_number = 0x00000000

  • env_t = 0x00000000

  • boot_params = 0x00000800

  • DRAM bank = 0x00000000

  • -> start = 0x00000000

  • -> size = 0x01000000

  • ethaddr = 00:40:95:36:35:33

  • ip_addr = 192.168.0.11

  • baudrate = 19200 bps

List of available devices:serial 80000003 SIO stdin stdout stderr


System information1

System information

  • flinfo

    • Description: Display FLASH information

    • Usage: flinfo

    • Example: flinfo

    • Exp. Note: The 2MB FLASH is divided into 35 sectors, where ‘!’ denotes the specific sector is protected (read-only).

  • Bank # 1: MXIC MX29LV160AB (2MB) 16KB,2x8KB,32KB,31x64KB

  • Size: 2048 KB in 35 Sectors

  • Sector Start Addresses:

  • S00 @ 0x01000000 ! S01 @ 0x01004000 ! S02 @ 0x01006000 !

  • S03 @ 0x01008000 ! S04 @ 0x01010000 ! S05 @ 0x01020000 !

  • S06 @ 0x01030000 S07 @ 0x01040000 S08 @ 0x01050000

  • S09 @ 0x01060000 S10 @ 0x01070000 S11 @ 0x01080000

  • S12 @ 0x01090000 S13 @ 0x010A0000 S14 @ 0x010B0000

  • S15 @ 0x010C0000 S16 @ 0x010D0000 S17 @ 0x010E0000

  • S18 @ 0x010F0000 S19 @ 0x01100000 S20 @ 0x01110000

  • S21 @ 0x01120000 S22 @ 0x01130000 S23 @ 0x01140000

  • S24 @ 0x01150000 S25 @ 0x01160000 S26 @ 0x01170000

  • S27 @ 0x01180000 S28 @ 0x01190000 S29 @ 0x011A0000

  • S30 @ 0x011B0000 S31 @ 0x011C0000 S32 @ 0x011D0000

  • S33 @ 0x011E0000 S34 @ 0x011F0000


System information2

System information

  • help (or ‘?’)

    • Description: Print online help

    • Usage: help [command]

    • Example: help erase

  • Iminfo

    • Description: Display information of uImage which is stored in RAM

    • Usage: iminfo addr [addr ...]

    • Example: iminfo 0x500000

erase start end

- erase FLASH from addr 'start' to addr 'end'

erase N:SF[-SL]

- erase sectors SF-SL in FLASH bank # N

erase bank N

- erase FLASH bank # N

erase all

- erase all FLASH banks

## Checking Image at 00500000 ...

Image Name: Linux 2.4

Image Type: ARM Linux Kernel Image (gzip compressed)

Data Size: 1231207 Bytes = 1.2 MB

Load Address: 00008000

Entry Point: 00008000

Verifying Checksum ... OK


System information3

System information

  • imls

    • Description: Display information of all supported images which are stored in FLASH

    • Usage: imls

    • Example: imls

  • version

    • Description: Display U-Boot version information

    • Usage: version

    • Example: version

Image at 01030000:

Image Name: Linux 2.4

Image Type: ARM Linux Kernel Image (gzip compressed)

Data Size: 1044044 Bytes = 1019.6 kB

Load Address: 00008000

Entry Point: 00008000

Verifying Checksum ... OK

U-Boot 1.1.2 (Sep 14 2005 - 17:49:29)


Outline12

Outline

3.1 Introduction to U-Boot

3.2 U-Boot commands

  • System information

  • Environment variable

  • Memory

  • File transfer

  • Boot and execute

  • Miscellaneous


Environment variable

Environment variable

  • printenv (or print)

    • Description: Print all or specific environment variables

    • Usage: printenv [env_name]

    • Example: printenv

  • setenv (or set)

    • Description: Set environment variable

    • Usage: setenv name value

    • Example: setenv ipaddr 192.168.0.5

baudrate=19200

ethaddr=00:40:95:36:35:33

bootdelay=3

bootcmd=bootm 0x1030000

stdin=serial

stdout=serial

stderr=serial

netmask=255.255.255.0

ipaddr=192.168.0.11

serverip=192.168.0.254

Environment size: 215/4092 bytes


Environment variable1

Environment variable

  • saveenv

    • Description: Save and store environment variables in FLASH

    • Usage: saveenv

    • Example: saveenv

  • run

    • Description: Run commands in an environment variable

    • Usage: run var [...]

    • Example: setenv var1 version; run var1

Saving Environment to Flash...

Un-Protected 1 sectors

Erasing Flash...

Erasing Sector 5 @ 0x01020000 ... done

Erased 1 sectors

Writing to Flash... ........ done

Protected 1 sectors

U-Boot 1.1.2 (Sep 14 2005 - 17:49:29)


Environment variable2

Environment variable

  • echo

    • Description: Echo args to console

    • Usage: echo [args ...]

    • Example: echo IP Address = $(ipaddr)

    • Exp. Note: To obtain the content of environment variables, the form $(var_name) is used in U-Boot.

IP Address = 192.168.0.11


Outline13

Outline

6.1 Introduction to U-Boot

6.2 U-Boot commands

  • System information

  • Environment variable

  • Memory

  • File transfer

  • Boot and execute

  • Miscellaneous

    6.3 Building U-Boot

    6.4 Building uClinux

  • The make procedure

  • Inside the Makefile

    6.5 Booting uClinux via U-Boot

  • Booting from RAM

  • Booting from FLASH


Memory

Memory

  • base

    • Description: Print or set address offset

    • Usage: base [address]

    • Example: base 0x1000000

  • cp

    • Description: Memory copy

    • Usage: cp [.b, .w, .l] source destination count

    • Example: cp.w 0x10000 0x20000 1000

    • Exp. Note: The unit of data length can be 1-byte (.b), 2-byte (.w) or 4-byte (.l). In this example, 2 x 4096 (0x1000) bytes data will be copied from address 0x10000 to 0x20000.

  • cmp

    • Description: Memory compare

    • Usage: cmp [.b, .w, .l] addr1 addr2 count

    • Example: cmp 0x10000 0x20000 1000

Base Address: 0x00100000

Total of 4096 words were the same


Memory1

Memory

  • md

    • Description: Memory display

    • Usage: md [.b, .w, .l] address [# of objects]

    • Example: md 0x1020000

01020000: e9ffad2f 64756162 65746172 3239313d /...baudrate=192

01020010: 65003030 64616874 303d7264 30343a30 00.ethaddr=00:40

01020020: 3a35393a 333a3633 33333a35 74656e00 :95:36:35:33.net

01020030: 6b73616d 3535323d 3535322e 3535322e mask=255.255.255

01020040: 6900302e 64646170 39313d72 36312e32 .0.ipaddr=192.16

01020050: 2e302e38 73003131 65767265 3d706972 8.0.11.serverip=

01020060: 2e323931 2e383631 35322e30 6f620034 192.168.0.254.bo

01020070: 6564746f 3d79616c 6f620033 6d63746f otdelay=3.bootcm

01020080: 6f623d64 206d746f 30317830 30303033 d=bootm 0x103000

01020090: 74730030 3d6e6964 69726573 73006c61 0.stdin=serial.s

010200a0: 756f6474 65733d74 6c616972 64747300 tdout=serial.std

010200b0: 3d727265 69726573 00006c61 00000033 err=serial..3...

010200c0: 00000000 00000000 00000000 00000000 ................


Memory2

Memory

  • mm

    • Description: Memory modify (auto-incrementing)

    • Usage: mm [.b, .w, .l] address

    • Example: mm 0x10000

    • Exp. Note: Press Ctrl+C to escape modification.

  • nm

    • Description: Memory modify (constant address)

    • Usage: nm [.b, .w, .l] address

    • Example: nm 0x10000

  • mtest

    • Description: Simple RAM test

    • Usage: mtest [start [end [pattern]]]

    • Example: mtest 0x10000 0x20000

00010000: 00c20000 ? ffffffff

00010004: 00c22000 ? 55aa55aa

00010008: 00000114 ?

00010000: 000055aa ? ff00ff00

00010000: ff00ff00 ? aa55aa55

00010000: aa55aa55 ?

Pattern FFFFFF11 Writing... Reading...


Memory3

Memory

  • mw

    • Description: Memory write (fill)

    • Usage: mw [.b, .w, .l] address value [count]

    • Example: mw 0x10000 55aa 1000; md 0x10000

00010000: 000055aa 000055aa 000055aa 000055aa .U...U...U...U..

00010010: 000055aa 000055aa 000055aa 000055aa .U...U...U...U..

00010020: 000055aa 000055aa 000055aa 000055aa .U...U...U...U..

00010030: 000055aa 000055aa 000055aa 000055aa .U...U...U...U..

00010040: 000055aa 000055aa 000055aa 000055aa .U...U...U...U..

00010050: 000055aa 000055aa 000055aa 000055aa .U...U...U...U..

00010060: 000055aa 000055aa 000055aa 000055aa .U...U...U...U..

00010070: 000055aa 000055aa 000055aa 000055aa .U...U...U...U..

00010080: 000055aa 000055aa 000055aa 000055aa .U...U...U...U..

00010090: 000055aa 000055aa 000055aa 000055aa .U...U...U...U..

000100a0: 000055aa 000055aa 000055aa 000055aa .U...U...U...U..

... snipped


Memory4

Memory

  • erase (or era)

    • Description: Erase FLASH memory

    • Usage: erase N:SF[-SL]; erase start_addr end_addr

    • Example1: erase 1:33-34 (erase sector 33 - 34 of chip #1)

    • Example2: erase 0x11e0000 0x11effff

    • Exp2. Note: If absolute address is used, the end_addr must be at the boundary of the last sector you are erasing. (that is, end_addr = start_addr_of_next_sector - 1)

  • protect

    • Description: Enable or disable FLASH write protection

    • Usage: protect on/off N:SF[-SL]; protect on start_addr end_addr

    • Example: protect on 1:30; flinfo

Erase Flash Sectors 33-34 in Bank # 1

Erasing Sector 33 @ 0x011e0000 ... done

Erasing Sector 34 @ 0x011f0000 ... done

Erasing Sector 33 @ 0x011e0000 ... done

Erased 1 sectors

Protect Flash Sectors 30-30 in Bank # 1

Bank # 1: MXIC MX29LV160AB (2MB) 16KB,2x8KB,32KB,31x64KB

Size: 2048 KB in 35 Sectors

Sector Start Addresses:

… S30 @ 0x011B0000! S31 @ 0x011C0000 S32 @ 0x011D0000 …


Outline14

Outline

3.1 Introduction to U-Boot

3.2 U-Boot commands

  • System information

  • Environment variable

  • Memory

  • File transfer

  • Boot and execute

  • Miscellaneous


File transfer

File transfer

  • loadb

    • Description: Load binary file over serial line (kermit mode)

    • Usage: loadb [address] [baud]

    • Example: loadb 8000

    • Exp. Note: ‘Kermit protocol’ is used for all serial line transfering.

  • loads

    • Description: Load S-Record file over serial line

    • Usage: loads [offset]

    • Example: loads 40100000

## Ready for binary (kermit) download to 0x00008000 at 19200 bps...

## Ready for S-Record download ...

~>examples/image.srec

1 2 3 4 5 6 7 8 9 10 11 12 13 ...

...

15989 15990 15991 15992

[file transfer complete]

[connected]

## Start Addr = 0x00000000


File transfer1

File transfer

  • nfs

    • Description: Load binary file via network using nfs protocol

    • Usage: nfs [loadAddress] [host ip addr:bootfilename]

    • Example: nfs 8000 192.168.0.254:/home/Kenny/uClinux2.6.9.ram

    • Exp. Note: You first have to setup a NFS Server and export the share directory (/home/Kenny in this example) in the host computer for NFS Client.

  • rarpboot (or rarp)

    • Description: Load image via network using RARP/TFTP protocol

    • Usage: rarpboot [loadAddress] [bootfilename]

    • Example: rarpboot 8000 uClinux2.6.9.ram

File transfer via NFS from server 192.168.0.254;

our IP address is 192.168.0.11

Filename '/home/Kenny/uClinux2.6.9.ram'.

Load address: 0x8000

Loading: ######################################################

###############################################################

###############################################################

###############################################################

#############################################

done

Bytes transferred = 2498796 (2620ec hex)


File transfer2

File transfer

  • tftpboot (or tftp)

    • Description: Load binary file via network using tftp protocol

    • Usage: tftpboot [loadAddress] [bootfilename]

    • Example: tftpboot 8000 uClinux2.6.9.ram

    • Exp. Note: Environment variables $(ipadder) and $(serverip) will be used as the default client and server IP address.

TFTP from server 192.168.0.254; our IP address is 192.168.0.11

Filename 'uClinux2.6.9.ram'.

Load address: 0x8000

Loading:

###############################################################

###############################################################

###############################################################

###############################################################

####################################

done

Bytes transferred = 2498796 (2620ec hex)

NOTE: After file transfer is done, system generates environment variables $(fileaddr) and $(filesize)

to keep track of the address and size of the transferred file. (Whatever transfer mode is used!)


Outline15

Outline

3.1 Introduction to U-Boot

3.2 U-Boot commands

  • System information

  • Environment variable

  • Memory

  • File transfer

  • Boot and execute

  • Miscellaneous


Boot and execute

Boot and execute

  • boot

    • Description: Execute the boot command specified in $(bootcmd)

    • Usage: boot

    • Example: set bootcmd go 0x8000; boot

  • bootm

    • Description: Boot application image from memory

    • Usage: bootm [addr [arg ...]]

    • Example: bootm 0x1030000

    • Exp. Note: bootm only supports uImage and S-Record images.

## Booting image at 01030000 ...

Image Name: Linux 2.4

Image Type: ARM Linux Kernel Image (gzip compressed)

Data Size: 1044044 Bytes = 1019.6 kB

Load Address: 00008000

Entry Point: 00008000

Verifying Checksum ... OK

Uncompressing Kernel Image ... OK

Starting kernel ...


Boot and execute1

Boot and execute

  • bootp

    • Description: Boot image via network using BootP/TFTP protocol

    • Usage: bootp [loadAddress] [bootfilename]

    • Example: bootp

  • go

    • Description: Start application at specified address

    • Usage: go addr [arg ...]

    • Example1: tftp 8000 uClinux.ram; go 8000

    • Example2: tftp 10000 hello_world.bin; go 10000 Hello World!

## Starting application at 0x00008000 ...

Starting kernel ...

## Starting application at 0x00010000 ...

Hello World!

argc = 3

argv[0] = "10000"

argv[1] = "Hello"

argv[2] = "World!"

argv[3] = "<NULL>"

Hit any key to exit ...


Outline16

Outline

3.1 Introduction to U-Boot

3.2 U-Boot commands

  • System information

  • Environment variable

  • Memory

  • File transfer

  • Boot and execute

  • Miscellaneous


Miscellaneous

Miscellaneous

  • crc32

    • Description: Checksum calculation

    • Usage: crc32 address count

    • Example: crc32 0x100000 1000

  • ping

    • Description: Send ICMP ECHO_REQUEST packets to network hosts

    • Usage: ping ipAddress

    • Example: ping 192.168.0.254

  • reset

    • Description: Restart system

    • Usage: reset

    • Example: reset

  • sleep

    • Description: Delay amount of time (in seconds)

    • Usage: sleep N_decimal_sec

    • Example: sleep 5 (delay 5 seconds)

CRC32 for 00100000 ... 00100fff ==> 22524718

host 192.168.0.254 is alive


Professor mon chau shie 2010

END


  • Login