CMSIS2000  0.0.7
 Указатель Структуры данных Файлы Функции Переменные Определения типов Перечисления Элементы перечислений Макросы Группы Страницы
compiler.h
См. документацию.
1 /*
2  * CMSIS2000
3  * CMSIS-like sources for LPC2xxx series MCUs
4  *
5  * (C) Copyright 2011-2012, Dmitriy Cherepanov, All Rights Reserved
6  *
7  * Version: 0.0.7
8  * Date of the Last Update: 2013-03-04
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining a copy
11  * of this software and associated documentation files (the "Software"), to
12  * deal in the Software without restriction, including without limitation the
13  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
14  * sell copies of the Software, and to permit persons to whom the Software is
15  * furnished to do so, subject to the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be included in
18  * all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
26  * IN THE SOFTWARE.
27  *
28  * Do not be lasy! For the latest version see http://irtos.sourceforge.net .
29  *
30  *
31 #*/
32 /** \file
33  *\if russian_lng
34  * Файл используется для определения компиляторных фишек
35  *\else
36  * This file is used to define compiler specific things.
37  *\endif
38  *\date 2010
39  */
40 
41 #ifndef _COMPILLER_ARCH_H_
42 #define _COMPILLER_ARCH_H_ 1
43 /*----------------------------------------------------------------------------*/
44 #ifndef iSCHEDULER_TYPE
45  #define iSCHEDULER_TYPE -1
46 #endif
47 /*----------------------------------------------------------------------------*/
48 /*
49  * For CrossWare compiller
50  */
51 #ifdef _XCARM_VER
52  #if (_XCARM_VER != 0)
53  #define naked_func
54  //#define __GNUC__ = 0
55  #endif
56 #endif
57 /*----------------------------------------------------------------------------*/
58 /*
59  * For GNU Compiller
60  */
61 
62 #ifdef __GNUC__
63 #if (__GNUC__ != 0)
64 //__attribute__((noreturn))
65  #define naked_func __attribute__((noreturn))
66  //__attribute__((naked)) or may be change to fiq
67 
68  #ifndef __THUMBEL__
69  #define TH_MODE 0
70  #else
71  #define TH_MODE __THUMBEL__
72  #endif
73  #define ARM_MODE_MUL_CONST (65536-65535*(TH_MODE != 0))
74 
75  #define portARM_SWI(SWI_NUMBER) asm volatile( \
76  "swi %[swi_num] @ syscall SWI_NUMBER" \
77  : \
78  :[swi_num] "I" (SWI_NUMBER))
79 
80 #if (iSCHEDULER_TYPE == iPREEMPETIVE_SCHEDULER)
81  #define irq_func_decl naked_func //must be RTOS prolog and epilor functions for irq
82 #else
83  #define irq_func_decl __attribute__ ((interrupt ("IRQ"))) //use common irq sheme
84 #endif
85 #endif
86 #endif
87 /*----------------------------------------------------------------------------*/
88 /*
89  * FOR keil RVCT compiller
90  */
91 #if defined(__CC_ARM) && defined(__arm__) && defined(__ARMCC_VERSION) && defined(__EDG_VERSION__)
92  #define portARM_SWI(SWI_NUMBER) __asm {SVC (SWI_NUMBER);}
93  #if defined(__thumb___)
94  #define ARM_MODE_MUL_CONST 1
95  #else
96  #define ARM_MODE_MUL_CONST 65536
97  #endif
98  /** this const must be 65536 in arm mode and 1 in thumb mode*/
99  //#define ARM_MODE_MUL_CONST ARM_MODE_MUL_CONST_##__thumb__
100 /* will decrease stack usage*/
101  #define naked_func // __declspec(noreturn)
102 #if (iSCHEDULER_TYPE == iPREEMPETIVE_SCHEDULER)
103  #define irq_func_decl naked_func //must be RTOS prolog and epilor functions for irq
104 #else
105  #define irq_func_decl __irq //use common irq sheme
106 #endif
107  /* \todo attribute NAKED for KEIL*/
108  #define irq_func irq_func_decl // then using function itself
109 #endif
110 
111 #ifndef irq_func
112  #define irq_func
113 #endif
114 #endif /* _COMPILLER_ARCH_H_ */