|
作者:武漢華嵌技術(shù)部 開(kāi)發(fā)平臺:XP
目標平臺:S3c6410
開(kāi)發(fā)工具:RVDS J-LINK(V8)
一、搭建開(kāi)發(fā)環(huán)境:
1、下載rvds2.2安裝程序軟件包。
2、解壓后,進(jìn)入RVDS軟件包中的Crack文件夾中,運行keygen,用generate產(chǎn)生license file (注意自己的系統時(shí)間 最好是真實(shí)的當前時(shí)間,如果時(shí)間比較舊的話(huà),產(chǎn)
生的license file 將不能注冊。license file 和系統時(shí)間、網(wǎng)卡物理地址、硬盤(pán)的序列號有關(guān))
2、安裝軟件。
3、在安裝過(guò)程中會(huì )出現選擇license Wizard 選 Install Wizard ... 選擇 license.dat 目錄
4、拷貝 license.dat 到安裝目錄下面去。
5、應用補丁注入工具Patch.exe給下邊列出的文件注入校驗和。(Patch.exe 在RVDS軟件包中的Crack文件夾中)
the files need to be patched:
%Install Path%\IDEs\CodeWarrior\CodeWarrior\5.6.1\1592\win_32-pentium\bin\Plugins\License\oemlicense.dll
%Install Path%\IDEs\CodeWarrior\RVPlugins\1.0\86\win_32-pentium\oemlicense\oemlicense.dll
%Install Path%\RDI\armsd\1.3.1\66\win_32-pentium\armsd.exe
%Install Path%\RDI\AXD\1.3.1\98\win_32-pentium\axd.exe
%Install Path%\RVCT\Programs\2.2\349\win_32-pentium\armasm.exe
%Install Path%\RVCT\Programs\2.2\349\win_32-pentium\armcc.exe
%Install Path%\RVCT\Programs\2.2\349\win_32-pentium\armcpp.exe
%Install Path%\RVCT\Programs\2.2\349\win_32-pentium\armlink.exe
%Install Path%\RVCT\Programs\2.2\349\win_32-pentium\fromelf.exe
%Install Path%\RVCT\Programs\2.2\349\win_32-pentium\tcc.exe
%Install Path%\RVCT\Programs\2.2\349\win_32-pentium\tcpp.exe
%Install Path%\RVD\Core\1.8\734\win_32-pentium\bin\tvs.exe
%Install Path%\RVD\Core\1.8\734\win_32-pentium\bin\xry100.dll
%Install Path%\RVARMulator\ARMulator\1.4.1\206\win_32-pentium\armiss.sdi
%Install Path%\RVARMulator\ARMulator\1.4.1\206\win_32-pentium\armulate.sdi
%Install Path%\RVARMulator\ARMulator\1.4.1\206\win_32-pentium\v6armiss.sdi
%Install Path%\RVARMulator\v6ARMulator\1.4.1\238\win_32-pentium\v6thumb2.sdi
%Install Path%\RVARMulator\v6ARMulator\1.4.1\238\win_32-pentium\v6trustzone.sdi
到此 RVDS環(huán)境完成。
二、接下來(lái)就是搭建調試環(huán)境了。
這里采用的調試工具是J-LINK。記得要用V8的哦。╒6的能下載程序到SRAM 中,但是不能調試)
1、安裝JLink4.22驅動(dòng)程序 (記得要是JLink4.22的,其它的不保證可以哦。
2、安裝Setup_JLinkARM_V410i
3、插好J-LINK,然后打開(kāi) AXD debugger 即AXD debugger v1.31。
Option->Configure Target->Add
Add 選擇 JLink4.22 安裝目錄下的 JLinkRDI.dll
單擊 OK 進(jìn)入 AXD
此時(shí),調試環(huán)境已搭建好了,可以開(kāi)始寫(xiě)第一個(gè)裸奔程序了。
三、 在RVDS環(huán)境上實(shí)現第一個(gè)裸奔程序
1、創(chuàng )建工程。 打開(kāi) CodeWarrior for RVDS,
file->new 創(chuàng )建一個(gè)程序
在對話(huà)款中選擇ARM Executable Image ,指定工程路徑及工程名,設置好后點(diǎn)擊確認后創(chuàng )建工程。
2、編輯代碼文件。
點(diǎn)擊 file選項下面的那個(gè)圖標(new next file),創(chuàng )建代碼編輯文件,在這里編寫(xiě)代碼,寫(xiě)完后保存文件。
把剛創(chuàng )建的那個(gè)文件添加工程目錄上面去。
3、配置編譯選項。
點(diǎn)擊工程目錄上面的 Debug setting 選項。
需要設置的選項有
1、 Language Setting 下面的 RealView Asse..。
在對話(huà)框下的 Target選項 點(diǎn)擊Architecture or 選項的下拉框 選擇ARM1176JZF-S(這是 S3c6410 的處理器內核)
2、 Language Setting 下面的 RealView comp...
在對話(huà)框下的 Target選項 點(diǎn)擊Architecture or 選項的下拉框 選擇ARM1176JZF-S
3、 Linker 下面的 RealView Linker
在 Output 選項中 linktype 中的 simple, 設置 simple image 中的R0 Base 為 0x00 RW Bage 為 0x800。
4、Debugger 下面的RealView Debu... 選擇調試環(huán)境AXD
5、Debugger 下面的RealView Runner 選擇調試環(huán)境AXD
其它的設置可以暫且不管。
4、點(diǎn)擊 Make 編譯編輯的程序。
5、點(diǎn)擊 debug 調試程序。
代碼例子:
AREA start,CODE,READONLY
ENTRY
_start
LDR R0, =0x7F008834 ; 設置按鍵接口為輸入模式
MOV R1, #0x00
STR R1, [R0]
LDR R0, =0x7F008820 ; 設置led 燈接口為輸出模式
LDR R1, =0x00001111
STR R1, [R0]
LDR R0, =0x7F008824 ;設置led 的初始狀態(tài)為滅
MOV R1, #0x00000000
STR R1, [R0]
LDR R0, =0x7F0080A0 ;設置蜂鳴器接口為輸出模式
LDR R1, =0x40000000
STR R1, [R0]
LDR R0, =0x7F0080A4 ;設置蜂鳴器的初始狀態(tài)為不鳴叫狀態(tài)
LDR R1, =0x00
STR R1, [R0]
main_loop
LDR R0, =0x7F008834 ; 讀取按鍵的狀態(tài)
LDR R2, [R0]
MVN R1, R2
AND R1,R1,#0x0F
LDR R0, =0x7F008824 ; 控制led 輸出
STR R1, [R0]
MOV R3,#0x00
CMP R1, #0x01 ;判斷是否有按鍵按下 鳴有的話(huà)蜂鳴器
MOVEQ R3, #0x08000
CMP R1, #0x02
MOVEQ R3, #0x08000
CMP R1, #0x04
MOVEQ R3, #0x08000
CMP R1, #0x08
MOVEQ R3, #0x08000
LDR R0, =0x7F0080A4
STR R3, [R0]
B main_loop
END
|
|