嵌入式 Linux 系統介紹

43
嵌嵌嵌 Linux 嵌嵌嵌嵌 D O C Num ber RM -033-04-420 D O C Version V1.00 R elease D ate 2007-08-24 M odule N am e 嵌嵌嵌 Linux嵌 嵌 嵌 嵌 Platform C reator X S cale-PX A 270 C ategory em bedded Linux D ifficulty basic Experim ent tim e Lecture 60-90 m inutes O peration 30-60 m inutes Key W ord XSCALE, PXA270, CREATO R , U ser A pplication Author M icrotim e Com puter Inc. http//w w w.m icrotim e.com .tw

description

嵌入式 Linux 系統介紹. 實習規範. 目的 規格 關聯 背景需求 設備需求. 目的. 瞭解嵌入式 Linux 系統架構和一個完整的開發環境包含了拿些應用工具,並針對除錯、編譯等 … 開發環境一一說明。. 技術背景 - 設備需求. 技術背景需求 具 C 語言程式設計基礎 設備需求 H/W requirements : PC Host , COM port ,網路 Hub , Creator XCsale-PXA270 Development Kit S/W requirements : - PowerPoint PPT Presentation

Transcript of 嵌入式 Linux 系統介紹

Page 1: 嵌入式 Linux 系統介紹

嵌入式 Linux 系統介紹DOC Number : RM-033-04-420

DOC Version : V1.00

Release Date : 2007-08-24

Module Name : 嵌入式 Linux 系統介紹

Platform : Creator XScale-PXA270

Category : embedded Linux

Difficulty : basic

Experiment time : Lecture : 60-90 minutes

Operation : 30-60 minutes

Key Word : XSCALE, PXA270, CREATOR, User Application

Author : Microtime Computer Inc. http:/ /www.microtime.com.tw

Page 2: 嵌入式 Linux 系統介紹

實習規範

目的 規格 關聯 背景需求 設備需求

Page 3: 嵌入式 Linux 系統介紹

33

目的

瞭解嵌入式 Linux 系統架構和一個完整的開發環境包含了拿些應用工具,並針對除錯、編譯等…開發環境一一說明。

Page 4: 嵌入式 Linux 系統介紹

44

技術背景 - 設備需求 技術背景需求

具 C 語言程式設計基礎 設備需求

H/W requirements : PC Host , COM port ,網路 Hub , Creator XCsale-PXA270 Development Kit

S/W requirements : Linux for Creator XScale-PXA270 user guide :檔案在 Linux for Creator XScale-

PXA270 光碟中 Linux\Doc 路徑下。 Create-XScale-PXA270 User’s Guide 。 通訊軟體:例如 Windows 的超級終端機

Page 5: 嵌入式 Linux 系統介紹

實習系統概論

簡介 系統架構 電路架構 程式流程

Page 6: 嵌入式 Linux 系統介紹

66

簡介本章實習的主要內容,在於說明何謂 Embedded Linux 系統、架構及其開發環境,所以將針對下列幾點加以說明:

說明嵌入式系統為何,及 Embedded Linux 系統的優缺點和應用範圍。

說明 Embedded Linux 系統架構。 說明 CreateXScale-PXA270 嵌入式系統發展工具解決方案

,包含如下三個部分: Windows Host 端—除錯環境 Linux Host 端—編譯環境 Linux Target 端— Target Board

Page 7: 嵌入式 Linux 系統介紹

77

系統架構

ICE / JTAGICE / JTAG

mtdd/gdbservermtdd/gdbserver

Linux target

CodeLyzerCodeLyzer

DomingoDomingo

Window Host

Samba ServerSamba Server

NFS ServerNFS Server

Linux Host

Ethernet

Print port

port / mountport / mount

LinuxKernel Source

LinuxKernel Source

Flash:Linux kernel

RootFS

Flash:Linux kernel

RootFS

TFTP ServerTFTP Server

TFTP ClientTFTP Client

Page 8: 嵌入式 Linux 系統介紹

88

電路架構

CN

17 U

9

U15

G

BBBB

U1BB

CN6

U8

J2

CN8

J1

1 2 3 4 5 6

7 8 9101112

AB

12x

6x

8x

2x

9x

3x

10x

4x

11x

5x

7x

1x

Ethernet

A

12x

6x

8x

2x

9x

3x

10x

4x

11x

5x

7x

1x

C

POWERFAULT DATA ALARM

JTAG-ICE

HUB

5V DC

Printer Cable

Ethernet Cable

RS-232 Null Cable

Creator PXA270Main Board

PowerSW

Ethernet CableJTAG Cable

110V AC

5V Cable

Base Board

SOM Board

Windows HostFor ethernet download(optional)Hyper-Terminal

in U-Boot For debug use(optional)

TFT-CLD

