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