You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

194 line
6.3KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- This file documents the GNU Assembler "as".
  4. Copyright (C) 1991-2020 Free Software Foundation, Inc.
  5. Permission is granted to copy, distribute and/or modify this document
  6. under the terms of the GNU Free Documentation License, Version 1.3
  7. or any later version published by the Free Software Foundation;
  8. with no Invariant Sections, with no Front-Cover Texts, and with no
  9. Back-Cover Texts. A copy of the license is included in the
  10. section entitled "GNU Free Documentation License".
  11. -->
  12. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  15. <title>MSP430 Profiling Capability (Using as)</title>
  16. <meta name="description" content="MSP430 Profiling Capability (Using as)">
  17. <meta name="keywords" content="MSP430 Profiling Capability (Using as)">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  21. <link href="index.html#Top" rel="start" title="Top">
  22. <link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
  23. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  24. <link href="MSP430_002dDependent.html#MSP430_002dDependent" rel="up" title="MSP430-Dependent">
  25. <link href="NDS32_002dDependent.html#NDS32_002dDependent" rel="next" title="NDS32-Dependent">
  26. <link href="MSP430-Opcodes.html#MSP430-Opcodes" rel="prev" title="MSP430 Opcodes">
  27. <style type="text/css">
  28. <!--
  29. a.summary-letter {text-decoration: none}
  30. blockquote.indentedblock {margin-right: 0em}
  31. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  32. blockquote.smallquotation {font-size: smaller}
  33. div.display {margin-left: 3.2em}
  34. div.example {margin-left: 3.2em}
  35. div.lisp {margin-left: 3.2em}
  36. div.smalldisplay {margin-left: 3.2em}
  37. div.smallexample {margin-left: 3.2em}
  38. div.smalllisp {margin-left: 3.2em}
  39. kbd {font-style: oblique}
  40. pre.display {font-family: inherit}
  41. pre.format {font-family: inherit}
  42. pre.menu-comment {font-family: serif}
  43. pre.menu-preformatted {font-family: serif}
  44. pre.smalldisplay {font-family: inherit; font-size: smaller}
  45. pre.smallexample {font-size: smaller}
  46. pre.smallformat {font-family: inherit; font-size: smaller}
  47. pre.smalllisp {font-size: smaller}
  48. span.nolinebreak {white-space: nowrap}
  49. span.roman {font-family: initial; font-weight: normal}
  50. span.sansserif {font-family: sans-serif; font-weight: normal}
  51. ul.no-bullet {list-style: none}
  52. -->
  53. </style>
  54. </head>
  55. <body lang="en">
  56. <a name="MSP430-Profiling-Capability"></a>
  57. <div class="header">
  58. <p>
  59. Previous: <a href="MSP430-Opcodes.html#MSP430-Opcodes" accesskey="p" rel="prev">MSP430 Opcodes</a>, Up: <a href="MSP430_002dDependent.html#MSP430_002dDependent" accesskey="u" rel="up">MSP430-Dependent</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  60. </div>
  61. <hr>
  62. <a name="Profiling-Capability"></a>
  63. <h4 class="subsection">9.29.6 Profiling Capability</h4>
  64. <a name="index-MSP-430-profiling-capability"></a>
  65. <a name="index-profiling-capability-for-MSP-430"></a>
  66. <p>It is a performance hit to use gcc&rsquo;s profiling approach for this tiny target.
  67. Even more &ndash; jtag hardware facility does not perform any profiling functions.
  68. However we&rsquo;ve got gdb&rsquo;s built-in simulator where we can do anything.
  69. </p>
  70. <p>We define new section &lsquo;<samp>.profiler</samp>&rsquo; which holds all profiling information.
  71. We define new pseudo operation &lsquo;<samp>.profiler</samp>&rsquo; which will instruct assembler to
  72. add new profile entry to the object file. Profile should take place at the
  73. present address.
  74. </p>
  75. <p>Pseudo operation format:
  76. </p>
  77. <p>&lsquo;<samp>.profiler flags,function_to_profile [, cycle_corrector, extra]</samp>&rsquo;
  78. </p>
  79. <p>where:
  80. </p>
  81. <dl compact="compact">
  82. <dd>
  83. <dl compact="compact">
  84. <dd>
  85. <p>&lsquo;<samp>flags</samp>&rsquo; is a combination of the following characters:
  86. </p>
  87. </dd>
  88. <dt><code>s</code></dt>
  89. <dd><p>function entry
  90. </p></dd>
  91. <dt><code>x</code></dt>
  92. <dd><p>function exit
  93. </p></dd>
  94. <dt><code>i</code></dt>
  95. <dd><p>function is in init section
  96. </p></dd>
  97. <dt><code>f</code></dt>
  98. <dd><p>function is in fini section
  99. </p></dd>
  100. <dt><code>l</code></dt>
  101. <dd><p>library call
  102. </p></dd>
  103. <dt><code>c</code></dt>
  104. <dd><p>libc standard call
  105. </p></dd>
  106. <dt><code>d</code></dt>
  107. <dd><p>stack value demand
  108. </p></dd>
  109. <dt><code>I</code></dt>
  110. <dd><p>interrupt service routine
  111. </p></dd>
  112. <dt><code>P</code></dt>
  113. <dd><p>prologue start
  114. </p></dd>
  115. <dt><code>p</code></dt>
  116. <dd><p>prologue end
  117. </p></dd>
  118. <dt><code>E</code></dt>
  119. <dd><p>epilogue start
  120. </p></dd>
  121. <dt><code>e</code></dt>
  122. <dd><p>epilogue end
  123. </p></dd>
  124. <dt><code>j</code></dt>
  125. <dd><p>long jump / sjlj unwind
  126. </p></dd>
  127. <dt><code>a</code></dt>
  128. <dd><p>an arbitrary code fragment
  129. </p></dd>
  130. <dt><code>t</code></dt>
  131. <dd><p>extra parameter saved (a constant value like frame size)
  132. </p></dd>
  133. </dl>
  134. </dd>
  135. <dt><code>function_to_profile</code></dt>
  136. <dd><p>a function address
  137. </p></dd>
  138. <dt><code>cycle_corrector</code></dt>
  139. <dd><p>a value which should be added to the cycle counter, zero if omitted.
  140. </p></dd>
  141. <dt><code>extra</code></dt>
  142. <dd><p>any extra parameter, zero if omitted.
  143. </p>
  144. </dd>
  145. </dl>
  146. <p>For example:
  147. </p><div class="smallexample">
  148. <pre class="smallexample">.global fxx
  149. .type fxx,@function
  150. fxx:
  151. .LFrameOffset_fxx=0x08
  152. .profiler &quot;scdP&quot;, fxx ; function entry.
  153. ; we also demand stack value to be saved
  154. push r11
  155. push r10
  156. push r9
  157. push r8
  158. .profiler &quot;cdpt&quot;,fxx,0, .LFrameOffset_fxx ; check stack value at this point
  159. ; (this is a prologue end)
  160. ; note, that spare var filled with
  161. ; the farme size
  162. mov r15,r8
  163. ...
  164. .profiler cdE,fxx ; check stack
  165. pop r8
  166. pop r9
  167. pop r10
  168. pop r11
  169. .profiler xcde,fxx,3 ; exit adds 3 to the cycle counter
  170. ret ; cause 'ret' insn takes 3 cycles
  171. </pre></div>
  172. <hr>
  173. <div class="header">
  174. <p>
  175. Previous: <a href="MSP430-Opcodes.html#MSP430-Opcodes" accesskey="p" rel="prev">MSP430 Opcodes</a>, Up: <a href="MSP430_002dDependent.html#MSP430_002dDependent" accesskey="u" rel="up">MSP430-Dependent</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  176. </div>
  177. </body>
  178. </html>