COM2

Virtual MachineLinux Host

Page 9: 嵌入式 Linux 系統介紹

基礎知識 嵌入式系統導覽 Embedded Linux 架構 完整的嵌入式系統發展工具解決方案 Windows Host 端─除錯環境介紹 Linux Host 端─編譯環境介紹 Linux Target 端─ Target Board 介紹 Linux Target 端和 Windows Host 端接線說明

Page 10: 嵌入式 Linux 系統介紹

1010

嵌入式系統導覽 常見的嵌入式硬體

X86 架構 ARM 架構 MIPS 架構 PowerPC 架構 其他: m68k 、 8051..

等等

常見的嵌入式作業系統 MS-DOS

Windows CE

Palm OS

EPOC

Symbain OS

即時嵌入式系統 Embedded Linux

Page 11: 嵌入式 Linux 系統介紹

1111

嵌入式系統導覽 (cont.)

Embedded Linux 的優點 開放原始碼,模組化設

計 高度穩定性 強化的網路功能 可以跨越各種硬體平台 應用軟體眾多

嵌入式 Linux 的應用範圍 PDA

Web PDA

Set-Top-Box

Cell phones and web

phones

各樣網路相關 Box

Page 12: 嵌入式 Linux 系統介紹

1212

Embedded Linux 架構

USER

Application utilities

Linux Kernel

BI OSBootloader

H/W initialization

Device driver

Hardware

Tool

CompilerDebugger

I CECompilerDebugger

I CELA. SCOPEI C Tool

USER

AP S/ W

Embedded Linux

H/ W

Page 13: 嵌入式 Linux 系統介紹

131313

Linux Kernel architecture Architecture of a generic Linux

system

Ref. [3]

Page 14: 嵌入式 Linux 系統介紹

1414

完整的嵌入式系統發展工具解決方案 一個完整的嵌入式系統發展工具解決方案包含,如下:

線路實體模擬器 (In-Circuit Emulator , ICE) 、 系統發展板 (Evaluation Board) 、 應用程式整合開發除錯工具 (Debugger)

編譯器 (Compiler)

Creator-XScale-PXA270 嵌入式系統 開發環境的稱謂

發展環境 稱謂編譯環境 Linux Host端除錯環境 Windows Host端

Target board Linux Target端

Page 15: 嵌入式 Linux 系統介紹

1515

完整的嵌入式系統發展工具解決方案(cont.)

Creator-

XScale-

PXA270 嵌入式系統架構圖

Linux Host

端為獨立 PC

模式

ICE / JTAGICE / JTAG

mtdd/gdbservermtdd/gdbserver

Linux target

CodeLyzerCodeLyzer

DomingoDomingo

Window Host

Samba ServerSamba Server

NFS ServerNFS Server

Linux Host

Ethernet

Print port

port / mountport / mount

LinuxKernel Source

LinuxKernel Source

Flash:Linux kernel

RootFS

Flash:Linux kernel

RootFS

TFTP ServerTFTP Server

TFTP ClientTFTP Client

Page 16: 嵌入式 Linux 系統介紹

1616

完整的嵌入式系統發展工具解決方案(cont.)

Linux Host

端為 Virtual

Machine 模式

ICE/JTAGICE/JTAG

mtdd/gdbservermtdd/gdbserver

Linux target

CodeLyzerCodeLyzer

DomingoDomingo

Samba ServerSamba Server

NFS ServerNFS Server

Linux Host

Ethernet

Printport

port/mountport/mount

LinuxKernelSource

LinuxKernelSource

Flash:Linux kernelRootFS

Flash:Linux kernelRootFS

TFTP ServerTFTP Server

TFTP ClientTFTP Client

Virtual MachineVirtual Machine

Page 17: 嵌入式 Linux 系統介紹

1717

完整的嵌入式系統發展工具解決方案(cont.)

Linux Host 端:提供編譯環境 Linux Host 端:扮演開發系統中的編譯環境部分,因為是用 GNU

的 compiler 所以需要安裝 Linux 作業系統,。 目的是用來製作和編譯要放在 Linux Target 端的 Boot

loader 、 Embedded Linux Kernel 、 root filesystem 等…image 檔。

Samba Server :建立 Linux Host 端 Samba Server 分享目錄的網路磁碟機。以達到 Linux Host 端和 Windows Host 端的檔案資源共享。

NFS Server : Linux Target 端掛載 Linux Host 端 NFS server 分享的檔案系統。以達到 Linux Host 端和 Linux Target 端的檔案資源共享。

Page 18: 嵌入式 Linux 系統介紹

1818

完整的嵌入式系統發展工具解決方案(cont.)

Windows Host 端:提供除錯環境 Window Host 端:扮演開發系統中的除錯環境部分,所以安裝

