Epiphany-Function-Attributes.html 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2017 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <title>Using the GNU Compiler Collection (GCC): Epiphany Function Attributes</title>
  20. <meta name="description" content="Using the GNU Compiler Collection (GCC): Epiphany Function Attributes">
  21. <meta name="keywords" content="Using the GNU Compiler Collection (GCC): Epiphany Function Attributes">
  22. <meta name="resource-type" content="document">
  23. <meta name="distribution" content="global">
  24. <meta name="Generator" content="makeinfo">
  25. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="Function-Attributes.html#Function-Attributes" rel="up" title="Function Attributes">
  30. <link href="H8_002f300-Function-Attributes.html#H8_002f300-Function-Attributes" rel="next" title="H8/300 Function Attributes">
  31. <link href="CR16-Function-Attributes.html#CR16-Function-Attributes" rel="prev" title="CR16 Function Attributes">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.smallquotation {font-size: smaller}
  36. div.display {margin-left: 3.2em}
  37. div.example {margin-left: 3.2em}
  38. div.indentedblock {margin-left: 3.2em}
  39. div.lisp {margin-left: 3.2em}
  40. div.smalldisplay {margin-left: 3.2em}
  41. div.smallexample {margin-left: 3.2em}
  42. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style:oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nocodebreak {white-space:nowrap}
  54. span.nolinebreak {white-space:nowrap}
  55. span.roman {font-family:serif; font-weight:normal}
  56. span.sansserif {font-family:sans-serif; font-weight:normal}
  57. ul.no-bullet {list-style: none}
  58. -->
  59. </style>
  60. </head>
  61. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  62. <a name="Epiphany-Function-Attributes"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="H8_002f300-Function-Attributes.html#H8_002f300-Function-Attributes" accesskey="n" rel="next">H8/300 Function Attributes</a>, Previous: <a href="CR16-Function-Attributes.html#CR16-Function-Attributes" accesskey="p" rel="prev">CR16 Function Attributes</a>, Up: <a href="Function-Attributes.html#Function-Attributes" accesskey="u" rel="up">Function Attributes</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  66. </div>
  67. <hr>
  68. <a name="Epiphany-Function-Attributes-1"></a>
  69. <h4 class="subsection">6.31.8 Epiphany Function Attributes</h4>
  70. <p>These function attributes are supported by the Epiphany back end:
  71. </p>
  72. <dl compact="compact">
  73. <dt><code>disinterrupt</code></dt>
  74. <dd><a name="index-disinterrupt-function-attribute_002c-Epiphany"></a>
  75. <p>This attribute causes the compiler to emit
  76. instructions to disable interrupts for the duration of the given
  77. function.
  78. </p>
  79. </dd>
  80. <dt><code>forwarder_section</code></dt>
  81. <dd><a name="index-forwarder_005fsection-function-attribute_002c-Epiphany"></a>
  82. <p>This attribute modifies the behavior of an interrupt handler.
  83. The interrupt handler may be in external memory which cannot be
  84. reached by a branch instruction, so generate a local memory trampoline
  85. to transfer control. The single parameter identifies the section where
  86. the trampoline is placed.
  87. </p>
  88. </dd>
  89. <dt><code>interrupt</code></dt>
  90. <dd><a name="index-interrupt-function-attribute_002c-Epiphany"></a>
  91. <p>Use this attribute to indicate
  92. that the specified function is an interrupt handler. The compiler generates
  93. function entry and exit sequences suitable for use in an interrupt handler
  94. when this attribute is present. It may also generate
  95. a special section with code to initialize the interrupt vector table.
  96. </p>
  97. <p>On Epiphany targets one or more optional parameters can be added like this:
  98. </p>
  99. <div class="smallexample">
  100. <pre class="smallexample">void __attribute__ ((interrupt (&quot;dma0, dma1&quot;))) universal_dma_handler ();
  101. </pre></div>
  102. <p>Permissible values for these parameters are: <code>reset</code><!-- /@w -->,
  103. <code><span class="nolinebreak">software_exception</span></code><!-- /@w -->, <code><span class="nolinebreak">page_miss</span></code><!-- /@w -->,
  104. <code>timer0</code><!-- /@w -->, <code>timer1</code><!-- /@w -->, <code>message</code><!-- /@w -->,
  105. <code>dma0</code><!-- /@w -->, <code>dma1</code><!-- /@w -->, <code>wand</code><!-- /@w --> and <code>swi</code><!-- /@w -->.
  106. Multiple parameters indicate that multiple entries in the interrupt
  107. vector table should be initialized for this function, i.e. for each
  108. parameter <var>name</var><!-- /@w -->, a jump to the function is emitted in
  109. the section <span class="nolinebreak">ivt_entry_</span><var>name</var><!-- /@w -->. The parameter(s) may be omitted
  110. entirely, in which case no interrupt vector table entry is provided.
  111. </p>
  112. <p>Note that interrupts are enabled inside the function
  113. unless the <code>disinterrupt</code> attribute is also specified.
  114. </p>
  115. <p>The following examples are all valid uses of these attributes on
  116. Epiphany targets:
  117. </p><div class="smallexample">
  118. <pre class="smallexample">void __attribute__ ((interrupt)) universal_handler ();
  119. void __attribute__ ((interrupt (&quot;dma1&quot;))) dma1_handler ();
  120. void __attribute__ ((interrupt (&quot;dma0, dma1&quot;)))
  121. universal_dma_handler ();
  122. void __attribute__ ((interrupt (&quot;timer0&quot;), disinterrupt))
  123. fast_timer_handler ();
  124. void __attribute__ ((interrupt (&quot;dma0, dma1&quot;),
  125. forwarder_section (&quot;tramp&quot;)))
  126. external_dma_handler ();
  127. </pre></div>
  128. </dd>
  129. <dt><code>long_call</code></dt>
  130. <dt><code>short_call</code></dt>
  131. <dd><a name="index-long_005fcall-function-attribute_002c-Epiphany"></a>
  132. <a name="index-short_005fcall-function-attribute_002c-Epiphany"></a>
  133. <a name="index-indirect-calls_002c-Epiphany"></a>
  134. <p>These attributes specify how a particular function is called.
  135. These attributes override the
  136. <samp>-mlong-calls</samp> (see <a href="Adapteva-Epiphany-Options.html#Adapteva-Epiphany-Options">Adapteva Epiphany Options</a>)
  137. command-line switch and <code>#pragma long_calls</code> settings.
  138. </p></dd>
  139. </dl>
  140. <hr>
  141. <div class="header">
  142. <p>
  143. Next: <a href="H8_002f300-Function-Attributes.html#H8_002f300-Function-Attributes" accesskey="n" rel="next">H8/300 Function Attributes</a>, Previous: <a href="CR16-Function-Attributes.html#CR16-Function-Attributes" accesskey="p" rel="prev">CR16 Function Attributes</a>, Up: <a href="Function-Attributes.html#Function-Attributes" accesskey="u" rel="up">Function Attributes</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  144. </div>
  145. </body>
  146. </html>