The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Thu Nov 08 11:45:42 2018 +0000
Revision:
171:3a7713b1edbc
Parent:
TARGET_TY51822R3/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_11/device/compiler_abstraction.h@169:a7c7b631e539
mbed library. Release version 164

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 143:86740a56073b 1 /*
AnnaBridge 143:86740a56073b 2 * Copyright (c) 2015 Nordic Semiconductor ASA
AnnaBridge 143:86740a56073b 3 * All rights reserved.
AnnaBridge 143:86740a56073b 4 *
AnnaBridge 143:86740a56073b 5 * Redistribution and use in source and binary forms, with or without modification,
AnnaBridge 143:86740a56073b 6 * are permitted provided that the following conditions are met:
AnnaBridge 143:86740a56073b 7 *
AnnaBridge 143:86740a56073b 8 * 1. Redistributions of source code must retain the above copyright notice, this list
AnnaBridge 143:86740a56073b 9 * of conditions and the following disclaimer.
AnnaBridge 143:86740a56073b 10 *
AnnaBridge 143:86740a56073b 11 * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA
AnnaBridge 143:86740a56073b 12 * integrated circuit in a product or a software update for such product, must reproduce
AnnaBridge 143:86740a56073b 13 * the above copyright notice, this list of conditions and the following disclaimer in
AnnaBridge 143:86740a56073b 14 * the documentation and/or other materials provided with the distribution.
AnnaBridge 143:86740a56073b 15 *
AnnaBridge 143:86740a56073b 16 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be
AnnaBridge 143:86740a56073b 17 * used to endorse or promote products derived from this software without specific prior
AnnaBridge 143:86740a56073b 18 * written permission.
AnnaBridge 143:86740a56073b 19 *
AnnaBridge 143:86740a56073b 20 * 4. This software, with or without modification, must only be used with a
AnnaBridge 143:86740a56073b 21 * Nordic Semiconductor ASA integrated circuit.
AnnaBridge 143:86740a56073b 22 *
AnnaBridge 143:86740a56073b 23 * 5. Any software provided in binary or object form under this license must not be reverse
AnnaBridge 143:86740a56073b 24 * engineered, decompiled, modified and/or disassembled.
AnnaBridge 143:86740a56073b 25 *
AnnaBridge 143:86740a56073b 26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
AnnaBridge 143:86740a56073b 27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
AnnaBridge 143:86740a56073b 28 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
AnnaBridge 143:86740a56073b 29 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
AnnaBridge 143:86740a56073b 30 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
AnnaBridge 143:86740a56073b 31 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
AnnaBridge 143:86740a56073b 32 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
AnnaBridge 143:86740a56073b 33 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
AnnaBridge 143:86740a56073b 34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
AnnaBridge 143:86740a56073b 35 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AnnaBridge 143:86740a56073b 36 *
AnnaBridge 143:86740a56073b 37 */
AnnaBridge 143:86740a56073b 38
AnnaBridge 143:86740a56073b 39 #ifndef _COMPILER_ABSTRACTION_H
AnnaBridge 143:86740a56073b 40 #define _COMPILER_ABSTRACTION_H
AnnaBridge 143:86740a56073b 41
AnnaBridge 143:86740a56073b 42 /*lint ++flb "Enter library region" */
AnnaBridge 143:86740a56073b 43
AnnaBridge 143:86740a56073b 44 #if defined ( __CC_ARM )
AnnaBridge 143:86740a56073b 45
AnnaBridge 143:86740a56073b 46 #ifndef __ASM
AnnaBridge 143:86740a56073b 47 #define __ASM __asm
AnnaBridge 143:86740a56073b 48 #endif
AnnaBridge 143:86740a56073b 49
AnnaBridge 143:86740a56073b 50 #ifndef __INLINE
AnnaBridge 143:86740a56073b 51 #define __INLINE __inline
AnnaBridge 143:86740a56073b 52 #endif
AnnaBridge 143:86740a56073b 53
AnnaBridge 143:86740a56073b 54 #ifndef __WEAK
AnnaBridge 143:86740a56073b 55 #define __WEAK __weak
AnnaBridge 143:86740a56073b 56 #endif
AnnaBridge 143:86740a56073b 57
AnnaBridge 143:86740a56073b 58 #ifndef __ALIGN
AnnaBridge 143:86740a56073b 59 #define __ALIGN(n) __align(n)
AnnaBridge 143:86740a56073b 60 #endif
AnnaBridge 143:86740a56073b 61
AnnaBridge 143:86740a56073b 62 #define GET_SP() __current_sp()
AnnaBridge 143:86740a56073b 63
AnnaBridge 143:86740a56073b 64 #elif defined ( __ICCARM__ )
AnnaBridge 143:86740a56073b 65
AnnaBridge 143:86740a56073b 66 #ifndef __ASM
AnnaBridge 143:86740a56073b 67 #define __ASM __asm
AnnaBridge 143:86740a56073b 68 #endif
AnnaBridge 143:86740a56073b 69
AnnaBridge 143:86740a56073b 70 #ifndef __INLINE
AnnaBridge 143:86740a56073b 71 #define __INLINE inline
AnnaBridge 143:86740a56073b 72 #endif
AnnaBridge 143:86740a56073b 73
AnnaBridge 143:86740a56073b 74 #ifndef __WEAK
AnnaBridge 143:86740a56073b 75 #define __WEAK __weak
AnnaBridge 143:86740a56073b 76 #endif
AnnaBridge 143:86740a56073b 77
AnnaBridge 143:86740a56073b 78 /* Not defined for IAR since it requires a new line to work, and C preprocessor does not allow that. */
AnnaBridge 143:86740a56073b 79 #ifndef __ALIGN
AnnaBridge 143:86740a56073b 80 #define __ALIGN(n)
AnnaBridge 143:86740a56073b 81 #endif
AnnaBridge 143:86740a56073b 82
AnnaBridge 143:86740a56073b 83 #define GET_SP() __get_SP()
AnnaBridge 143:86740a56073b 84
AnnaBridge 143:86740a56073b 85 #elif defined ( __GNUC__ )
AnnaBridge 143:86740a56073b 86
AnnaBridge 143:86740a56073b 87 #ifndef __ASM
AnnaBridge 143:86740a56073b 88 #define __ASM __asm
AnnaBridge 143:86740a56073b 89 #endif
AnnaBridge 143:86740a56073b 90
AnnaBridge 143:86740a56073b 91 #ifndef __INLINE
AnnaBridge 143:86740a56073b 92 #define __INLINE inline
AnnaBridge 143:86740a56073b 93 #endif
AnnaBridge 143:86740a56073b 94
AnnaBridge 143:86740a56073b 95 #ifndef __WEAK
AnnaBridge 143:86740a56073b 96 #define __WEAK __attribute__((weak))
AnnaBridge 143:86740a56073b 97 #endif
AnnaBridge 143:86740a56073b 98
AnnaBridge 143:86740a56073b 99 #ifndef __ALIGN
AnnaBridge 143:86740a56073b 100 #define __ALIGN(n) __attribute__((aligned(n)))
AnnaBridge 143:86740a56073b 101 #endif
AnnaBridge 143:86740a56073b 102
AnnaBridge 143:86740a56073b 103 #define GET_SP() gcc_current_sp()
AnnaBridge 143:86740a56073b 104
AnnaBridge 143:86740a56073b 105 static inline unsigned int gcc_current_sp(void)
AnnaBridge 143:86740a56073b 106 {
AnnaBridge 143:86740a56073b 107 register unsigned sp __ASM("sp");
AnnaBridge 143:86740a56073b 108 return sp;
AnnaBridge 143:86740a56073b 109 }
AnnaBridge 143:86740a56073b 110
AnnaBridge 143:86740a56073b 111 #elif defined ( __TASKING__ )
AnnaBridge 143:86740a56073b 112
AnnaBridge 143:86740a56073b 113 #ifndef __ASM
AnnaBridge 143:86740a56073b 114 #define __ASM __asm
AnnaBridge 143:86740a56073b 115 #endif
AnnaBridge 143:86740a56073b 116
AnnaBridge 143:86740a56073b 117 #ifndef __INLINE
AnnaBridge 143:86740a56073b 118 #define __INLINE inline
AnnaBridge 143:86740a56073b 119 #endif
AnnaBridge 143:86740a56073b 120
AnnaBridge 143:86740a56073b 121 #ifndef __WEAK
AnnaBridge 143:86740a56073b 122 #define __WEAK __attribute__((weak))
AnnaBridge 143:86740a56073b 123 #endif
AnnaBridge 143:86740a56073b 124
AnnaBridge 143:86740a56073b 125 #ifndef __ALIGN
AnnaBridge 143:86740a56073b 126 #define __ALIGN(n) __align(n)
AnnaBridge 143:86740a56073b 127 #endif
AnnaBridge 143:86740a56073b 128
AnnaBridge 143:86740a56073b 129 #define GET_SP() __get_MSP()
AnnaBridge 143:86740a56073b 130
AnnaBridge 143:86740a56073b 131 #endif
AnnaBridge 143:86740a56073b 132
AnnaBridge 143:86740a56073b 133 /*lint --flb "Leave library region" */
AnnaBridge 143:86740a56073b 134
AnnaBridge 143:86740a56073b 135 #endif