Suche senden
Hochladen
嵌入式平台移植技巧概說
•
50 gefällt mir
•
7,628 views
Joseph Lu
Folgen
Port Embedded Linux
Weniger lesen
Mehr lesen
Ingenieurwesen
Melden
Teilen
Melden
Teilen
1 von 14
Empfohlen
Windows Server and Docker - The Internals Behind Bringing Docker and Containe...
Windows Server and Docker - The Internals Behind Bringing Docker and Containe...
Docker, Inc.
Spring Batch Performance Tuning
Spring Batch Performance Tuning
Gunnar Hillert
PostgreSQL + ZFS best practices
PostgreSQL + ZFS best practices
Sean Chittenden
Coolgen Shkehar
Coolgen Shkehar
shekhar619
XenDesktop&XenApp環境の印刷を極める
XenDesktop&XenApp環境の印刷を極める
Koji Yamada
.NET for hackers
.NET for hackers
Antonio Parata
Understanding blue store, Ceph's new storage backend - Tim Serong, SUSE
Understanding blue store, Ceph's new storage backend - Tim Serong, SUSE
OpenStack
Building fast interpreters in Rust
Building fast interpreters in Rust
Ingvar Stepanyan
Weitere ähnliche Inhalte
Was ist angesagt?
Mongodb - Scaling write performance
Mongodb - Scaling write performance
Daum DNA
Problems with PostgreSQL on Multi-core Systems with MultiTerabyte Data
Problems with PostgreSQL on Multi-core Systems with MultiTerabyte Data
Jignesh Shah
HBase Low Latency
HBase Low Latency
DataWorks Summit
What every data programmer needs to know about disks
What every data programmer needs to know about disks
iammutex
Data Warehousing with Python
Data Warehousing with Python
Martin Loetzsch
Introduction to User Experience and User Interface Design: A One-Hour Crash C...
Introduction to User Experience and User Interface Design: A One-Hour Crash C...
Jason Hong
Open Source Lambda Architecture with Hadoop, Kafka, Samza and Druid
Open Source Lambda Architecture with Hadoop, Kafka, Samza and Druid
DataWorks Summit
HBase Accelerated: In-Memory Flush and Compaction
HBase Accelerated: In-Memory Flush and Compaction
DataWorks Summit/Hadoop Summit
MongoDB Sharding Fundamentals
MongoDB Sharding Fundamentals
Antonios Giannopoulos
php and sapi and zendengine2 and...
php and sapi and zendengine2 and...
do_aki
The basics of fluentd
The basics of fluentd
Treasure Data, Inc.
Zend OPcacheの速さの秘密を探る
Zend OPcacheの速さの秘密を探る
Yoshio Hanawa
American Fuzzy Lop
American Fuzzy Lop
Michael Overmeyer
SAN
SAN
Information Technology
Millions of Regions in HBase: Size Matters
Millions of Regions in HBase: Size Matters
DataWorks Summit
作業系統與硬體元件的驅動軟體開發法則 (Operating Systems and Software Design Principles for Har...
作業系統與硬體元件的驅動軟體開發法則 (Operating Systems and Software Design Principles for Har...
William Liang
Python Deserialization Attacks
Python Deserialization Attacks
NSConclave
Considerations for Alert Design
Considerations for Alert Design
John Allspaw
Recurrent Neural Network : Multi-Class & Multi Label Text Classification
Recurrent Neural Network : Multi-Class & Multi Label Text Classification
Amit Agarwal
OReilly-Web-Application-Security-NGINX.pdf
OReilly-Web-Application-Security-NGINX.pdf
RazaMehmood7
Was ist angesagt?
(20)
Mongodb - Scaling write performance
Mongodb - Scaling write performance
Problems with PostgreSQL on Multi-core Systems with MultiTerabyte Data
Problems with PostgreSQL on Multi-core Systems with MultiTerabyte Data
HBase Low Latency
HBase Low Latency
What every data programmer needs to know about disks
What every data programmer needs to know about disks
Data Warehousing with Python
Data Warehousing with Python
Introduction to User Experience and User Interface Design: A One-Hour Crash C...
Introduction to User Experience and User Interface Design: A One-Hour Crash C...
Open Source Lambda Architecture with Hadoop, Kafka, Samza and Druid
Open Source Lambda Architecture with Hadoop, Kafka, Samza and Druid
HBase Accelerated: In-Memory Flush and Compaction
HBase Accelerated: In-Memory Flush and Compaction
MongoDB Sharding Fundamentals
MongoDB Sharding Fundamentals
php and sapi and zendengine2 and...
php and sapi and zendengine2 and...
The basics of fluentd
The basics of fluentd
Zend OPcacheの速さの秘密を探る
Zend OPcacheの速さの秘密を探る
American Fuzzy Lop
American Fuzzy Lop
SAN
SAN
Millions of Regions in HBase: Size Matters
Millions of Regions in HBase: Size Matters
作業系統與硬體元件的驅動軟體開發法則 (Operating Systems and Software Design Principles for Har...
作業系統與硬體元件的驅動軟體開發法則 (Operating Systems and Software Design Principles for Har...
Python Deserialization Attacks
Python Deserialization Attacks
Considerations for Alert Design
Considerations for Alert Design
Recurrent Neural Network : Multi-Class & Multi Label Text Classification
Recurrent Neural Network : Multi-Class & Multi Label Text Classification
OReilly-Web-Application-Security-NGINX.pdf
OReilly-Web-Application-Security-NGINX.pdf
Ähnlich wie 嵌入式平台移植技巧概說
Docker 基礎介紹與實戰
Docker 基礎介紹與實戰
Bo-Yi Wu
在Linux上實現Rstudio Server 與Spark的溝通
在Linux上實現Rstudio Server 與Spark的溝通
電腦科學 實驗室
利用Cent Os快速构建自己的发行版
利用Cent Os快速构建自己的发行版
xingsu1021
Rootkit 101
Rootkit 101
WEI CHIEH CHAO
快速入坑 Node.js - 0613 SITCON 雲林定期聚
快速入坑 Node.js - 0613 SITCON 雲林定期聚
Lorex L. Yang
20121111 linux intro
20121111 linux intro
Chang Mt
Bypat博客出品-利用cent os快速构建自己的发行版
Bypat博客出品-利用cent os快速构建自己的发行版
redhat9
Build desktop app_by_xulrunner
Build desktop app_by_xulrunner
Rack Lin
[1]投影片 futurewad樹莓派研習會 141120
[1]投影片 futurewad樹莓派研習會 141120
CAVEDU Education
Linux必备知识与Unix基础文化
Linux必备知识与Unix基础文化
Dahui Feng
Ox office現在。即未來(201509)
Ox office現在。即未來(201509)
晟鑫科技股份有限公司
Some tips
Some tips
Wei-Bo Chen
20030623 linuxbasic and-security
20030623 linuxbasic and-security
建融 黃
寫出高性能的服務與應用 那些你沒想過的事
寫出高性能的服務與應用 那些你沒想過的事
Chieh (Jack) Yu
移植Os and 相關io介紹
移植Os and 相關io介紹
Hong Da Lin
Docker tutorial
Docker tutorial
azole Lai
用 Docker 改善團隊合作模式
用 Docker 改善團隊合作模式
Bo-Yi Wu
Develop Your Own Operating System
Develop Your Own Operating System
National Cheng Kung University
軟體組裝心得分享
軟體組裝心得分享
Wen Liao
为啥别读HotSpot VM的源码(2012-03-03)
为啥别读HotSpot VM的源码(2012-03-03)
Kris Mok
Ähnlich wie 嵌入式平台移植技巧概說
(20)
Docker 基礎介紹與實戰
Docker 基礎介紹與實戰
在Linux上實現Rstudio Server 與Spark的溝通
在Linux上實現Rstudio Server 與Spark的溝通
利用Cent Os快速构建自己的发行版
利用Cent Os快速构建自己的发行版
Rootkit 101
Rootkit 101
快速入坑 Node.js - 0613 SITCON 雲林定期聚
快速入坑 Node.js - 0613 SITCON 雲林定期聚
20121111 linux intro
20121111 linux intro
Bypat博客出品-利用cent os快速构建自己的发行版
Bypat博客出品-利用cent os快速构建自己的发行版
Build desktop app_by_xulrunner
Build desktop app_by_xulrunner
[1]投影片 futurewad樹莓派研習會 141120
[1]投影片 futurewad樹莓派研習會 141120
Linux必备知识与Unix基础文化
Linux必备知识与Unix基础文化
Ox office現在。即未來(201509)
Ox office現在。即未來(201509)
Some tips
Some tips
20030623 linuxbasic and-security
20030623 linuxbasic and-security
寫出高性能的服務與應用 那些你沒想過的事
寫出高性能的服務與應用 那些你沒想過的事
移植Os and 相關io介紹
移植Os and 相關io介紹
Docker tutorial
Docker tutorial
用 Docker 改善團隊合作模式
用 Docker 改善團隊合作模式
Develop Your Own Operating System
Develop Your Own Operating System
軟體組裝心得分享
軟體組裝心得分享
为啥别读HotSpot VM的源码(2012-03-03)
为啥别读HotSpot VM的源码(2012-03-03)
嵌入式平台移植技巧概說
1.
嵌入式平台移植技巧概說 盧釔辰 Joseph Lu
2.
Outline • Freescale iMX6
porting流程 • 基本硬體知識 • 如何從上百隻程式中,找出系統執行的第一支主程式 • 尋找uboot 主程式 • 尋找編譯器載入檔 .lds • 由makefile搜尋 • 追蹤系統程式碼常用指令與技巧 • U-Boot 流程概述 • 其餘工具介紹 2016/3/9 joseph78715@gmail.com 2
3.
Freescale iMX6 porting
流程 • 我有整理資料如下,請自行參閱 https://hackpad.com/Freescale-iMX6-porting-EKoWlOejTiw 2016/3/9 joseph78715@gmail.com 3
4.
基本硬體知識 • L1 Cache
: 因為讀寫頻率極高,所以通常會採用速度較快的 SRAM • L2 Cache , RAM : 因為成本考量,通常會使用讀寫速度較次一級的 DRAM • Flash : 通常採用NAND Flash or NOR Flash • NAND Flash 需要初始化 ( 不可放uboot 程式 ,除非支援Stepping–stone ) ,且速度較慢但便宜 • NOR Flash 不須初始化 ( 可放uboot 程式 ),速度較快 P.S. 我們常聽到的記憶體(memory ) , 其實是 Cache , RAM 的統稱 2016/3/9 4 速度比較 : SRAM > DRAM > > NOR Flash > NAND Flash 價格比較 : SRAM > DRAM > > NOR Flash > NAND Flash
5.
基本硬體知識 • 1st stage
boot loader 只能放在不須初始化即可使用的儲存空間。E.g. 1. 有支援 Stepping–stone 的 NAND Flash • Stepping–stone : • 三星專利。上電時硬體電路會抓取 NAND Flash 的前 128k ( 每顆 NAND 支援大小不一定 ), 放進 SRAM 中執行。 • 只要你的 uboot 程式有辦法在 128k 內完成 CPU , Memory 以及 NAND Flash 初始化 ,就可 以利用NAND Flash 開機 。 • 也因為 Stepping–stone 技術的出現,讓開發商不用特地買一塊貴貴小小的 NOR Flash 放 Bootloader 程式,而可以全部改用便宜的 NAND Flash 取代。 2. NOR Flash : • NOR Flash 可以和 CPU pin-to-pin ,支援 XIP ( Execute in place )。不須初始化即可使用 2016/3/9 joseph78715@gmail.com 5
6.
悲劇的嵌入式工程師 • 如果你覺得Uboot &
kernel 的source code 動不動上千萬行,可能一輩子都看 不完 • 從 Linux kernel 4.1 以後,原始程式碼已衝到 2000 萬行的規模 • 而在u-boot & kernel 程式碼都沒 trace 完一遍的情形下,上司又要你在有限時 間內把OS porting 上去,根本超級悲慘兼毫無人性 時間就是金錢! 這是一個什麼都趕的時代 老闆趕出貨 , PM趕結案 , 於是 工程師趕羚羊 2016/3/9 joseph78715@gmail.com 6
7.
千萬別這麼悲觀 , 因為
… 還有更可怕 更可怕 更可怕 的挑戰在等你 2016/3/9 joseph78715@gmail.com 7
8.
更可怕的是… 在 OS sorce
code 裡,不是每一行程式都會被編譯,而編譯了也不一定被連結, 連結了不一定被執行。 若沒搞清楚狀況,可能 trace 了好幾天的程式碼後,才發現該段程式碼根本 不會被執行,所以看了等於白看、改了等於白改 , … 2016/3/9 joseph78715@gmail.com 8
9.
所以,如何從上千個檔案中,找出系統所 執行的第一個函式所在位置呢? • 以尋找uboot 執行的第一支函式為例
Sol 1 : 尋找編譯器載入檔 .lds /board/$5/$4/u-boot.lds cpu/$3/start.S Sol 2 : 由晶片商所提供的編譯 Uboot 的 makefile 中尋找 • 當我們找出第一個被執行的函式所在檔案,就可以順藤摸瓜找出系統會執行的第2 支、第3支被執行的函式,依序追蹤下去 2016/3/9 joseph78715@gmail.com 9
10.
追蹤系統程式碼常用指令與技巧 (1/2) • 欲搜尋Uboot執行第一支程式,可由找到編譯器載入程式
. lds 檔下手 • 做嵌入式要習慣隨便一找就找出幾百個同名檔案,此時就要依系統架構去判 斷,到底哪個才是你要用的 2016/3/9 joseph78715@gmail.com 10
11.
追蹤系統程式碼常用指令與技巧 (2/2) • Q
: 想找某個變數在source code的哪些檔案的哪裡有出現? • Ans : 請用正規表達式(Global Regular Expression) grep 搜尋。 2016/3/9 joseph78715@gmail.com 11
12.
U-Boot 流程概述 • 切入
SVC 模式 • 只有svc mode可以修改硬體參數。進user mode ( kernel跑起來後 ) 就無法對硬體設定做修改 • 清除 I-Cache / D-Cache • 為 MMU 相關暫存器設定初值 • 設定 peripheral bus 起點 • 初始化 CPU ( 設定 PLL ) 與記憶體 ( 設定 Tacc , Tacp ,... ) • 偵測 U-Boot 是放在NAND or NOR Flash • 若放在NAND 則須將剩下的uboot程式copy到DRAM執行 • 若放在NOR 則不須複製到RAM,可直接執行。但一般為了效能考量仍會複製到RAM中 執行 • 初始化 MMU • 初始化堆疊區 • 初始化 BSS 區 • 跳入第二階段的 start_armboot() 函數 : • 跳離此處便不再回來,至此由ARM組語變為 C語言執行 2016/3/9 joseph78715@gmail.com 12
13.
其餘工具介紹 • 程式除錯工具GDB &
CGDB • 我有整理資料如下,請自行參閱 https://hackpad.com/GDB-CGDB-7dUwpX8os7U • 版本控制 Git • 我有整理資料如下,請自行參閱 https://hackpad.com/Git-SVKqwqVxUNQ 2016/3/9 joseph78715@gmail.com 13
14.
參考資料 • U-Boot 簡明概要 •
http://teacherchi.tumblr.com/post/20112222844/u-boot- %E7%B0%A1%E6%98%8E%E6%A6%82%E8%A6%81 2016/3/9 joseph78715@gmail.com 14