1. 程式人生 > >ubuntu下使用skyeye對u-boot進行原始碼級除錯

ubuntu下使用skyeye對u-boot進行原始碼級除錯

學習嵌入式linux程式設計一個很好的切入點就是先學習u-boot,u-boot的coding stytle與linux完全一樣,而且程式註釋豐富,很容易上手,如果能把u-boot完全理解了再轉向linux,可以達到事半功倍的效果。可是u-boot發展到現在相容了很多平臺,程式碼量已經非常大了,程式呼叫從一個資料夾轉到另一個資料夾,轉來轉去的,如果單純的看程式碼的話,一會就頭大了。那麼可不可以像windows下除錯程式一樣通過一種方法單步除錯u-boot呢,網上很容易找到的有兩種方法:一種方法是使用ads+axd來進行原始碼級除錯,這種方法應該是可行的,可是我還沒有驗證過,因為我手頭一沒有模擬器,二沒有開發板;另一種方法是使用BDI除錯,BDI是個啥我現在還沒整明白,只知道這東西巨貴,實用性不高。我下面介紹的方法是純軟體的解決方案,不涉及任何硬體,使用的工具及版本如下:

程式碼:1、skyeye                            1.2.6-rc1
2、arm-linux-gcc                            2.95.3
3、arm-linux-gdb                            6.8
4、arm-linux-insight                      6.8
5、u-boot                                       1.1.4
host使用的是ubuntu-8.04
本方法是在假定您已經搭好arm-linux交叉編譯環境及arm-linux-gdb+insight除錯環境的基礎上進行的,沒搭好的可以參照我之前發的帖子搭一下,
http://forum.ubuntu.org.cn/viewtopic.php?f=97&t=159051

一、編譯安裝skyeye
假定我的工作目錄是~/workspace,下載skyeye-1.2.6_rc1.tar.bz2至工作目錄
程式碼:[email protected]:~/workspace$ tar -jxvf skyeye-1.2.6.tar.bz2
[email protected]:~/workspace$ cd skyeye-1.2.6_rc1
[email protected]:~/.../skyeye-1.2.6_rc1$ ./configure
[email protected]
:~/.../skyeye-1.2.6_rc1$ make
[email protected]:~/.../skyeye-1.2.6_rc1$ sudo cp skyeye /usr/bin
這樣就可以在任何目錄使用skyeye了
二、配置u-boot-1.1.4
程式碼:[email protected]:~/workspace$ tar -jxvf u-boot-1.1.4.tar.bz2
[email protected]:~/workspace$ cd u-boot-1.1.4
[email protected]:~/.../u-boot-1.1.4$ make smdk2410_config
[email protected]:~/.../u-boot-1.1.4$ make
編譯時會出現兩個錯誤,解決方法如下:
引用:make[1]: *** No rule to make target `hello_world.srec', needed by `all'. Stop.
make[1]: Leaving directory `/home/mort/src/targa/u-boot/u-boot-TOT/examples'
make: *** [examples] Error 2
有如下的解決方法:
開啟 examples/Makefile 
119 $(LIB): .depend $(LIBOBJS)
120 $(AR) crv [email protected] $(LIBOBJS)
121 
122 %: %.o $(LIB)
123 $(LD) -g $(EX_LDFLAGS) -Ttext $(LOAD_ADDR) \
124 -o [email protected] -e $(<:.o=) $< $(LIB) \
125 -L$(gcclibdir) -lgcc
126 %.srec: %
127 $(OBJCOPY) -O srec $< [email protected] 2>/dev/null
128 
129 %.bin: %
130 $(OBJCOPY) -O binary $< [email protected] 2>/dev/null
把126行和129行改為:
%.srec: %.o
%.bin: %.o
繼續make
在make的過程中,出現:
isystem /usr/local/arm/bin/../lib/gcc-lib/arm-linux/3.2/include -pipe -DCONFIG_ARM -D__ARM__ -march=armv4 -mtune=arm7tdmi -msoft-float -mabi=apcs-gnu -Uarm -Wall -Wstrict-prototypes -c -o hello_world.o hello_world.c
cc1: invalid option `abi=apcs-gnu'
有如下的解決方法:
出錯的檔案是/cpu/s3c44b0/下的config.mk:將
PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
改成:
PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,$(call cc-option,-mabi=apcs-gnu),)
繼續make,順利make出u-boot.bin、u-boot、u-boot.srec
u-boot.bin是不帶調製資訊的二進位制檔案
u-boot.bin是包含調製資訊的elf檔案,也是本方案要使用的檔案
u-boot.srec好像是moto的一種檔案格式,just forget it
三、模擬前準備工作
建立模擬工作目錄
程式碼:[email protected]:~/.../u-boot-1.1.4$ mkdir skyeye
[email protected]:~/.../u-boot-1.1.4$ cd skyeye
建立skyeye配置檔案skyeye.conf
程式碼:[email protected]:~/.../skyeye$ vi skyeye.conf
內容如下:
程式碼:#skyeye config file sample
cpu:arm920t
mach:s3c2410x
#all peripherals I/O mapping area
mem_bank: map=I, type=RW, addr=0x48000000, size=0x20000000
mem_bank: map=I, type=RW, addr=0x19000300, size=0x00000020
#physical memory
mem_bank: map=M, type=RW, addr=0x00000000, size=0x00080000, file=./u-boot, boot=yes
mem_bank: map=M, type=RW, addr=0x30000000, size=0x04000000

