2004-06-29 1
Development Implementation on Embedded uClinux
新華電腦 總經理 陳明福
2004-06-29 2
Topics
1.SOC 嵌入式系統介紹
2.SOC 嵌入式系統應用、開發考量
3.技術門檻與工具
2004-06-29 3
SOC 嵌入式系統介紹
2004-06-29 4
1. uClinux/Linux 存在的理由
• Open source
• 創造競爭,大家受惠• SOC 強烈的需求
2004-06-29 5
2.何謂 SOC Embedded system
• SOC Chip
• S/W Embedded in system chip
• Fixed purpose of application
• Application type vs. Development type
2004-06-29 6
• 穩定的系統• 免費或少許費用• 安全性、漏洞修補• 多工、多使用者• 使用者與群組的規劃• 相對較不耗資源
3. uClinux / Linux 優點
2004-06-29 7
• 無特定廠商支援• GUI 不夠成熟• 學習門檻高
4. uClinux / Linux 劣點
2004-06-29 8
5. Embedded Linux Structure
USER
Application utilities
Linux OS
BIOSBootloader
H/Winitialization
Devicedriver
Hardware
Tool
CompilerDebugger
ICECompilerDebugger
ICELA. SCOPEIC Tool
USER
AP S/W
EmbeddedLinux
H/W
2004-06-29 9
6.在 SOC 中會含有那些 IP 元件
• CPU core (ARM7, ARM9, ARM10, ARM11)
• Memory: Cache, RAM, Flash
• Communication: UART, USB, Ethernet
• Bus Interface:I2C,CAN, SPI, PCI
• I/O Peripheral: GPIO, LCD, PWM, ADC
• System control: MMU, DMA, WDT, RTC
弱水三千,只取一瓢飲弱水三千,只取一瓢飲
2004-06-29 10
SOC 嵌入式系統應用、開發考量
2004-06-29 11
7. SOC 嵌入式應用型的考量因素
• Turn-key Solution vs. Self-construct• SOC Selection• OS Selection• Assembly, C• Development
---ICE---Debugger---Compiler---Programmer (In-System programming)
2004-06-29 12
8. SOC 嵌入式開發型的考量因素
• OS selection or Self-Construct • Tool & S/W Development • Co-design verification 的難題
2004-06-29 13
技術門檻與工具
2004-06-29 14
9.良師與工具
• SOC E. S. 軟硬體整合技術門檻高----- 老師的辛苦
• 老師的辛苦成就學生一生的感恩• 何種工具是老師的幫手 - Hardware Platform
- uClinux / Linux debugging tool
- FPGA tool
2004-06-29 15
10.SOC Embedded System開發平台
• Debugger for uClinux / Linux
• ICE
• Motherboard- CreatorModule Changeable Architecture in ARM7, ARM9, SOPC, FPGA, DSP etc. (NIOS, MIPS in the future )
• Daughter Board- Create S3C4510, Create ARM920T-S3C2410, Create ARM922T-EPXA1, Create FPGA-XC2S, Create FPGA-EP1C6, Create TIDSP-5502
2004-06-29 16
11.Pre-SOC 嵌入式開發、訓練平台
2004-06-29 17
12.在 Creator 上的硬體架構
U5
JP11JP12
JP13
JH2
P2 P1
JH1 J4
UARTPort
ExpansionMemory
Connector
FPGAConnector
CF CardSlot
128*128LCD
4*4Key Pads
CMOSCameraModule
Master BusSlaveBus
Creator
J65VDC
Top view on Creator
2004-06-29 18
Embedded uClinuxEmbedded uClinux實作解析實作解析
2004-06-29 19
Topics
1. Linux 跟 uClinux 有什麼不同2.系統環境的模擬 – Cygwin
3. Build uClinux Image
4.啟動 uClinux
5. Boot loader
6. Device Driver
7. User Application
8. Debugging
2004-06-29 20
Linux 跟 uClinux 有什麼不同
2004-06-29 21
核心 (kernel)
• no MMU
• no fork(), vfork()
• romfs
• uclibc
2004-06-29 22
Filesystem
• Ext2–Linux 標準的配備
• JFFS2–適用嵌入式系統
• Tmpfs–不需要久存的
2004-06-29 23
系統環境的模擬 — Cygwin
2004-06-29 24
Cygwin 安裝
2004-06-29 25
Cygwin 安裝
• DLL(cygwin1.dll)
• Toolchain
2004-06-29 26
環境的模擬
2004-06-29 27
Build uClinux Image
2004-06-29 28
uClinux Image 裡有什麼 ?• Bootloader
• Root File System
• Kernel
2004-06-29 29
Toolchain
2004-06-29 30
make xconfig
2004-06-29 31
Start building
• make dep
• make lib_only
• make user_only
• make romfs
• make image
• make
2004-06-29 32
啟動 uClinux
2004-06-29 33
載入程式
• Debugger –
Domingo for uClinux
• 載入至 RAM 區或燒錄至 flash ROM
2004-06-29 34
建立 UART console monitor
2004-06-29 35
執行與觀察
2004-06-29 36
Boot loader
2004-06-29 37
• 初始化 CPU 速度• 初始化記憶體• 初始化序列埠• 啓用指令/資料快取記憶體• 設置堆疊指標• 設置參數區域並構造參數結構和標記• 跳轉到 Kernel 的開始
Boot loader 的作用
2004-06-29 38
Device driver
2004-06-29 39
Device Driver 的作用
• 對設備初始化和釋放 .
• 把資料從 kernel 傳送到硬體和從硬體讀取資料 .
• 讀取應用程式傳送給設備文件的資料和回送應用程式請求的資料 .
• 檢測和處理設備出現的錯誤 .
2004-06-29 40
Device Driver 的類型
• Character Devices– 以不定長度的字元傳遞資料– 印表機、終端機
• Block Devices– 以固定大小長度傳遞資料– 硬碟機、光碟機
• Network interfaces
2004-06-29 41
Kernel 與 device driver 的連結
• 靜態連結• 動態載入
– NFS (Network FileSystem)
– TFTP (Trivial File Transfer Protocol)
2004-06-29 42
User Application
2004-06-29 43
Examples – Creator CCM demo
CreatorCCM
ARMCPU
RJ-45 網 路線
2004-06-29 44
Requirements
• NFS 的安裝• ifconfig 的設定• 編譯 device driver 和 Application
– config.in
– Makefile
• Make new kernel
• Make module
• Make user application – make user_only
2004-06-29 45
Debugging
2004-06-29 46
• Debugging by Printing– 優點 : kernel 提供函數 printk– 缺點 : 需修改程式並重新編譯 , 且影響效率
• Debugging by Querying– 優點 : 可於 kernel 中選擇加入 proc 檔案系統– 缺點 : 僅提供相關系統資訊
• Debuggers and Related Tools– Using gdb
– 優點 : free, 有進一步的除錯功能– 缺點 : 需在 Linux 環境下執行 , 且無法做 kernel 與
device driver 的 debug…– Using Domingo for uClinux and Carrier ICE
– 優點 : GUI 介面 , 可於一般 PC 之 Windows 系統下執行 , 功能強大且有廠商之售後服務…
除錯的方式與優劣比較
2004-06-29 47
• 將兩台機器用通訊連接埠連接起來
• 將需要 debug 的程式放到遠端主機
• 在本地主機啟動 GDB ,讀入需要 debug 的程式的符號表和程式碼
• 使用 target remote 命令建立和遠端主機的連接
• 然後就可以和使用一般的 Debugger 一樣進行程式的debug 了
GDB 除錯
2004-06-29 48
• 可在 Windows 環境下針對 uClinux 或 Linux 的 Boot loader, Kernel, Device driver 及 user’s Application 除錯
• 所有程式 ( 包含 bootloader) 均直接透過 JTAG 下載 , 不需事先於目標板中燒錄啟動程式
• Multiple user application debugging
• 軟體斷點可設定於實體或虛擬記憶體之中• Linux system information browser ( 包含 pid, memory,
timer… 等 )
• 內建 UART console View, 方便觀察執行的狀況
Domingo Debugger for uClinux/Linux
2004-06-29 49
用 Domingo for uClinux/Linux 除錯
2004-06-29 50
用 Domingo for uClinux/Linux 除錯
2004-06-29 51
Q & A