Domingo for Linux 及 CodeLyzer 這兩個除錯軟體。 Domingo for Linux :提供 Embedded Linux Kernel 及 Device

Driver 的除錯。 CodeLyzer :提供 Embedded Linux User Application 的除錯。 Virtual Machine :利用 Virtual PC 或 VMware 軟體,建立一個虛擬

空間並安裝 Linux Host 端的作業系統

Linux Target 端: 提供 EmbeddedCreator-XScale-PXA27 Target Board ,新華電腦

所提供的 Creator 開發學習版。

Page 19: 嵌入式 Linux 系統介紹

1919

Windows Host 端─除錯環境介紹 Embedded Linux 核心除錯工具

列印訊息法 (printk)

訊息記錄 (klogd/syslogd)

查詢除錯法 (proc)

Domingo for Linux

Embedded Linux 應用程式除錯工具 列印訊息法 (printf)

記憶體配置除錯 (memwatch/YAMD)

系統呼叫追蹤 (strace)

GDB/Insight

CodeLyzer

Page 20: 嵌入式 Linux 系統介紹

2020

Windows Host 端─除錯環境介紹(cont.)

Domingo for Linux

一套整合開發、驗證、燒錄及除錯的整合開發除錯軟體,其主要的功能說明如下:

整合操作視窗 提供使用 ICE 硬體資源時的設定管道 CPU 資源之觀察及修改 待發展程式之觀察,修改及執行 組合語言及高階語言除錯 Nor/Nand Flash 燒錄功能 在 Embedded Linux 系統中,提供針對 Linux Kernel 及 Device Driver 的除錯

Page 21: 嵌入式 Linux 系統介紹

2121

Windows Host 端—除錯環境介紹 (cont.)

除錯軟體— Domingo for Linux 介面介紹

Page 22: 嵌入式 Linux 系統介紹

2222

Windows Host 端─除錯環境介紹(cont.)

CodeLyzer

一套針對 Embedded Linux 中 User application 的除錯軟體,其主要的功能說明如下:

提供視窗化的整合除錯資訊 在 Embedded Linux 系統中,提供針對 user application 的除錯 提供 multi-process 的除錯模式 提供 multi-thread 的除錯模式 提供變數、中斷點、記憶體、程式等…除錯視窗

Page 23: 嵌入式 Linux 系統介紹

2323

Windows Host 端—除錯環境介紹 (cont.)

除錯軟體— CodeLyzer 介面介紹

Page 24: 嵌入式 Linux 系統介紹

2424

Linux Host 端─編譯環境介紹 安裝 Linux 作業系統

獨立的 PC 安裝 Linux 作業系統 在 Windows Host 上安裝 Linux 作業系統

Embedded Linux Kernel Image 的編譯和驗證 安裝 Tool Chain—GCC(GNU Cross Compiler Tool

Chain)

Embedded Linux Kernel 程式碼版本

Page 25: 嵌入式 Linux 系統介紹

2525

Linux Host 端—編譯環境介紹 (2)

Virtual PC

VMware

Page 26: 嵌入式 Linux 系統介紹

2626

Linux Host 端─編譯環境介紹(cont.)

編譯 Kernel Image Make menuconfig Make mrproper make dep make clean make zImage make modules make modules_install make install

驗證 Kernel Image

Page 27: 嵌入式 Linux 系統介紹

2727

Linux Host 端─編譯環境介紹(cont.)

Bootloader— 開機引導程式 啟動載入( Boot Loading )模式 下載模式( Downloading )模式

Linux Target 端的根目錄檔案系統 最起碼的目錄: /dev,/proc,/bin,/etc,/lib,/usr,/tmp 。 基本的工具程式: sh,ls,cp,mv,etc. 。 最起碼的組態設定檔: rc,inittab,fstab,etc. 。 設備檔: /dev/hd*,/dev/tty*,/dev/fd0,etc. 。 Runtime 函式庫以提供工具程式所使用之基本功能 (functions) 。

Page 28: 嵌入式 Linux 系統介紹

2828

Linux Host 端─編譯環境介紹(cont.)

Samba Server Network File System 的縮寫,意思是“網

路檔案系統”,最主要功能,在於提供各種不同硬體架構,不限任何作業系統的電腦,可以透過網路,達到分享彼此檔案的目的

我們將利用 Linux Host 端的這項功能,使得 Linux Target 端 (CreatorXScale-PXA270) 可以方便取得製作 Linux Host 端完成的程式碼,進行測試。

Page 29: 嵌入式 Linux 系統介紹

2929

Linux Host 端─編譯環境介紹(cont.)

NFS Server 是延伸自 SMB(Server Message Block) 的代名詞,其主要功能,在於提供 Linux Host 端的目錄與 Windows Host 端進行檔案資料共享。 Windows Host 端建立一個網路磁碟機對映到 Samba Server 所分享的目錄。