load_addr:base=0x30000000, mask=0xFFFFFF

將u-boot檔案拷入skyeye資料夾,執行如下命令
程式碼:[email protected]:~/.../skyeye$ skyeye
輸出內容如下:
程式碼:**************************** WARNING ********************************** 
If you want to run ELF image, you should use -e option to indicate 
your elf-format image filename. Or you only want to run binary image, 
you need to set the filename of the image and its entry in skyeye.conf. 
*********************************************************************** 

Your elf file is little endian. 
arch: arm 
cpu info: armv4, arm920t, 41009200, ff00fff0, 2 
mach info: name s3c2410x, mach_init addr 0x806c5c0 
Your elf file will be load to: base address=0x30000000,mask=0xffffff 
uart_mod:0, desc_in:, desc_out:, converter: 
SKYEYE: use arm920t mmu ops 
Loaded RAM   ./u-boot 
ERROR: s3c2410x_io_write_word(0x4c000000) = 0x00ffffff 
ERROR: s3c2410x_io_write_word(0x4c000008) = 0x00048032 


U-Boot 1.1.4 (Oct 27 2008 - 11:34:51) 

U-Boot code: 33F80000 -> 33F9873C  BSS: -> 33F9C814 
RAM Configuration: 
Bank #0: 30000000 64 MB 
Flash: 512 kB 
*** Warning - bad CRC, using default environment 

In:    serial 
Out:   serial 
Err:   serial 
ERROR: s3c2410x_io_write_word(0x1900030a) = 0x00000000 
SMDK2410 #

表明編譯生成的u-boot檔案可用,CTRL+C退出skyeye,重新執行如下命令進入skyeye的debug模式
程式碼:[email protected]:~/.../skyeye$ skyeye -d
輸出內容如下:
程式碼:**************************** WARNING ********************************** 
If you want to run ELF image, you should use -e option to indicate 
your elf-format image filename. Or you only want to run binary image, 
you need to set the filename of the image and its entry in skyeye.conf. 
*********************************************************************** 

Your elf file is little endian. 
arch: arm 
cpu info: armv4, arm920t, 41009200, ff00fff0, 2 
mach info: name s3c2410x, mach_init addr 0x806c5c0 
Your elf file will be load to: base address=0x30000000,mask=0xffffff 
uart_mod:0, desc_in:, desc_out:, converter: 
SKYEYE: use arm920t mmu ops 
Loaded RAM   ./u-boot 
debugmode= 1, filename = skyeye.conf, server TCP port is 12345

表明skyeye已經進入debug模式等待host端進行連線

再開啟一個shell,執行arm-linux-insight(前提是已經安裝好了arm-linux-gdb、arm-linux-insight)
程式碼:[email protected]:~/.../skyeye$ arm-linux-insight u-boot
開啟arm-linux-insight,在File-->Target Settings中的設定為
程式碼:Connection
Target: Remote/TCP
Hostname:為空
Port:12345
關閉對話方塊,連線目標板『Run-->Connect to target』,提示連線成功後即可進行單步除錯了,
好像不能除錯彙編檔案(start.S),不知道什麼原因,有高手知道為什麼麻煩告訴我一下,但可以直接在board.c檔案中的start_armboot函式上加斷點

相關推薦

ubuntu使用skyeyeu-boot進行原始碼除錯

學習嵌入式linux程式設計一個很好的切入點就是先學習u-boot,u-boot的coding stytle與linux完全一樣,而且程式註釋豐富,很容易上手,如果能把u-boot完全理解了再轉向linux,可以達到事半功倍的效果。可是u-boot發展到現在相容了很多平臺,程

MySql輕鬆入門系列——第二站 使用visual studio mysql進行原始碼除錯

## 一:背景 ### 1. 講故事 上一篇說了mysql的架構圖,很多同學反饋說不過癮,畢竟還是聽我講故事,那這篇就來說一說怎麼利用visual studio 對 mysql進行原始碼級除錯,畢竟原始碼面前,不談隱私,聖人面前,皆為螻蟻。 ## 二:工具合集 mysql是C++寫的,要想在w

windows和Ubuntu拍和測試多組樣例

文章目錄 shell語言 Bat shell語言 【Shell指令碼攻略】-shell中各種括號()、(())、[]、[[]]、{}的作用 Shell 輸入/輸出重定向 Shell $0, $#, $*, [email pr

解決Windows無法docker容器進行埠對映的問題

解決Windows下無法對docker容器進行埠對映的問題 在安裝了一個Windows下安裝了docker,並嘗試在其中執行Nginx服務,但對映完畢之後,在主機的瀏覽器中,開啟localhost:port無法訪問對應的服務。 原因:docker是執行在Linux上的,在Windows中執行

