asmdefs.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. //*****************************************************************************
  2. //
  3. // Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
  4. //
  5. //
  6. // Redistribution and use in source and binary forms, with or without
  7. // modification, are permitted provided that the following conditions
  8. // are met:
  9. //
  10. // Redistributions of source code must retain the above copyright
  11. // notice, this list of conditions and the following disclaimer.
  12. //
  13. // Redistributions in binary form must reproduce the above copyright
  14. // notice, this list of conditions and the following disclaimer in the
  15. // documentation and/or other materials provided with the
  16. // distribution.
  17. //
  18. // Neither the name of Texas Instruments Incorporated nor the names of
  19. // its contributors may be used to endorse or promote products derived
  20. // from this software without specific prior written permission.
  21. //
  22. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  23. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  25. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  26. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  27. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  28. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  29. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  30. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  31. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  32. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33. //
  34. //*****************************************************************************
  35. //*****************************************************************************
  36. //
  37. // asmdefs.h - Macros to allow assembly code be portable among toolchains.
  38. //
  39. //*****************************************************************************
  40. #ifndef __ASMDEFS_H__
  41. #define __ASMDEFS_H__
  42. //*****************************************************************************
  43. //
  44. // The defines required for code_red.
  45. //
  46. //*****************************************************************************
  47. #ifdef codered
  48. //
  49. // The assembly code preamble required to put the assembler into the correct
  50. // configuration.
  51. //
  52. .syntax unified
  53. .thumb
  54. //
  55. // Section headers.
  56. //
  57. #define __LIBRARY__ @
  58. #define __TEXT__ .text
  59. #define __DATA__ .data
  60. #define __BSS__ .bss
  61. #define __TEXT_NOROOT__ .text
  62. //
  63. // Assembler nmenonics.
  64. //
  65. #define __ALIGN__ .balign 4
  66. #define __END__ .end
  67. #define __EXPORT__ .globl
  68. #define __IMPORT__ .extern
  69. #define __LABEL__ :
  70. #define __STR__ .ascii
  71. #define __THUMB_LABEL__ .thumb_func
  72. #define __WORD__ .word
  73. #define __INLINE_DATA__
  74. #endif // codered
  75. //*****************************************************************************
  76. //
  77. // The defines required for EW-ARM.
  78. //
  79. //*****************************************************************************
  80. #ifdef ewarm
  81. //
  82. // Section headers.
  83. //
  84. #define __LIBRARY__ module
  85. #define __TEXT__ rseg CODE:CODE(2)
  86. #define __DATA__ rseg DATA:DATA(2)
  87. #define __BSS__ rseg DATA:DATA(2)
  88. #define __TEXT_NOROOT__ rseg CODE:CODE:NOROOT(2)
  89. //
  90. // Assembler nmenonics.
  91. //
  92. #define __ALIGN__ alignrom 2
  93. #define __END__ end
  94. #define __EXPORT__ export
  95. #define __IMPORT__ import
  96. #define __LABEL__
  97. #define __STR__ dcb
  98. #define __THUMB_LABEL__ thumb
  99. #define __WORD__ dcd
  100. #define __INLINE_DATA__ data
  101. #endif // ewarm
  102. //*****************************************************************************
  103. //
  104. // The defines required for GCC.
  105. //
  106. //*****************************************************************************
  107. #if defined(gcc)
  108. //
  109. // The assembly code preamble required to put the assembler into the correct
  110. // configuration.
  111. //
  112. .syntax unified
  113. .thumb
  114. //
  115. // Section headers.
  116. //
  117. #define __LIBRARY__ @
  118. #define __TEXT__ .text
  119. #define __DATA__ .data
  120. #define __BSS__ .bss
  121. #define __TEXT_NOROOT__ .text
  122. //
  123. // Assembler nmenonics.
  124. //
  125. #define __ALIGN__ .balign 4
  126. #define __END__ .end
  127. #define __EXPORT__ .globl
  128. #define __IMPORT__ .extern
  129. #define __LABEL__ :
  130. #define __STR__ .ascii
  131. #define __THUMB_LABEL__ .thumb_func
  132. #define __WORD__ .word
  133. #define __INLINE_DATA__
  134. #endif // gcc
  135. //*****************************************************************************
  136. //
  137. // The defines required for RV-MDK.
  138. //
  139. //*****************************************************************************
  140. #ifdef rvmdk
  141. //
  142. // The assembly code preamble required to put the assembler into the correct
  143. // configuration.
  144. //
  145. thumb
  146. require8
  147. preserve8
  148. //
  149. // Section headers.
  150. //
  151. #define __LIBRARY__ ;
  152. #define __TEXT__ area ||.text||, code, readonly, align=2
  153. #define __DATA__ area ||.data||, data, align=2
  154. #define __BSS__ area ||.bss||, noinit, align=2
  155. #define __TEXT_NOROOT__ area ||.text||, code, readonly, align=2
  156. //
  157. // Assembler nmenonics.
  158. //
  159. #define __ALIGN__ align 4
  160. #define __END__ end
  161. #define __EXPORT__ export
  162. #define __IMPORT__ import
  163. #define __LABEL__
  164. #define __STR__ dcb
  165. #define __THUMB_LABEL__
  166. #define __WORD__ dcd
  167. #define __INLINE_DATA__
  168. #endif // rvmdk
  169. //*****************************************************************************
  170. //
  171. // The defines required for Sourcery G++.
  172. //
  173. //*****************************************************************************
  174. #if defined(sourcerygxx)
  175. //
  176. // The assembly code preamble required to put the assembler into the correct
  177. // configuration.
  178. //
  179. .syntax unified
  180. .thumb
  181. //
  182. // Section headers.
  183. //
  184. #define __LIBRARY__ @
  185. #define __TEXT__ .text
  186. #define __DATA__ .data
  187. #define __BSS__ .bss
  188. #define __TEXT_NOROOT__ .text
  189. //
  190. // Assembler nmenonics.
  191. //
  192. #define __ALIGN__ .balign 4
  193. #define __END__ .end
  194. #define __EXPORT__ .globl
  195. #define __IMPORT__ .extern
  196. #define __LABEL__ :
  197. #define __STR__ .ascii
  198. #define __THUMB_LABEL__ .thumb_func
  199. #define __WORD__ .word
  200. #define __INLINE_DATA__
  201. #endif // sourcerygxx
  202. #endif // __ASMDEF_H__