所以 Domingo for Linux便可藉由這個網路磁碟機直接取得 Linux Host 端編譯完成的Kernel image 檔。

Page 30: 嵌入式 Linux 系統介紹

3030

Linux Target 端─ Target Board 介紹

Creator 嵌入式發展系統母板

Page 31: 嵌入式 Linux 系統介紹

3131

Linux Target 端─ Target Board 介紹 (cont.)

Creator母版 Master 和 Slave bus 的支援

Page 32: 嵌入式 Linux 系統介紹

3232

Linux Target 端─ Target Board 介紹 (cont.)

Creator-XScale-PXA270 嵌入式系統 Flash 的配置u-boot.bin

U-BOOT 128K

128K

768K

3.5M

15M

0000 - 0000

0002 - 0000

0004 - 0000

0010 - 0000

0048 - 0000

0138 - 0000

01FF - FFFF

U-BOOT Parameter

diag_ram.bin

Diagnostic ProgramuImage.bin

Linux Kernelrootfs.jffs2.pxa270

Linux File Sysetm

Reserved

Page 33: 嵌入式 Linux 系統介紹

3333

Linux Target 端和 Windows Host 端接線說明

Windows Host 端和 Carrier ICE 、 Target Board 的接線圖

PC Host

Debugger

Carrier ICE

External Trigger connector

Current Measurement Module

CreatorSpeaker

Microphone

ARM POD

CMOS sensor

Page 34: 嵌入式 Linux 系統介紹

3434

Linux Target 端和 Windows Host 端接線說明 (cont.)

Windows Host 端和 Pocket ARM ICE 、 Target Board 的接線圖

Compact Flash Card

To PC

Pocket ARM ICE

Current Measurement Module

Creator

Speaker

Microphone

Power

CMOS sensor

Page 35: 嵌入式 Linux 系統介紹

3535

Linux Target 端和 Windows Host 端接線說明

CN

17 U

9

U15

G

BBBB

U1BB

CN6

U8

J2

CN8

J1

1 2 3 4 5 6

7 8 9101112

AB

12x

6x

8x

2x

9x

3x

10x

4x

11x

5x

7x

1x

Ethernet

A

12x

6x

8x

2x

9x

3x

10x

4x

11x

5x

7x

1x

C

POWERFAULT DATA ALARM

JTAG-ICE

HUB

5V DC

Printer Cable

Ethernet Cable

RS-232 Null Cable

Creator PXA270Main Board

PowerSW

Ethernet CableJTAG Cable

110V AC

5V Cable

Base Board

SOM Board

Windows HostFor ethernet download(optional)Hyper-Terminal

in U-Boot For debug use(optional)

TFT-CLD

COM2

Virtual MachineLinux Host

Page 36: 嵌入式 Linux 系統介紹

實習步驟

系統軟硬體設置 實習一: Virtual PC 安裝實作說明 實習二: Fedora Core 5.0 安裝實作說明

Page 37: 嵌入式 Linux 系統介紹

3737

系統設置 系統軟硬體的設置

建立 Windows Host 端、 Linux Host 端、 Linux Target 端三者之間的硬體環境連結。

建立 Linux Host 端的編譯環境。

實作程式碼設置

Page 38: 嵌入式 Linux 系統介紹

3838

實習一: Virtual PC 安裝實作說明 安裝 Virtual PC

建立 New Virtual Machine

Virtual Machine 的相關設定 Virtual Disk

Page 39: 嵌入式 Linux 系統介紹

3939

實習二: Fedora Core 5.0 安裝實作說明(1)

安裝前的建議

Virtual PC 在安裝 Virtual Machine 時,支援’安裝光碟’及’ ISO 檔’兩種安裝模式,雖然兩種模式都能順利安裝 Fedora Core 5.0 ,但是建議利用’ ISO 檔’的安裝模式,以減少安裝的時間。

Page 40: 嵌入式 Linux 系統介紹

4040

實習二: Fedora Core 5.0 安裝實作說明(2)

安裝 Fedora Core 5.0

Firewall 跟 SELinux 要設定為Disabled

Display 的設定: Color

Depth 設定為” Thousands

of Colors”

Page 41: 嵌入式 Linux 系統介紹

實作開始

操作時間 : 20 min

Page 42: 嵌入式 Linux 系統介紹

4242

習作及參考資料 習作

Exe_1

參考資料

[1] Intel PXA270 Processor Family Developer's Manual

[2] RM-033-04-100 : Introduction to Creator XScale-PXA270

[3] RM-033-04-101 : Creator PXA270 experiment environment overview

[4] Creator PreSOCes Development Kit User's Guide

Page 43: 嵌入式 Linux 系統介紹

Q & A