版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、ARM assembler guide DUI00682.2Overview ol the ARM architectureThis seclion gi es a brief overviev. of the ARM arc hi teclure.ARM prnces,or cine topical of RISC卩mce汀口眄m iha【(hev impleinent a load/store archi lecture. On It load and jvioreinsi ructions cun access memoT-, 3ata processing jnsLructLans o
2、perate on register contenls only.是一個(gè) RISC 指令結(jié)構(gòu),因?yàn)橛幸粋€(gè)加載存儲(chǔ)結(jié)構(gòu)。 只有 load 和 store 可以讀取內(nèi)存。223 Processor modeARM provenors support up to seven processurIIHXICS, dep;ndi on lhe sirdiiietUTe version. These are:U耙rF1Q- Fast Lnlerrupl RequesiRQ - niernipl RequeslSupervisorAbortUiKlefinecISystem (ARM archileclur
3、e v4IIIKI above).All nuxles exuijpl User nnxle are re I erred io as prhifeetl moiles.ARM 的處理器模式2.3.1Layout of assembly language source filesCaee mle$Instniclion miKmoiiics. directives, nd symbolic rcgisler name can be writ(i;n in iipperciise or lowercasehhilt not mixed.可以全部大寫(xiě)或小寫(xiě),不能混LabelsLahcls arc
4、symbols llmt represent addresses. The address eiven hy n label iscalcukircd du ciassembly.標(biāo)志符表示一個(gè)地址Local labelsLocal labels are a subclass of label. A local label begins with a inimber in the range 0-99. Unlike other labels, a local labelcan be defined many times. Local labels are useful when you ar
5、e gencraiing labels with u macro. When the assembler findsy ivferetice lo a local liibcL il links ii io a nearby instance of llic KKUI label-Thescopeof local labels islimited by(he AREAdireclive. Youcanuse the ROUTdirective to Limit die scopemore tightly.ConstantsConslanls be numcrk. Uwkan, tkiracle
6、r or string:Numbers Numeric constants arc accepted in three forms:*Decimj. for exainple+123*Hexadecimal, for example. 0 x7B*ft.jcxx where:nXXXis 3 base between 2 and 9 in n niiniha inibid biise.常量的定義格式:1230 x1C2_1001ARM 編譯、鏈接后最終生成一個(gè) ELF 格式(Executable and Linking Format)的可執(zhí)行文件(后 綴.axf)ELF 中是分 sectior
7、 部分的,一個(gè) ELF section在匯編中定義一個(gè) section 使用 AREA 指令。2.3.2An example ARM assembly language moduleAREAARNextCODE, READONLYENTRY;Name this block of cod亡 ARMex;Mark flr&T insTruction to execurestartMOVrO, #10: Set up parametersMOYrl.ADDrO, rO, rl; r0 =+ rlstopMOVre, #0 x18; ang el _SWI re a soruRe po r t
8、 Exc e pti onLDRrl.=0 x20026; ADP.StoppecLApplicati onExitSWI0 x123456; ARM semi hosting ShiEND;Mark end of fileELF sections and the AREA directiveELF secfions are iniiependent, imm亡indivisible sequences of code or dota, A single code edion is the iniihinutn required lu produce un dpplkiiuoitThe out
9、put of an assembly or compilation can includeOne or more code sections. These nvc usually rtiid-uiilv scxliun.One cr mure data seelions. These arc uuully rcad-uiHc sec lions. They niiiy be zero hutiulized (Zl).The linker phees each section i門(mén)衛(wèi)program image according ro section pUcement rules. Sectio
10、ns ilun ;xre adjacent in source filet ;irt not neeerilyadjaceni in rhe application image. Refer to the Linker chapter in ADS Linker tind C litilies Gifitle for niurv infomiation on how the linker placessections.hi nn ARM assembly Language()urce file, the start of 3 section is marked hy the AREA dire
11、ctive. This directive names I he section and sets itsattributes. The attributes are pluccil ufter the nuinc. scparatckl by gummas. Refer k) AREA un 7-52 for dctiiilcd description of die syntax of rheAREA directive.TheENTRYdlrecuveHit ENTRYdirculivr marks Lhr first instruct ion tu be rxccutcd. h appl
12、iculiiurks cunluiDiLnig C codc+an cnl ir)rpoint is also contained within the C libraryiiiilializution code.Inhhilizationicodeandexceptjo:n handle只awcontain, enurypoints.ENTRY 指令指示匯編代碼第一條要執(zhí)行的指令。Appllcatton executionThe application cixlc in Example 2- cn page 2-15 logins executing at the label stsrt.w
13、here il loads (lie decimqi rallies 10 and 3 into rrpihlcis r0 and 11.These registers arc Ltildcil Luuctlicj Jiid llic iriiult pLtvd in liJ.start 是一個(gè)標(biāo)識(shí)符,代表一個(gè)地址。Applicatlon terminDonAfkr executing lhe itinin cixk. I he Eipplicdiion IcnniniiUs hy returning conlro to I he debugger. This is done using th
14、e ARM scmihosting SWl(0 x123456 by defau1t)hwith the following param亡忙rs:fO equal to a nge 1 _SWI rea son.R epc rtEKcept i on (0N1) rJ equal to ADP_Stopped_4pplicationExit (0 x20026).Refer to the Semihosting SWIs chapter in AOS Debug Tatget Guide for additional information.結(jié)束的方式是產(chǎn)生一個(gè)軟件中斷,把控制權(quán)交給調(diào)試器。T
15、he END directiveTli is directive inslructs I he assembler lo stop proccLiig this source tile. Everpassembly language也lurvu n)iK|ule mu.!IHUSIIwith END diiwiireon n line by iisclf.END 指令指示匯編的結(jié)束使用 cmd 進(jìn)行調(diào)試:Microsoft Windows XP 版本 5.1.2600(C)版權(quán)所有 1985-2001 Microsoft Corp.C:Docume nts and Setti ngsAdmi
16、nistratorcd D:Program FilesARMADSv1_2BinC:Docume nts and Setti ngsAdmi nistratorD;D 不是內(nèi)部或外部命令,也不是可運(yùn)行的程序 或批處理文件。C:Docume nts and Setti ngsAdmi nistratorD:D:Program FilesARMADSv1_2Bi narmsd E:dsparmpxa270projectarmex_image.axARM Source-level Debugger, ADS1.2 Build 805 Software supplied by: Team-EFAARM
17、ulator ADS1.2 Build 805Software supplied by: Team-EFAARM7TDMI, BIU, Little endian, Semihosting, Debug Comms Channel, 4GB, Mapfile, Timer, Profiler, Tube,Millisecond 20000 cycles_per_millisecond, Pagetables, IntCtrl, Tracer, RDI CodesequencesObject program file E:dsparmpxa270projectarmex_image.axf ar
18、msd: help help Display help information on one of the following commands:RegistersFpregistersCoprocCRegistersCREGDefCWriteStepIstepExamineListQuitObeyGoBreakUnbreakWatchUNWatchPrintCONtextOUtINWHereBAcktraceVariableSYmbolsLSymLEtArgumentsLAnguageHelpTypeCAllWHIleALiasLOadLOGRELoadREAdsymsFIndPUtfile
19、GEtfileLOCalvarCOMmentPAuseLOADConfigSElectconfigLISTConfigLOADAgentPROfonPROFOFfPROFClearPROFWriteCCinCCOutPROCessorSYSSETregisterTRacetriggerTRACEExtentTRACEWriteTRACEStartTRACESTOpTRACEFlushHELP * gives helps on all available commands. To print the help use the LOG command to record the helpoutpu
20、t into a file & print the file.If the first character of a line is the ! character the rest of the command line is executed by a call to system().If the first character of a line is the | character the rest of the line is a treated as a comment.Note that this help is not intended to replace the
21、printed manual which explains ARMSD in much greaterdetail.armsd: LOG* Error: No log filearmsd: stepStep completed at PC = 0 x000080040 x00008004: 0 xe3a01003 . : mov r1,#3armsd: Registerr0= 0 x0000000a r1= 0 x00000000r2 = 0 x00000000r3= 0 x00000000r4= 0 x00000000 r5 =0 x00000000r6 = 0 x00000000r7= 0
22、 x00000000r8= 0 x00000000 r9 =0 x00000000r10 = 0 x00000000r110 x00000000r12=0 x00000000 r13 = 0 x00000000r14 =0 x00000000pc= 0 x00008004 cpsr= %nzcvqIFt_SVC spsr = %nzcvqift_Reserved_00armsd: stepStep completed at PC = 0 x00008008 0 x00008008: 0 xe0800001: add r0,r0,r1armsd: Registerr0 = 0 x0000000a
23、 r1 = 0 x00000003 r2 = 0 x00000000 r3 = 0 x00000000 r4 = 0 x00000000 r5 =0 x00000000 r6 = 0 x00000000 r7 = 0 x00000000r8 = 0 x00000000 r9 = 0 x00000000 r10 = 0 x00000000 r11 = 0 x00000000 r12 = 0 x00000000 r13 =0 x00000000 r14 = 0 x00000000pc = 0 x00008008 cpsr = %nzcvqIFt_SVC spsr = %nzcvqift_Reser
24、ved_00 armsd: stepStep completed at PC = 0 x0000800c0 x0000800c: 0 xe3a00018 . :movr0,#0 x18armsd:LOG* Error: No log filearmsd:Registerr0= 0 x0000000d r1= 0 x00000003r2 = 0 x00000000r3= 0 x00000000r4= 0 x00000000 r5= 0 x00000000r6 = 0 x00000000r7= 0 x00000000r8= 0 x00000000 r9= 0 x00000000r10 = 0 x0
25、0000000 r11 0 x00000000r12 = 0 x00000000 r13 = 0 x00000000r14 =0 x00000000pc = 0 x0000800c cpsr = %nzcvqIFt_SVC spsr = %nzcvqift_Reserved_00 armsd: step Step completed atPC = 0 x000080100 x00008010: 0 xe59f1000 . : ldr r1,0 x00008018 ; = #0 x00020026armsd: Registerr0= 0 x00000018 r1 =0 x00000003r2 =
26、 0 x00000000r3= 0 x00000000r4= 0 x00000000 r5 =0 x00000000r6 = 0 x00000000 r7= 0 x00000000r8= 0 x00000000 r9 =0 x00000000r10 = 0 x00000000 r110 x00000000r12=0 x00000000 r13 = 0 x00000000r14 =0 x00000000pc= 0 x00008010 cpsr= %nzcvqIFt_SVC spsr = %nzcvqift_Reserved_00armsd: stepStep completed at PC =
27、0 x000080140 x00008014: 0 xef123456 V4. :swi 0 x123456armsd: Registerr0= 0 x00000018 r1 =0 x00020026r2 = 0 x00000000r3= 0 x00000000r4= 0 x00000000 r5 =0 x00000000r6 = 0 x00000000 r7= 0 x00000000r8= 0 x00000000 r9 =0 x00000000r10 = 0 x00000000 r110 x00000000r12=0 x00000000 r13 = 0 x00000000r14 =0 x00
28、000000pc= 0 x00008014 cpsr= %nzcvqIFt_SVC spsr = %nzcvqift_Reserved_00armsd: stepProgram terminated normally at PC = 0 x000080140 x00008014: 0 xef123456 V4. :swi 0 x123456armsd: Registerr0= 0 x00000018 r1 =0 x00020026r2 = 0 x00000000r3= 0 x00000000r4= 0 x00000000 r5 =0 x00000000r6 = 0 x00000000 r7=
29、0 x00000000r8= 0 x00000000 r9 =0 x00000000r10 = 0 x00000000 r110 x00000000r12=0 x00000000 r13 = 0 x00000000r14 =0 x00000000pc= 0 x00008014 cpsr= %nzcvqIFt_SVC spsr = %nzcvqift_Reserved_00armsd: quitQuittingD:Program FilesARMADSv1_2Bin使用 armsd 調(diào)試有點(diǎn)像微機(jī)原理上調(diào)試匯編,爽!2,6 Loading constants into registersThe
30、ILIIIOWing secliuns deieribe:hov to use iIKMOV nd MVN inslnictiens to lead a range o| iimncdiak values, see Direct loading with MOV and MVN on page 2-26how to u牝die LDR p sen doinstruc Li on lo lod any 32-bil eonstctnL, sec Loading with LDR Hifr=CYJ;J.V/ on page 2-27MOV 叫指令,常數(shù)范圍是 0-255LDR 叫偽指令都是將常數(shù)放
31、到 Reg 中4.3.4 MOV and MVNMove and Move Not.SyntaxM0Vcctn(J5 Rd, OperandZ唯11:伽聆$Rd, OperafKi?UsageTh亡MOV ilistmelion copies lhe value of Operands into Rd.The附M instruction takes Llic value of Operand, perfonns a bilwise logical NOT o|)emiion on ih亡vahie. jnd phices the refill uno Rd.2.6.2Loading with
32、LDR Rd, =constThe LDR Rd,=const |)scudo-inslmction can construct ans 32-bit numeric constiinl in a si rllk iilslrutlion. UsvpsLlldn-itlriK tHHi 111 Jjeik rnlk? uonslnilK lllul UV lUil ol runge of the MOV and MVN instructions.4.9.3 LDR ARM pseudo-in struct ionLoad a rvistcr witli cithei:*a 32-bit can
33、startt vain亡dii address.MOVLDRrt, #0 xlSrlt=0 x20026#和 FIELD 指令是一樣的3.4 Built-in variablesTable 3-1 lists the built-in variables de lined by lliu ARM assembler.Table 3-1 Built-in variablesPC orAddress of current instruction.符號(hào)在匯編程序中代表一個(gè)地址,可以用在指令中,匯編程序經(jīng)過(guò)匯編器的處理之后,所有的符號(hào)都被替換成它所代表的地址值。DCD (& ):分配一段字內(nèi)存
34、單元用于分配一段字內(nèi)存單元,與&同義。在中斷向量表中不直接 LDR PC,異常地址.而是使用一個(gè)標(biāo)號(hào),然后再在后面使用 DCD 定義這個(gè)標(biāo)號(hào),其原因 是LDR 指令只能跳到當(dāng)前 PC 4kB 范圍內(nèi),而 B 指令能跳轉(zhuǎn)到 32MB 范圍,而現(xiàn)在這樣在 LDR PC, xxxx這條指令不遠(yuǎn)處用xxxxDCD 定義一個(gè)字,而這個(gè)字里面存放最終異常服務(wù)程序 的地址,這樣可以實(shí)現(xiàn) 4GB 全范圍跳轉(zhuǎn)。EQUIs an assembler directive, t is used to give a value to a symboL JDthis exatTiple ii assigns lh
35、e value 2 to num. When num isused elsewherein lhecode, thevalue 2 is substitnied. Using EQU in this way is similar to using define to define a con slant inC.DCDDeclares one or more ords of store. In (his exampleeach DCD stores the address of a rouline that handles a pardcLilar clauseof the jump tabl
36、e.BaseOfROM DCD |lmage$RO$Base|EQU (*):相當(dāng)于 C 里面的#define 個(gè)常數(shù)7.7.6EQUThe EQU diiecuve gives a symbolicIKIIIKIn nIHLmeric consfanL a igMer-relative value or n program-relative value.* is a synonym for EQU,LTORG7.3.1LTORGThe LTORG directive instructs the asmbler to assemble theCUITCIII literal pool lmme
37、cliateJy.SyntaxLTORGUsageTheassJ.兀is a synonyiiL for SPACE,Sy ntaxlibel SPACE exprwhere:exprevalucres to rhe number of zeroed bytes to rcprvt?( sec Numericexpressions on page 3-20).ExampleMyData, DATA, READWRITE255; defines 255 bytes of zeroed store2.10 Describing data structures with MAP and FIELD directivesThe MAP directive specifies the base addressof the data structure.The FIELD directive specifies the amount of me
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二五年度暖通工程保險(xiǎn)合同
- 課題申報(bào)參考:明清時(shí)期俄人旅華游記中的中國(guó)形象研究
- 課題申報(bào)參考:面向大學(xué)生情緒調(diào)節(jié)的人工智能眼動(dòng)交互音樂(lè)生成系統(tǒng)設(shè)計(jì)研究
- 二零二五年度模具行業(yè)創(chuàng)新項(xiàng)目合作合同2篇
- 2025版選礦廠礦山地質(zhì)勘查承包合同樣本3篇
- 2025年度個(gè)人汽車租賃與停車服務(wù)合同4篇
- 2025版寧夏糧食和物資儲(chǔ)備局糧食儲(chǔ)備庫(kù)智能化升級(jí)合同3篇
- 2025年度牛糞處理設(shè)施融資租賃合同范本4篇
- 2025版農(nóng)副業(yè)科技成果轉(zhuǎn)化承包合同書(shū)二份3篇
- 二零二五年度磚廠生產(chǎn)線承包租賃合同3篇
- 2024年銀行考試-興業(yè)銀行筆試參考題庫(kù)含答案
- 泵站運(yùn)行管理現(xiàn)狀改善措施
- 2024屆武漢市部分學(xué)校中考一模數(shù)學(xué)試題含解析
- SYT 0447-2014《 埋地鋼制管道環(huán)氧煤瀝青防腐層技術(shù)標(biāo)準(zhǔn)》
- 第19章 一次函數(shù) 單元整體教學(xué)設(shè)計(jì) 【 學(xué)情分析指導(dǎo) 】 人教版八年級(jí)數(shù)學(xué)下冊(cè)
- 浙教版七年級(jí)下冊(cè)科學(xué)全冊(cè)課件
- 弧度制及弧度制與角度制的換算
- 瓦楞紙箱計(jì)算公式測(cè)量方法
- 江蘇省中等職業(yè)學(xué)校學(xué)業(yè)水平考試商務(wù)營(yíng)銷類(營(yíng)銷方向)技能考試測(cè)試題
- DB32-T 4004-2021水質(zhì) 17種全氟化合物的測(cè)定 高效液相色譜串聯(lián)質(zhì)譜法-(高清現(xiàn)行)
- DB15T 2724-2022 羊糞污收集處理技術(shù)規(guī)范
評(píng)論
0/150
提交評(píng)論