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