18#ifndef __USE_ARM_COMPILER_H_PART_1__
19#define __USE_ARM_COMPILER_H_PART_1__
29#if defined(__IS_COMPILER_IAR__) && __IS_COMPILER_IAR__
30# include <intrinsics.h>
33#ifndef __VSF_HEADER_ONLY_SHOW_COMPILER_INFO__
36#include "../__common/__compiler.h"
41#if __IS_COMPILER_ARM_COMPILER_5__ \
42 || __IS_COMPILER_ARM_COMPILER_6__
44# ifndef MAX_CONSTRUCTOR_PRIORITY
45# define MAX_CONSTRUCTOR_PRIORITY 65535
47#elif __IS_COMPILER_GCC__
49# undef MAX_CONSTRUCTOR_PRIORITY
50# define MAX_CONSTRUCTOR_PRIORITY 65534
53#ifndef VSF_UTILITIES_REQ___CMSIS_HEADER_FILE__FROM_USR
54#include "cmsis_compiler.h"
56#include VSF_UTILITIES_REQ___CMSIS_HEADER_FILE__FROM_USR
62#ifndef __USE_ARM_COMPILER_H_PART_2__
63#define __USE_ARM_COMPILER_H_PART_2__
70#if __IS_COMPILER_ARM_COMPILER_5__
73#elif __IS_COMPILER_ARM_COMPILER_6__
74#elif __IS_COMPILER_IAR__
75 #pragma language=extended
77 #define __VSF_STDIO_INTERNAL_FILE_NAME __FILE
78#elif __IS_COMPILER_GCC__
81 #define __COMPILER_HAS_NO_NEXTTOWARDF_IN_MATH__
83#elif __IS_COMPILER_LLVM__
85#elif defined(__TMS470__)
87#elif defined(__TASKING__)
90 #warning Not supported compiler type
97#if __IS_COMPILER_ARM_COMPILER_6__
98# pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
107 #define NOP() __asm__ __volatile__ ("nop");
112#if __IS_COMPILER_IAR__
113# define LOW_LEVEL_INIT_RET_T int
114# define VSF_CAL_NO_INIT __no_init
115# define VSF_CAL_NO_RETURN __attribute__((noreturn))
116# define VSF_CAL_ROOT __root
117# define VSF_CAL_INLINE inline
118# define VSF_CAL_NO_INLINE __attribute__((noinline))
119# define VSF_CAL_ALWAYS_INLINE inline __attribute__((always_inline))
120# define VSF_CAL_WEAK(...) __weak
121# define VSF_CAL_RAMFUNC __ramfunc
122# define __asm__ __asm
123# define __VSF_CAL_ALIGN(__N) __attribute__((aligned (__N)))
124# define __VSF_CAL_AT_ADDR(__ADDR) @ __ADDR
125# define __VSF_CAL_SECTION(__SEC) __attribute__((section (__SEC)))
126# define __VSF_CAL_WEAK_ALIAS(__ORIGIN, __ALIAS) \
127 _Pragma(__VSF_STR(weak __ORIGIN=__ALIAS))
128# define VSF_CAL_PACKED __attribute__((packed))
129# define VSF_CAL_UNALIGNED __packed
130# define VSF_CAL_TRANSPARENT_UNION __attribute__((transparent_union))
131# define __VSF_CAL_ALIGN_OF(...) __ALIGNOF__(__VA_ARGS__)
133# define __IAR_STARTUP_DATA_INIT __iar_data_init3
135# define __VSF_CAL_ISR(__VEC) void __VEC(void)
137#elif __IS_COMPILER_ARM_COMPILER_5__
138# define VSF_CAL_NO_INIT __attribute__( ( section( ".bss.noinit"),zero_init) )
139# define VSF_CAL_NO_RETURN __attribute__((noreturn))
140# define VSF_CAL_ROOT __attribute__((used))
141# define VSF_CAL_INLINE __inline
142# define VSF_CAL_NO_INLINE __attribute__((noinline))
143# define VSF_CAL_ALWAYS_INLINE __inline __attribute__((always_inline))
144# define VSF_CAL_WEAK(...) __attribute__((weak))
145# define VSF_CAL_RAMFUNC __attribute__((section (".textrw")))
146# define __asm__ __asm
147# define __VSF_CAL_ALIGN(__N) __attribute__((aligned (__N)))
148# define __VSF_CAL_AT_ADDR(__ADDR) __attribute__((at(__ADDR)))
149# define __VSF_CAL_SECTION(__SEC) __attribute__((section (__SEC)))
150# define __VSF_CAL_WEAK_ALIAS(__ORIGIN, __ALIAS) \
151 __attribute__((weakref(__VSF_STR(__ALIAS))))
153# define VSF_CAL_PACKED __attribute__((packed))
154# define VSF_CAL_UNALIGNED __packed
155# define VSF_CAL_TRANSPARENT_UNION __attribute__((transparent_union))
156# define __VSF_CAL_ALIGN_OF(...) __alignof__(__VA_ARGS__)
158# define __VSF_CAL_ISR(__VEC) void __VEC(void)
160#elif __IS_COMPILER_ARM_COMPILER_6__
161# define VSF_CAL_NO_INIT __attribute__( ( section( ".bss.noinit")) )
162# define VSF_CAL_NO_RETURN __attribute__((noreturn))
163# define VSF_CAL_ROOT __attribute__((used))
164# define VSF_CAL_INLINE __inline
165# define VSF_CAL_NO_INLINE __attribute__((noinline))
166# define VSF_CAL_ALWAYS_INLINE __inline __attribute__((always_inline))
167# define VSF_CAL_WEAK(...) __attribute__((weak))
168# define VSF_CAL_RAMFUNC __attribute__((section (".textrw")))
169# define __asm__ __asm
170# define __VSF_CAL_ALIGN(__N) __attribute__((aligned (__N)))
171# define __VSF_CAL_AT_ADDR(__ADDR) __attribute__((section (".ARM.__at_" #__ADDR)))
172# define __VSF_CAL_SECTION(__SEC) __attribute__((section (__SEC)))
173# define __VSF_CAL_WEAK_ALIAS(__ORIGIN, __ALIAS) \
174 __attribute__((weakref(__VSF_STR(__ALIAS))))
176# define VSF_CAL_PACKED __attribute__((packed))
177# define VSF_CAL_UNALIGNED __unaligned
178# define VSF_CAL_TRANSPARENT_UNION __attribute__((transparent_union))
179# define __VSF_CAL_ALIGN_OF(...) __alignof__(__VA_ARGS__)
181# define __VSF_CAL_ISR(__VEC) void __VEC(void)
189#if __IS_COMPILER_IAR__
190# define ENABLE_GLOBAL_INTERRUPT() __enable_interrupt()
192# define ENABLE_GLOBAL_INTERRUPT() __enable_irq()
196#if __IS_COMPILER_IAR__
197# define DISABLE_GLOBAL_INTERRUPT() ____disable_irq()
199static VSF_CAL_ALWAYS_INLINE
uint32_t ____disable_irq(
void)
201 uint32_t wPRIMASK = __get_interrupt_state();
202 __disable_interrupt();
206#elif __IS_COMPILER_ARM_COMPILER_5__
207# define DISABLE_GLOBAL_INTERRUPT() __disable_irq()
208#elif __IS_COMPILER_ARM_COMPILER_6__ && !defined(__CMSIS_ARMCC_V6_H)
209# define DISABLE_GLOBAL_INTERRUPT() __disable_irq()
210#elif __IS_COMPILER_GCC_
211# define DISABLE_GLOBAL_INTERRUPT() __disable_irq()
214# define DISABLE_GLOBAL_INTERRUPT() ____disable_irq()
216static VSF_CAL_ALWAYS_INLINE
uint32_t ____disable_irq(
void)
222 : [cpsr]
"=r"(cpsr));
227#if __IS_COMPILER_IAR__
228# define GET_GLOBAL_INTERRUPT_STATE() __get_interrupt_state()
229# define SET_GLOBAL_INTERRUPT_STATE(__STATE) __set_interrupt_state(__STATE)
231#elif __IS_COMPILER_ARM_COMPILER_5__ || __IS_COMPILER_ARM_COMPILER_6__
232# define GET_GLOBAL_INTERRUPT_STATE() __get_PRIMASK()
233# define SET_GLOBAL_INTERRUPT_STATE(__STATE) __set_PRIMASK(__STATE)
235#elif __IS_COMPILER_GCC__
236# define GET_GLOBAL_INTERRUPT_STATE() __get_PRIMASK()
237# define SET_GLOBAL_INTERRUPT_STATE(__STATE) __set_PRIMASK(__STATE)
241# define GET_GLOBAL_INTERRUPT_STATE() ____get_PRIMASK()
248VSF_CAL_ALWAYS_INLINE
static inline uint32_t ____get_PRIMASK(
void)
252 __asm__
volatile (
"MRS %0, primask" :
"=r" (result) );
256# define SET_GLOBAL_INTERRUPT_STATE(__STATE) ____set_PRIMASK(__STATE)
263VSF_CAL_ALWAYS_INLINE
static inline void ____set_PRIMASK(
uint32_t priMask)
265 __asm__
volatile (
"MSR primask, %0" : :
"r" (priMask) :
"memory");
272#if __IS_COMPILER_IAR__
274#ifndef __VECTOR_TABLE
275# define __VECTOR_TABLE __vector_table
277#ifndef __VECTOR_TABLE_ATTRIBUTE
278# define __VECTOR_TABLE_ATTRIBUTE @".intvec"
280#ifndef __PROGRAM_START
281# define __PROGRAM_START __iar_program_start
284# define __INITIAL_SP CSTACK$$Limit
287#elif __IS_COMPILER_ARM_COMPILER_6__ || __IS_COMPILER_ARM_COMPILER_5__
289#ifndef __VECTOR_TABLE
290# define __VECTOR_TABLE __Vectors
292#ifndef __VECTOR_TABLE_ATTRIBUTE
293# define __VECTOR_TABLE_ATTRIBUTE ROOT SECTION("RESET")
295#ifndef __PROGRAM_START
296# define __PROGRAM_START __main
299# define __INITIAL_SP Image$$ARM_LIB_STACK$$ZI$$Limit
304#ifndef __PROGRAM_START
305#define __PROGRAM_START __cmsis_start
310#define __INITIAL_SP __StackTop
314#define __STACK_LIMIT __StackLimit
317#ifndef __VECTOR_TABLE
318#define __VECTOR_TABLE __Vectors
321#ifndef __VECTOR_TABLE_ATTRIBUTE
322#define __VECTOR_TABLE_ATTRIBUTE __attribute((used, section(".vectors")))
#define __volatile__
Definition __compiler.h:56
uint32_t vsf_gint_state_t
Definition arm_compiler.h:243
unsigned int uint32_t
Definition lvgl.h:43