lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /**************************************************************************
|
| 2 | *
|
| 3 | * Copyright (c) 2012 ZTE Corporation.
|
| 4 | *
|
| 5 | ***************************************************************************
|
| 6 | * Ä£ ¿é Ãû : P98C_OSS
|
| 7 | * ÎÄ ¼þ Ãû : oss_compiler.h
|
| 8 | * Ïà¹ØÎļþ :
|
| 9 | * ʵÏÖ¹¦ÄÜ : Óë±àÒëÆ÷ºêÏà¹ØµÄºê¶¨Òå
|
| 10 | * ×÷ Õß : chenxingfang
|
| 11 | * °æ ±¾ : V1.0
|
| 12 | * Íê³ÉÈÕÆÚ : 2012-08-10
|
| 13 | * ÆäËü˵Ã÷ :
|
| 14 | **************************************************************************/
|
| 15 |
|
| 16 | /**************************************************************************
|
| 17 | * Ð޸ļǼ
|
| 18 | **************************************************************************/
|
| 19 | #ifndef _OSS_COMPILER_H
|
| 20 | #define _OSS_COMPILER_H
|
| 21 |
|
| 22 | #define _USE_COMPILER
|
| 23 | #ifdef _USE_COMPILER
|
| 24 |
|
| 25 | /**************************************************************************
|
| 26 | * #includeÇø
|
| 27 | **************************************************************************/
|
| 28 | #ifdef _OS_TOS
|
| 29 | # include "tos_link_info.h"
|
| 30 | #endif
|
| 31 |
|
| 32 | #ifdef __cplusplus
|
| 33 | extern "C"
|
| 34 | {
|
| 35 | #endif
|
| 36 |
|
| 37 | /**************************************************************************
|
| 38 | * ³£Á¿¶¨ÒåÇø
|
| 39 | **************************************************************************/
|
| 40 | #ifdef _OS_LINUX
|
| 41 |
|
| 42 | #ifdef _USE_TCM
|
| 43 | # define __tcm_func __tcmfunc
|
| 44 | # define __tcm_call_func __attribute__((long_call))
|
| 45 | # define __tcm_local_func __tcmlocalfunc
|
| 46 | # define __tcm_data __tcmdata
|
| 47 | # define __tcm_const __tcmconst
|
| 48 | # define __gprof __attribute__((section(".gprof"), instrument_functions))
|
| 49 | #else
|
| 50 | # define __tcm_func
|
| 51 | # define __tcm_call_func
|
| 52 | # define __tcm_local_func
|
| 53 | # define __tcm_data
|
| 54 | # define __tcm_const
|
| 55 | # define __gprof
|
| 56 | #endif
|
| 57 | #ifdef CONFIG_MODEM_CODE_IS_MAPPING
|
| 58 | # define __ps_static_func __attribute__((section(".ps_static_func"), long_call)) noinline
|
| 59 | # define __ps_4g_func __attribute__((section(".ps_4g_func"), long_call)) noinline
|
| 60 | # define __ps_3g_func __attribute__((section(".ps_3g_func"), long_call)) noinline
|
| 61 | # define __ps_2g_func __attribute__((section(".ps_2g_func"), long_call)) noinline
|
| 62 | # define __ps_comm_func __attribute__((section(".ps_comm_func"), long_call)) noinline
|
| 63 | #else
|
| 64 | # define __ps_static_func
|
| 65 | # define __ps_4g_func
|
| 66 | # define __ps_3g_func
|
| 67 | # define __ps_2g_func
|
| 68 | # define __ps_comm_func
|
| 69 | #endif
|
| 70 | #else // #ifdef _OS_LINUX
|
| 71 |
|
| 72 | #if (__GNUC__ == 4) && (__GNUC_MINOR__ == 3) && (__GNUC_PATCHLEVEL__ == 2)
|
| 73 | # define barrier() asm volatile( "" : : : "memory" )
|
| 74 | #else
|
| 75 | # define barrier()
|
| 76 | #endif
|
| 77 |
|
| 78 | #if defined(__GNUC__) && defined (_USE_TCM)
|
| 79 | # define __tcm_func __attribute__((section(".itcm"), long_call)) noinline
|
| 80 | # define __tcm_call_func __attribute__((long_call))
|
| 81 | # define __tcm_data __attribute__((section(".dtcm")))
|
| 82 | # define __gprof __attribute__((section(".gprof"), instrument_functions))
|
| 83 | #elif defined (__ARMCC_VERSION) && defined (_USE_TCM)
|
| 84 | # define __tcm_func __attribute__((section(".itcm")))
|
| 85 | # define __tcm_call_func
|
| 86 | # define __tcm_data __attribute__((section(".dtcm")))
|
| 87 | # define __gprof
|
| 88 | #else
|
| 89 | # define __tcm_func
|
| 90 | # define __tcm_call_func
|
| 91 | # define __tcm_data
|
| 92 | # define __gprof
|
| 93 | #endif
|
| 94 |
|
| 95 | #ifdef __GNUC__
|
| 96 | # define inline __inline__
|
| 97 | # define always_inline __inline__ __attribute__((always_inline))
|
| 98 | # define noinline __attribute__((noinline))
|
| 99 | #elif defined (__ARMCC_VERSION)
|
| 100 | # define inline __inline
|
| 101 | # define always_inline __forceinline
|
| 102 | # define noinline
|
| 103 | #elif defined (_MSC_VER)
|
| 104 | # define inline inline
|
| 105 | # define always_inline inline
|
| 106 | # define noinline
|
| 107 | #else
|
| 108 | # define inline
|
| 109 | # define always_inline
|
| 110 | # define noinline
|
| 111 | #endif
|
| 112 |
|
| 113 | #endif // #ifdef _OS_LINUX
|
| 114 |
|
| 115 | #ifdef __GNUC__
|
| 116 | //#pragma GCC optimize("-O0")
|
| 117 | //#pragma GCC optimize("-O2")
|
| 118 | # define __optimize(x) __attribute__((optimize(__str(x))))
|
| 119 | #else
|
| 120 | # define __optimize(x)
|
| 121 | #endif
|
| 122 |
|
| 123 | #ifdef __ARMCC_VERSION
|
| 124 | # define PRAGMA(X) _Pragma(#X)
|
| 125 | # define RODATA_BEGIN(X) PRAGMA(arm section rodata=#X)
|
| 126 | # define RWDATA_BEGIN(X) PRAGMA(arm section rwdata=#X)
|
| 127 | # define ZIDATA_BEGIN(X) PRAGMA(arm section zidata=#X)
|
| 128 | # define CODE_BEGIN(X) PRAGMA(arm section code=#X)
|
| 129 |
|
| 130 | # define RODATA_END _Pragma("arm section rodata")
|
| 131 | # define RWDATA_END _Pragma("arm section rwdata")
|
| 132 | # define ZIDATA_END _Pragma("arm section zidata")
|
| 133 | # define CODE_END _Pragma("arm section code")
|
| 134 | #else
|
| 135 | # define PRAGMA(X)
|
| 136 | # define RODATA_BEGIN(X)
|
| 137 | # define RWDATA_BEGIN(X)
|
| 138 | # define ZIDATA_BEGIN(X)
|
| 139 | # define CODE_BEGIN(X)
|
| 140 |
|
| 141 | # define RODATA_END
|
| 142 | # define RWDATA_END
|
| 143 | # define ZIDATA_END
|
| 144 | # define CODE_END
|
| 145 | #endif
|
| 146 |
|
| 147 | /**************************************************************************
|
| 148 | * Êý¾Ý½á¹¹¶¨ÒåÇø
|
| 149 | **************************************************************************/
|
| 150 |
|
| 151 | /**************************************************************************
|
| 152 | * º¯ÊýÉùÃ÷Çø
|
| 153 | **************************************************************************/
|
| 154 |
|
| 155 | /**************************************************************************
|
| 156 | * È«¾Ö±äÁ¿ÉùÃ÷Çø
|
| 157 | **************************************************************************/
|
| 158 |
|
| 159 | #ifdef __cplusplus
|
| 160 | }
|
| 161 | #endif
|
| 162 |
|
| 163 | #endif /* _USE_COMPILER */
|
| 164 |
|
| 165 | #endif /* _OSS_COMPILER_H */
|
| 166 |
|
| 167 |
|