Go to the documentation of this file.
46 #if !defined (CORE_CM0_H)
58 #if defined ( __DCC__ )
59 #define BKPT_ASM __asm ("BKPT 0\n\t")
61 #define BKPT_ASM __asm ("BKPT #0\n\t")
66 #if defined (__GNUC__)
67 #define ENABLE_INTERRUPTS() __asm volatile ("cpsie i" : : : "memory");
68 #elif defined ( __DCC__ )
69 #define ENABLE_INTERRUPTS() __asm (".short 0xb662");
71 #define ENABLE_INTERRUPTS() __asm("cpsie i")
77 #if defined (__GNUC__)
78 #define DISABLE_INTERRUPTS() __asm volatile ("cpsid i" : : : "memory");
79 #elif defined ( __DCC__ )
80 #define DISABLE_INTERRUPTS() __asm (".short 0xb672");
82 #define DISABLE_INTERRUPTS() __asm("cpsid i")
89 #if defined (__GNUC__)
90 #define STANDBY() __asm volatile ("wfi")
91 #elif defined ( __DCC__ )
92 #define STANDBY() __asm (".short 0xbf30");
94 #define STANDBY() __asm ("wfi")
100 #if defined (__GNUC__) || defined (__ICCARM__) || defined (__ghs__) || defined (__ARMCC_VERSION)
101 #define REV_BYTES_32(a, b) __asm volatile ("rev %0, %1" : "=r" (b) : "r" (a))
103 #define REV_BYTES_32(a, b) (b = ((a & 0xFF000000U) >> 24U) | ((a & 0xFF0000U) >> 8U) \
104 | ((a & 0xFF00U) << 8U) | ((a & 0xFFU) << 24U))
109 #if defined (__GNUC__) || defined (__ICCARM__) || defined (__ghs__) || defined (__ARMCC_VERSION)
110 #define REV_BYTES_16(a, b) __asm volatile ("rev16 %0, %1" : "=r" (b) : "r" (a))
112 #define REV_BYTES_16(a, b) (b = ((a & 0xFF000000U) >> 8U) | ((a & 0xFF0000U) << 8U) \
113 | ((a & 0xFF00U) >> 8U) | ((a & 0xFFU) << 8U))
118 #if defined ( __GNUC__ ) || defined (__ARMCC_VERSION)
119 #define START_FUNCTION_DECLARATION_RAMSECTION
120 #define END_FUNCTION_DECLARATION_RAMSECTION __attribute__((section (".code_ram")));
121 #elif defined ( __ghs__ )
122 #define START_FUNCTION_DECLARATION_RAMSECTION _Pragma("ghs callmode=far")
123 #define END_FUNCTION_DECLARATION_RAMSECTION __attribute__((section (".code_ram")));\
124 _Pragma("ghs callmode=default")
125 #elif defined ( __ICCARM__ )
126 #define START_FUNCTION_DECLARATION_RAMSECTION __ramfunc
127 #define END_FUNCTION_DECLARATION_RAMSECTION ;
128 #elif defined ( __DCC__ )
129 #define START_FUNCTION_DECLARATION_RAMSECTION _Pragma("section CODE \".code_ram\" \"\" far-absolute") \
130 _Pragma("use_section CODE")
131 #define END_FUNCTION_DECLARATION_RAMSECTION ; \
132 _Pragma("section CODE \".text\"")
135 #define START_FUNCTION_DECLARATION_RAMSECTION
136 #define END_FUNCTION_DECLARATION_RAMSECTION ;
142 #define START_FUNCTION_DEFINITION_RAMSECTION
143 #define END_FUNCTION_DEFINITION_RAMSECTION
145 #if defined (__ICCARM__)
146 #define DISABLE_CHECK_RAMSECTION_FUNCTION_CALL _Pragma("diag_suppress=Ta022")
147 #define ENABLE_CHECK_RAMSECTION_FUNCTION_CALL _Pragma("diag_default=Ta022")
149 #define DISABLE_CHECK_RAMSECTION_FUNCTION_CALL
150 #define ENABLE_CHECK_RAMSECTION_FUNCTION_CALL
157 #define GET_CORE_ID() 0U
161 #if defined ( __GNUC__ ) || defined ( __ghs__ ) || defined ( __DCC__ ) || defined (__ARMCC_VERSION)
162 #define ALIGNED(x) __attribute__((aligned(x)))
163 #elif defined ( __ICCARM__ )
164 #define stringify(s) tostring(s)
165 #define tostring(s) #s
166 #define ALIGNED(x) _Pragma(stringify(data_alignment=x))
174 #define CORE_LITTLE_ENDIAN