GNU ARM 汇编程序设计快速入门

  • w0_199408
    了解作者
  • 103.5KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-04-16 01:11
    上传日期
GNU ARM 汇编程序设计快速入门 提供了GNU ARM汇编程序设计所使用的伪指令,可以同ADS汇编程序设计对比使用
GNU+ARM+Assembler+Quick+Reference.rar
  • GNU+ARM+Assembler+Quick+Reference.pdf
    108.7KB
内容介绍
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8"> <meta name="generator" content="pdf2htmlEX"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <link rel="stylesheet" href="https://static.pudn.com/base/css/base.min.css"> <link rel="stylesheet" href="https://static.pudn.com/base/css/fancy.min.css"> <link rel="stylesheet" href="https://static.pudn.com/prod/directory_preview_static/6259a7d3be9ad24cfab7f3e2/raw.css"> <script src="https://static.pudn.com/base/js/compatibility.min.js"></script> <script src="https://static.pudn.com/base/js/pdf2htmlEX.min.js"></script> <script> try{ pdf2htmlEX.defaultViewer = new pdf2htmlEX.Viewer({}); }catch(e){} </script> <title></title> </head> <body> <div id="sidebar" style="display: none"> <div id="outline"> </div> </div> <div id="pf1" class="pf w0 h0" data-page-no="1"><div class="pc pc1 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/6259a7d3be9ad24cfab7f3e2/bg1.jpg"><div class="t m0 x1 h2 y1 ff1 fs0 fc0 sc0 ls0 ws0">GNU ARM Assembler Quick Reference </div><div class="t m0 x2 h3 y2 ff1 fs1 fc0 sc0 ls1 ws1"> </div><div class="t m0 x2 h4 y3 ff2 fs1 fc0 sc0 ls2 ws2">A summary of useful<span class="_ _0"></span> commands and e<span class="_ _0"></span>xpressions for the ARM <span class="_ _0"></span>architecture using the G<span class="_ _0"></span>NU assembler is </div><div class="t m0 x2 h4 y4 ff2 fs1 fc0 sc0 ls2 ws3">presented briefly in the concluding porti<span class="_ _0"></span>on of this Ap<span class="ls3 ws4">pendix. Each assembly line has the following format: </span></div><div class="t m0 x2 h4 y5 ff2 fs1 fc0 sc0 ls1 ws1"> </div><div class="t m0 x2 h4 y6 ff2 fs1 fc0 sc0 ls1 ws1"> <span class="_ _1"> </span><span class="ff3 ls4">[&lt;label&gt;:] <span class="_"> </span>[&lt;instruction or directive&gt;} <span class="_"> </span>@ comment </span></div><div class="t m0 x2 h4 y7 ff2 fs1 fc0 sc0 ls1 ws1"> </div><div class="t m0 x2 h4 y8 ff2 fs1 fc0 sc0 ls5 ws5">Unlike the ARM assembler, usin<span class="_ _0"></span>g the GNU assembler <span class="ls6 ws6">do<span class="_ _0"></span>es not require you to indent inst<span class="_ _0"></span>ructions and </span></div><div class="t m0 x2 h4 y9 ff2 fs1 fc0 sc0 ls6 ws7">directives. Labels are <span class="_ _0"></span>recognized by th<span class="_ _0"></span>e following colon in<span class="_ _0"></span><span class="ls1 ws8">stead of their positio<span class="_ _0"></span>n at the start of a line. An </span></div><div class="t m0 x2 h4 ya ff2 fs1 fc0 sc0 ls2 ws9">example follows showing a simple <span class="_ _0"></span>assembly program defining a<span class="_ _0"></span> function &#8216;<span class="ff3 ls4 ws1">add&#8217;<span class="ff2 wsa"> that returns the sum of </span></span></div><div class="t m0 x2 h4 yb ff2 fs1 fc0 sc0 ls7 wsb">two input arguments: </div><div class="t m0 x2 h4 yc ff2 fs1 fc0 sc0 ls1 ws1"> </div><div class="t m0 x3 h5 yd ff3 fs1 fc0 sc0 ls4 ws1">.section .text, &#8220;x&#8221; </div><div class="t m0 x3 h5 ye ff3 fs1 fc0 sc0 ls1 ws1"> </div><div class="t m0 x3 h5 yf ff3 fs1 fc0 sc0 ls4 ws1">.global <span class="_ _2"> </span>add <span class="_ _3"> </span> <span class="_ _4"> </span> <span class="_ _4"> </span>@ give the symbol add external linkage </div><div class="t m0 x3 h5 y10 ff3 fs1 fc0 sc0 ls1 ws1"> </div><div class="t m0 x3 h5 y11 ff3 fs1 fc0 sc0 ls4 ws1">add: </div><div class="t m0 x3 h5 y12 ff3 fs1 fc0 sc0 ls4 ws1"> <span class="_ _4"> </span>ADD <span class="_ _3"> </span>r0, r0, r1 <span class="_"> </span> <span class="_ _4"> </span>@ add input arguments </div><div class="t m0 x3 h5 y13 ff3 fs1 fc0 sc0 ls4 ws1"> <span class="_ _4"> </span>MOV <span class="_ _3"> </span>pc, lr <span class="_ _4"> </span> <span class="_ _4"> </span>@ return from subroutine </div><div class="t m0 x3 h4 y14 ff2 fs1 fc0 sc0 ls1 ws1"> </div><div class="t m0 x4 h5 y15 ff3 fs1 fc0 sc0 ls4 ws1">@ end of program </div><div class="t m0 x2 h3 y16 ff1 fs1 fc0 sc0 ls1 ws1"> </div><div class="t m0 x2 h3 y17 ff1 fs1 fc0 sc0 ls8 wsc">GNU Assembler Directiv<span class="_ _0"></span>es for ARM </div><div class="t m0 x2 h3 y18 ff1 fs1 fc0 sc0 ls1 ws1"> </div><div class="t m0 x2 h4 y19 ff2 fs1 fc0 sc0 ls9 wsd">The follow is an alphabetical listing of the more <span class="_ _0"></span>command GNU assembler dire<span class="_ _0"></span>ctives. </div><div class="t m0 x2 h4 y1a ff2 fs1 fc0 sc0 ls1 ws1"> </div><div class="t m0 x2 h3 y1b ff1 fs1 fc0 sc0 lsa wse">GNU Assembler Directive <span class="_ _5"> </span><span class="ls1 ws1">Description </span></div><div class="t m0 x2 h5 y1c ff3 fs1 fc0 sc0 ls4 ws1">.ascii &#8220;&lt;string&gt;&#8221; </div><div class="t m0 x5 h4 y1d ff2 fs1 fc0 sc0 ls1 wsf">Inserts the string as data into the assem<span class="_ _0"></span>bly (like DCB in </div><div class="t m0 x5 h4 y1e ff2 fs1 fc0 sc0 lsb ws1">armasm). </div><div class="t m0 x2 h5 y1f ff3 fs1 fc0 sc0 ls4 ws1">.asciz &#8220;&lt;string&gt;&#8221; </div><div class="t m0 x5 h4 y20 ff2 fs1 fc0 sc0 lsc ws10">Like .ascii, but follows the string with a zero byte. </div><div class="t m0 x2 h5 y21 ff3 fs1 fc0 sc0 ls4 ws1">.balign &lt;power_of_2&gt; </div><div class="t m0 x2 h5 y22 ff3 fs1 fc0 sc0 ls4 ws1">{,&lt;fill_value&gt; </div><div class="t m0 x2 h5 y23 ff3 fs1 fc0 sc0 ls4 ws1">{,&lt;max_padding&gt;} } </div><div class="t m0 x5 h4 y24 ff2 fs1 fc0 sc0 ls9 wsd">Aligns the address to &lt;power_of_2<span class="_ _0"></span>&gt; bytes. The assembler </div><div class="t m0 x5 h4 y25 ff2 fs1 fc0 sc0 ls2 ws3">aligns by adding bytes of value &lt;fill_value&gt; or a suitable default. </div><div class="t m0 x5 h4 y26 ff2 fs1 fc0 sc0 lsd ws11">The alignment will not occur if<span class="ls3 ws4"> more than &lt;max_padding&gt; fill </span></div><div class="t m0 x5 h4 y27 ff2 fs1 fc0 sc0 lse ws12">bytes are required (similar <span class="_ _0"></span>to ALIGN in armasm). </div><div class="t m0 x2 h5 y28 ff3 fs1 fc0 sc0 ls4 ws1">.byte &lt;byte1&gt; {,&lt;byte2&gt;} &#8230; </div><div class="t m0 x5 h4 y29 ff2 fs1 fc0 sc0 lsf ws13">Inserts a list of byte values as data into the assembly (like DCB </div><div class="t m0 x5 h4 y2a ff2 fs1 fc0 sc0 lsa wse">in armasm). </div><div class="t m0 x2 h5 y2b ff3 fs1 fc0 sc0 ls4 ws1">.code &lt;number_of_bits&gt; </div><div class="t m0 x5 h4 y2c ff2 fs1 fc0 sc0 lsa wse">Sets the instruction width in bits. Use 16 for Thumb and 32 for </div><div class="t m0 x5 h4 y2d ff2 fs1 fc0 sc0 ls6 ws14">ARM assembly (similar to CODE16 an<span class="_ _0"></span>d CODE32 in armasm<span class="_ _0"></span>). </div><div class="t m0 x2 h5 y2e ff3 fs1 fc0 sc0 ls4 ws1">.else </div><div class="t m0 x5 h4 y2f ff2 fs1 fc0 sc0 ls2 ws3">Use with .if and .endif (similar to ELSE in armasm). </div><div class="t m0 x2 h5 y30 ff3 fs1 fc0 sc0 ls4 ws1">.end </div><div class="t m0 x5 h4 y31 ff2 fs1 fc0 sc0 ls10 ws15">Marks the end of the assembly file (usually omitted). </div><div class="t m0 x2 h5 y32 ff3 fs1 fc0 sc0 ls4 ws1">.endif </div><div class="t m0 x5 h4 y33 ff2 fs1 fc0 sc0 ls9 wsd">Ends a conditional compilation co<span class="_ _0"></span>de block &#8211; see .if, .ifdef, .ifndef </div><div class="t m0 x5 h4 y34 ff2 fs1 fc0 sc0 ls10 ws15">(similar to ENDIF in armasm). </div><div class="t m0 x2 h5 y35 ff3 fs1 fc0 sc0 ls4 ws1">.endm </div><div class="t m0 x5 h4 y36 ff2 fs1 fc0 sc0 ls7 wsb">Ends a macro definition &#8211; see .macro (similar to MEND in </div><div class="t m0 x5 h4 y37 ff2 fs1 fc0 sc0 lsb ws1">armasm). </div><div class="t m0 x2 h5 y38 ff3 fs1 fc0 sc0 ls4 ws1">.endr </div><div class="t m0 x5 h4 y39 ff2 fs1 fc0 sc0 ls7 wsb">Ends a repeat loop &#8211; see .rept and .irp (similar to WEND in </div><div class="t m0 x5 h4 y3a ff2 fs1 fc0 sc0 lsb ws1">armasm). </div><div class="t m0 x2 h5 y3b ff3 fs1 fc0 sc0 ls4 ws1">.equ &lt;symbol name&gt;, &lt;value&gt; </div><div class="t m0 x5 h4 y3c ff2 fs1 fc0 sc0 lsa wse">This directive sets the value of a symbol (simila<span class="_ _0"></span>r to EQU in </div><div class="t m0 x5 h4 y3d ff2 fs1 fc0 sc0 ls11 ws1">armasm) </div><div class="t m0 x2 h5 y3e ff3 fs1 fc0 sc0 ls4 ws1">.err </div><div class="t m0 x5 h4 y3f ff2 fs1 fc0 sc0 ls4 ws16">Causes assembly to halt with an error. </div><div class="t m0 x2 h5 y40 ff3 fs1 fc0 sc0 ls4 ws1">.exitm </div><div class="t m0 x5 h4 y41 ff2 fs1 fc0 sc0 ls12 ws17">Exit a macro partway through &#8211; see .macro (simil<span class="_ _0"></span>ar to MEXIT in </div><div class="t m0 x5 h4 y42 ff2 fs1 fc0 sc0 ls11 ws1">armasm) </div><div class="t m0 x2 h5 y43 ff3 fs1 fc0 sc0 ls4 ws1">.global &lt;symbol&gt; </div><div class="t m0 x5 h4 y44 ff2 fs1 fc0 sc0 lse ws12">This directive gives the symbol extern<span class="_ _0"></span>al linkage (simil<span class="_ _0"></span>ar to </div><div class="t m0 x5 h4 y45 ff2 fs1 fc0 sc0 ls13 ws18">EXPORT in armasm). </div><div class="t m0 x2 h5 y46 ff3 fs1 fc0 sc0 ls4 ws1">.hword &lt;short1&gt; {,&lt;short2&gt;} </div><div class="t m0 x2 h5 y47 ff3 fs1 fc0 sc0 ls4 ws1">&#8230; </div><div class="t m0 x5 h4 y48 ff2 fs1 fc0 sc0 ls1 wsf">Inserts a list of 16-bit values a<span class="_ _0"></span>s data into the assembly (similar to </div><div class="t m0 x5 h4 y49 ff2 fs1 fc0 sc0 ls14 ws19">DCW in armasm). </div></div><div class="pi" data-data='{"ctm":[1.568627,0.000000,0.000000,1.568627,0.000000,0.000000]}'></div></div> </body> </html>
评论
    相关推荐