Windows無法docker容器進行埠對映的問題

轉自:https://www.wangminli.com/?p=1179 docker是執行在Linux上的,在Windows中執行docker,實際上還是在Windows下先安裝了一個Linux環境,然後在這個系統中執行的docker。也就是

Ubuntu自動載入U

  目前一些主流桌面系統(如Gnome,KDE,Xfce)的較新版本都支援自動掛載(mount)U盤了. 一個流傳很廣的說法是 HAL(硬體抽象層) 起了自動掛載的作用, 其實這是誤解. 對於2.6核心而言, udev 才是直接從核心接收裝置連線或斷開資訊的主體.           udev 從核心得到資訊

myeclipsetomcat專案進行debug斷點除錯

轉自:http://www.cnblogs.com/keyi/p/6022436.html 對於eclipse或myeclipse除錯J2SE專案或小應用進行斷點除錯,大家都不陌生,只要設定斷點,debug執行就OK了。但是如果是web專案,而專案是在容器中執行的,比如tomcat,resin等

ubuntuZooKeeper環境搭建(進行中)

1.ubuntu環境 通過官網下載了對應的iso,用光碟或者u盤安裝。 配置網路服務後安裝eclipse失敗。原因是版本連線的路徑已經陳舊了,需要更新或升級軟體源庫,確保系統中的所有軟體都更新到最新版本。 執行sudo apt-get update進行更新。 結果提示出錯,

Docker問題4-Window無法docker容器進行埠對映

1: 問題背景   window下已成功安裝docker,並執行Nginx映象,也進行了埠對映,如下圖。   然後在主機的瀏覽器開啟 localhost:32769發現根本訪問不到服務。 2: 問題

使用TfidfVectorizer並且不去掉停用詞的條件文字特徵進行量化的樸素貝葉斯分類效能測試

from sklearn.datasets import fetch_20newsgroups news = fetch_20newsgroups() from sklearn.model_selection import train_test_split x_train

Ubuntu製作windows U盤啟動盤

最近想給裝有Ubuntu和win7的筆記本中的win7生成win10.不曾想將win7的啟動引導區給覆蓋掉了,只能啟動Ubuntu了。於是就想在Ubuntu下製作windows的U盤啟動盤重新安裝win10.在網上找了很多資料和方法,都不能完成。最終經過幾天的努

Ubuntu安裝Android Studio並匯入原始碼

1.下載Ubuntu版本Android Studio 到官網下載,選擇Ubuntu版本 2.安裝 把官網下載的zip包放到ubuntu下。 在終端使用下面命令解壓zip包到/usr/local/路徑下: unzip -d /usr/loca

使用eclipse,spring boot 進行springloader或者devtool熱部署失敗處理方法

bsp ng- dev artifact 錯誤 framework tool cli spring 確定配置進行依賴和配置沒有錯誤後。 調整spring boot 的版本,因為新版本對老版本的spring boot 不能使用。 改為: <groupId>o

UbuntuVS Code的C++配置和的除錯

1. 系統環境和工具 系統環境 Unbutu 16.04; 下載VS Code 1.29 https://code.visualstudio.com/docs/languages/cpp#_getting-started; 2. 常用快捷鍵 Open t

原始碼除錯的XNU核心

i春秋翻譯小組-FWorldCodeZ 原始碼級除錯的XNU核心 無論你是在開發核心擴充套件,進行漏洞研究,還是還有其他需要進入macOS / iOS核心,XNU,有時你需要附加偵錯程式。當你這樣做時,使用原始碼執行它是非常好的。Damien DeVille,Snare和其他人都寫過這個過程

Bochs + GDB 原始碼除錯C語言核心

環境: Ubuntu 14.04 64bit Bochs 2.6.6 GDB 7.7 想要原始碼級除錯C核心,需要在編譯Bochs時加上 --enable-gdb-stub 引數 sudo ./configure --enable-all-optimizations --enable-long-phy-

ubuntuc語言mysql進行CRUD(增刪改查)

Step 1:登入mysql mysql -u root -p Step 2:在資料庫中新增資料: create database foo; use foo; CREATE TABLE children( childno int(11) NOT NULL

Spring Boot整合Jasypt配置檔案進行加密

由於日趨緊張的程式碼安全問題,更多的專案需要進行簡單的加密措施。包括對資料庫連線資訊,redis連線資訊等。 本文就講解一下怎麼使用Jasypt進行簡單的配置檔案加密。 一、在maven裡新增Jasypt的依賴。 <dependency> <groupId&g

ubuntu使用cmake進行opencv的配置和Windows進行使用cmake編譯原始碼比較,opencv3進行g++例子程式編譯、動態庫的製作

1.首先安裝的是cmake軟體,使用指令: apt-get install cmake 接著檢視版本,測試是否安裝成功: [email protected]:/home# cmake --version cmake version 2.8.10.2 由於我們需要

如何在Ubuntu使用TF/SD 卡製作Exynos 4412 u-boot啟動盤

/** ****************************************************************************** * @author    Maoxiao Hu * @version   V1.0.1 * @date       Feb-2015 *****