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