1 /* ---------------------------------------------------------------------------- 2 * Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved. 3 * Description: los_builddef 4 * Redistribution and use in source and binary forms, with or without modification, 5 * are permitted provided that the following conditions are met: 6 * 1. Redistributions of source code must retain the above copyright notice, this list of 7 * conditions and the following disclaimer. 8 * 2. Redistributions in binary form must reproduce the above copyright notice, this list 9 * of conditions and the following disclaimer in the documentation and/or other materials 10 * provided with the distribution. 11 * 3. Neither the name of the copyright holder nor the names of its contributors may be used 12 * to endorse or promote products derived from this software without specific prior written 13 * permission. 14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 15 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * --------------------------------------------------------------------------- */ 26 27 /** 28 * @defgroup los_builddef 29 * @ingroup kernel 30 */ 31 32 #ifndef _LOS_BUILDEF_H 33 #define _LOS_BUILDEF_H 34 #include "los_compiler.h" 35 #ifdef __cplusplus 36 #if __cplusplus 37 extern "C" { 38 #endif /* __cplusplus */ 39 #endif /* __cplusplus */ 40 41 /** 42 * @ingroup los_builddef 43 * Little endian 44 */ 45 #define OS_LITTLE_ENDIAN 0x1234 46 47 /** 48 * @ingroup los_builddef 49 * Big endian 50 */ 51 #define OS_BIG_ENDIAN 0x4321 52 53 /** 54 * @ingroup los_builddef 55 * Byte order 56 */ 57 #ifndef OS_BYTE_ORDER 58 #define OS_BYTE_ORDER OS_LITTLE_ENDIAN 59 #endif 60 61 /* Define OS code data sections */ 62 /* The indicator function is inline */ 63 /** 64 * @ingroup los_builddef 65 * Allow inline sections 66 */ 67 #ifndef LITE_OS_SEC_ALW_INLINE 68 #define LITE_OS_SEC_ALW_INLINE __attribute__((always_inline)) 69 #endif 70 71 /** 72 * @ingroup los_builddef 73 * Vector table section 74 */ 75 #ifndef LITE_OS_SEC_VEC 76 #define LITE_OS_SEC_VEC __attribute__ ((section(".data.vector"))) 77 #endif 78 79 /** 80 * @ingroup los_builddef 81 * .Text section (Code section) 82 */ 83 #ifndef LITE_OS_SEC_TEXT 84 #define LITE_OS_SEC_TEXT 85 #endif 86 87 /** 88 * @ingroup los_builddef 89 * .Text.ddr section 90 */ 91 #ifndef LITE_OS_SEC_TEXT_MINOR 92 #define LITE_OS_SEC_TEXT_MINOR 93 #endif 94 95 /** 96 * @ingroup los_builddef 97 * .Text.init section 98 */ 99 #ifndef LITE_OS_SEC_TEXT_INIT 100 #define LITE_OS_SEC_TEXT_INIT 101 #endif 102 103 /** 104 * @ingroup los_builddef 105 * Redirect .Text section (Code section) 106 */ 107 #ifndef LITE_OS_SEC_TEXT_REDIRECT 108 #define LITE_OS_SEC_TEXT_REDIRECT LITE_OS_SEC_TEXT 109 #endif 110 111 /** 112 * @ingroup los_builddef 113 * Redirect .Text.ddr section 114 */ 115 #ifndef LITE_OS_SEC_TEXT_MINOR_REDIRECT 116 #define LITE_OS_SEC_TEXT_MINOR_REDIRECT LITE_OS_SEC_TEXT_MINOR 117 #endif 118 119 /** 120 * @ingroup los_builddef 121 * Redirect .Text.init section 122 */ 123 #ifndef LITE_OS_SEC_TEXT_INIT_REDIRECT 124 #define LITE_OS_SEC_TEXT_INIT_REDIRECT LITE_OS_SEC_TEXT_INIT 125 #endif 126 127 128 #ifndef LITE_OS_RAM_SECTION 129 #define LITE_OS_RAM_SECTION __attribute__ ((section(".ram.kernel"))) 130 #endif 131 132 /** 133 * @ingroup los_builddef 134 * .rodata section 135 */ 136 #ifndef LITE_OS_SEC_RODATA 137 #define LITE_OS_SEC_RODATA 138 #endif 139 140 /** 141 * @ingroup los_builddef 142 * .Data section 143 */ 144 #ifndef LITE_OS_SEC_DATA 145 #define LITE_OS_SEC_DATA __attribute__ ((section(".data"))) 146 #endif 147 148 /** 149 * @ingroup los_builddef 150 * .remap section 151 */ 152 #ifndef LITE_OS_SEC_REMAP 153 #define LITE_OS_SEC_REMAP __attribute__ ((section(".fpb.remap"))) 154 #endif 155 156 157 /** 158 * @ingroup los_builddef 159 * .Data.init section 160 */ 161 #ifndef LITE_OS_SEC_DATA_INIT 162 #define LITE_OS_SEC_DATA_INIT 163 #endif 164 165 /** 166 * @ingroup los_builddef 167 * Not initialized variable section 168 */ 169 #ifndef LITE_OS_SEC_BSS 170 #define LITE_OS_SEC_BSS 171 #endif 172 173 /** 174 * @ingroup los_builddef 175 * .bss.ddr section 176 */ 177 #ifndef LITE_OS_SEC_BSS_MINOR 178 #define LITE_OS_SEC_BSS_MINOR 179 #endif 180 181 /** 182 * @ingroup los_builddef 183 * .bss.init sections 184 */ 185 #ifndef LITE_OS_SEC_BSS_INIT 186 #define LITE_OS_SEC_BSS_INIT 187 #endif 188 189 /** 190 * @ingroup los_builddef 191 * .text.rom.libsec section 192 */ 193 #ifndef LIB_SECURE_SEC_TEXT 194 #define LIB_SECURE_SEC_TEXT 195 #endif 196 197 /** 198 * @ingroup los_builddef 199 * .text.rom.libc section 200 */ 201 #ifndef LIBC_SEC_TEXT 202 #define LIBC_SEC_TEXT 203 #endif 204 205 /** 206 * @ingroup los_builddef 207 * Define extern 208 */ 209 #define EXTERN_FAR extern 210 211 #ifdef __cplusplus 212 #if __cplusplus 213 } 214 #endif /* __cplusplus */ 215 #endif /* __cplusplus */ 216 217 #endif /* _LOS_BUILDEF_H */ 218