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