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