Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of nRF51822 by
compiler_abstraction.h
00001 /* Copyright (c) 2013, Nordic Semiconductor ASA 00002 * All rights reserved. 00003 * 00004 * Redistribution and use in source and binary forms, with or without 00005 * modification, are permitted provided that the following conditions are met: 00006 * 00007 * * Redistributions of source code must retain the above copyright notice, this 00008 * list of conditions and the following disclaimer. 00009 * 00010 * * Redistributions in binary form must reproduce the above copyright notice, 00011 * this list of conditions and the following disclaimer in the documentation 00012 * and/or other materials provided with the distribution. 00013 * 00014 * * Neither the name of Nordic Semiconductor ASA nor the names of its 00015 * contributors may be used to endorse or promote products derived from 00016 * this software without specific prior written permission. 00017 * 00018 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00019 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00020 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00021 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00022 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00023 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00024 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00025 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00026 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00027 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00028 * 00029 */ 00030 #ifndef _COMPILER_ABSTRACTION_H 00031 #define _COMPILER_ABSTRACTION_H 00032 00033 /*lint ++flb "Enter library region" */ 00034 00035 #if defined ( __CC_ARM ) 00036 00037 #ifndef __ASM 00038 #define __ASM __asm /*!< asm keyword for ARM Compiler */ 00039 #endif 00040 00041 #ifndef __INLINE 00042 #define __INLINE __inline /*!< inline keyword for ARM Compiler */ 00043 #endif 00044 00045 #ifndef __WEAK 00046 #define __WEAK __weak /*!< weak keyword for ARM Compiler */ 00047 #endif 00048 00049 #define GET_SP() __current_sp() /*!> read current SP function for ARM Compiler */ 00050 00051 #elif defined ( __ICCARM__ ) 00052 00053 #ifndef __ASM 00054 #define __ASM __asm /*!< asm keyword for IAR Compiler */ 00055 #endif 00056 00057 #ifndef __INLINE 00058 #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ 00059 #endif 00060 00061 #ifndef __WEAK 00062 #define __WEAK __weak /*!> define weak function for IAR Compiler */ 00063 #endif 00064 00065 #define GET_SP() __get_SP() /*!> read current SP function for IAR Compiler */ 00066 00067 #elif defined ( __GNUC__ ) 00068 00069 #ifndef __ASM 00070 #define __ASM __asm /*!< asm keyword for GNU Compiler */ 00071 #endif 00072 00073 #ifndef __INLINE 00074 #define __INLINE inline /*!< inline keyword for GNU Compiler */ 00075 #endif 00076 00077 #ifndef __WEAK 00078 #define __WEAK __attribute__((weak)) /*!< weak keyword for GNU Compiler */ 00079 #endif 00080 00081 #define GET_SP() gcc_current_sp() /*!> read current SP function for GNU Compiler */ 00082 00083 static inline unsigned int gcc_current_sp(void) 00084 { 00085 register unsigned sp asm("sp"); 00086 return sp; 00087 } 00088 00089 #elif defined ( __TASKING__ ) 00090 00091 #ifndef __ASM 00092 #define __ASM __asm /*!< asm keyword for TASKING Compiler */ 00093 #endif 00094 00095 #ifndef __INLINE 00096 #define __INLINE inline /*!< inline keyword for TASKING Compiler */ 00097 #endif 00098 00099 #ifndef __WEAK 00100 #define __WEAK __attribute__((weak)) /*!< weak keyword for TASKING Compiler */ 00101 #endif 00102 00103 #define GET_SP() __get_MSP() /*!> read current SP function for TASKING Compiler */ 00104 00105 #endif 00106 00107 /*lint --flb "Leave library region" */ 00108 00109 #endif
Generated on Tue Jul 12 2022 16:21:02 by
