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.
TARGET_TB_SENSE_12/TOOLCHAIN_IAR/em_ramfunc.h@171:3a7713b1edbc, 2018-11-08 (annotated)
- Committer:
- AnnaBridge
- Date:
- Thu Nov 08 11:45:42 2018 +0000
- Revision:
- 171:3a7713b1edbc
- Parent:
- TARGET_TB_SENSE_12/TARGET_Silicon_Labs/TARGET_EFM32/emlib/inc/em_ramfunc.h@160:5571c4ff569f
mbed library. Release version 164
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Anna Bridge |
142:4eea097334d6 | 1 | /***************************************************************************//** |
Anna Bridge |
142:4eea097334d6 | 2 | * @file em_ramfunc.h |
Anna Bridge |
142:4eea097334d6 | 3 | * @brief RAM code support. |
Anna Bridge |
160:5571c4ff569f | 4 | * @version 5.3.3 |
Anna Bridge |
142:4eea097334d6 | 5 | ******************************************************************************* |
Anna Bridge |
160:5571c4ff569f | 6 | * # License |
Anna Bridge |
142:4eea097334d6 | 7 | * <b>Copyright 2016 Silicon Laboratories, Inc. http://www.silabs.com</b> |
Anna Bridge |
142:4eea097334d6 | 8 | ******************************************************************************* |
Anna Bridge |
142:4eea097334d6 | 9 | * |
Anna Bridge |
142:4eea097334d6 | 10 | * Permission is granted to anyone to use this software for any purpose, |
Anna Bridge |
142:4eea097334d6 | 11 | * including commercial applications, and to alter it and redistribute it |
Anna Bridge |
142:4eea097334d6 | 12 | * freely, subject to the following restrictions: |
Anna Bridge |
142:4eea097334d6 | 13 | * |
Anna Bridge |
142:4eea097334d6 | 14 | * 1. The origin of this software must not be misrepresented; you must not |
Anna Bridge |
142:4eea097334d6 | 15 | * claim that you wrote the original software. |
Anna Bridge |
142:4eea097334d6 | 16 | * 2. Altered source versions must be plainly marked as such, and must not be |
Anna Bridge |
142:4eea097334d6 | 17 | * misrepresented as being the original software. |
Anna Bridge |
142:4eea097334d6 | 18 | * 3. This notice may not be removed or altered from any source distribution. |
Anna Bridge |
142:4eea097334d6 | 19 | * |
Anna Bridge |
142:4eea097334d6 | 20 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no |
Anna Bridge |
142:4eea097334d6 | 21 | * obligation to support this Software. Silicon Labs is providing the |
Anna Bridge |
142:4eea097334d6 | 22 | * Software "AS IS", with no express or implied warranties of any kind, |
Anna Bridge |
142:4eea097334d6 | 23 | * including, but not limited to, any implied warranties of merchantability |
Anna Bridge |
142:4eea097334d6 | 24 | * or fitness for any particular purpose or warranties against infringement |
Anna Bridge |
142:4eea097334d6 | 25 | * of any proprietary rights of a third party. |
Anna Bridge |
142:4eea097334d6 | 26 | * |
Anna Bridge |
142:4eea097334d6 | 27 | * Silicon Labs will not be liable for any consequential, incidental, or |
Anna Bridge |
142:4eea097334d6 | 28 | * special damages, or any other relief, or for any claim by any third party, |
Anna Bridge |
142:4eea097334d6 | 29 | * arising from your use of this Software. |
Anna Bridge |
142:4eea097334d6 | 30 | * |
Anna Bridge |
142:4eea097334d6 | 31 | ******************************************************************************/ |
Anna Bridge |
142:4eea097334d6 | 32 | |
Anna Bridge |
142:4eea097334d6 | 33 | #ifndef EM_RAMFUNC_H |
Anna Bridge |
142:4eea097334d6 | 34 | #define EM_RAMFUNC_H |
Anna Bridge |
142:4eea097334d6 | 35 | |
Anna Bridge |
142:4eea097334d6 | 36 | #ifdef __cplusplus |
Anna Bridge |
142:4eea097334d6 | 37 | extern "C" { |
Anna Bridge |
142:4eea097334d6 | 38 | #endif |
Anna Bridge |
142:4eea097334d6 | 39 | |
Anna Bridge |
160:5571c4ff569f | 40 | /* *INDENT-OFF* */ |
Anna Bridge |
142:4eea097334d6 | 41 | /***************************************************************************//** |
Anna Bridge |
142:4eea097334d6 | 42 | * @addtogroup emlib |
Anna Bridge |
142:4eea097334d6 | 43 | * @{ |
Anna Bridge |
142:4eea097334d6 | 44 | * @addtogroup RAMFUNC |
Anna Bridge |
142:4eea097334d6 | 45 | * @brief RAM code support. |
Anna Bridge |
142:4eea097334d6 | 46 | * @details |
Anna Bridge |
142:4eea097334d6 | 47 | * This module provides support for executing code from RAM. A unified method |
Anna Bridge |
142:4eea097334d6 | 48 | * to manage RAM code across all supported tools is provided. |
Anna Bridge |
142:4eea097334d6 | 49 | * @{ |
Anna Bridge |
142:4eea097334d6 | 50 | |
Anna Bridge |
142:4eea097334d6 | 51 | @note |
Anna Bridge |
142:4eea097334d6 | 52 | Other cross-compiler support macros are implemented in @ref COMMON. |
Anna Bridge |
142:4eea097334d6 | 53 | |
Anna Bridge |
142:4eea097334d6 | 54 | @note |
Anna Bridge |
142:4eea097334d6 | 55 | Functions executing from RAM should not be declared as static. |
Anna Bridge |
142:4eea097334d6 | 56 | |
Anna Bridge |
142:4eea097334d6 | 57 | @warning |
Anna Bridge |
142:4eea097334d6 | 58 | With GCC in hosted mode (default), standard library facilities are available |
Anna Bridge |
142:4eea097334d6 | 59 | to the tool regardless of the section attribute. Calls to standard libraries |
Anna Bridge |
142:4eea097334d6 | 60 | placed in the default section may therefore occur. To disable hosted mode, |
Anna Bridge |
142:4eea097334d6 | 61 | add '-ffreestanding' to the build command line. This is the only way to |
Anna Bridge |
142:4eea097334d6 | 62 | guarantee no calls to standard libraries with GCC. |
Anna Bridge |
142:4eea097334d6 | 63 | Read more at https://gcc.gnu.org/onlinedocs/gcc-5.3.0/gcc/Standards.html |
Anna Bridge |
142:4eea097334d6 | 64 | |
Anna Bridge |
160:5571c4ff569f | 65 | @warning |
Anna Bridge |
160:5571c4ff569f | 66 | Keil/ARM uVision users must add a section named "ram_code" in their linker |
Anna Bridge |
160:5571c4ff569f | 67 | scatter file. This section must be in RAM memory. Look in the MCU SDK for |
Anna Bridge |
160:5571c4ff569f | 68 | example scatter files (ram_code.sct). |
Anna Bridge |
160:5571c4ff569f | 69 | |
Anna Bridge |
142:4eea097334d6 | 70 | @n @section ramfunc_usage Usage |
Anna Bridge |
142:4eea097334d6 | 71 | |
Anna Bridge |
142:4eea097334d6 | 72 | In your .h file: |
Anna Bridge |
142:4eea097334d6 | 73 | @verbatim |
Anna Bridge |
142:4eea097334d6 | 74 | #include "em_ramfunc.h" |
Anna Bridge |
142:4eea097334d6 | 75 | |
Anna Bridge |
142:4eea097334d6 | 76 | SL_RAMFUNC_DECLARATOR |
Anna Bridge |
142:4eea097334d6 | 77 | void MyPrint(const char* string); |
Anna Bridge |
142:4eea097334d6 | 78 | @endverbatim |
Anna Bridge |
142:4eea097334d6 | 79 | |
Anna Bridge |
142:4eea097334d6 | 80 | Issues have been observed with armgcc when there is no declarator. It is |
Anna Bridge |
142:4eea097334d6 | 81 | recommended to have a declarator also for internal functions, but move the |
Anna Bridge |
142:4eea097334d6 | 82 | declarator to the .c file. |
Anna Bridge |
142:4eea097334d6 | 83 | |
Anna Bridge |
142:4eea097334d6 | 84 | In your .c file: |
Anna Bridge |
142:4eea097334d6 | 85 | @verbatim |
Anna Bridge |
142:4eea097334d6 | 86 | #include "em_ramfunc.h" |
Anna Bridge |
142:4eea097334d6 | 87 | |
Anna Bridge |
142:4eea097334d6 | 88 | SL_RAMFUNC_DEFINITION_BEGIN |
Anna Bridge |
142:4eea097334d6 | 89 | void MyPrint(const char* string) |
Anna Bridge |
142:4eea097334d6 | 90 | { |
Anna Bridge |
142:4eea097334d6 | 91 | ... |
Anna Bridge |
142:4eea097334d6 | 92 | } |
Anna Bridge |
142:4eea097334d6 | 93 | SL_RAMFUNC_DEFINITION_END |
Anna Bridge |
142:4eea097334d6 | 94 | @endverbatim |
Anna Bridge |
142:4eea097334d6 | 95 | |
Anna Bridge |
160:5571c4ff569f | 96 | ******************************************************************************/ |
Anna Bridge |
160:5571c4ff569f | 97 | /* *INDENT-ON* */ |
Anna Bridge |
142:4eea097334d6 | 98 | |
Anna Bridge |
160:5571c4ff569f | 99 | /******************************************************************************* |
Anna Bridge |
142:4eea097334d6 | 100 | ****************************** DEFINES *********************************** |
Anna Bridge |
142:4eea097334d6 | 101 | ******************************************************************************/ |
Anna Bridge |
142:4eea097334d6 | 102 | |
Anna Bridge |
142:4eea097334d6 | 103 | /** |
Anna Bridge |
142:4eea097334d6 | 104 | * @brief |
Anna Bridge |
142:4eea097334d6 | 105 | * This define is not present by default. By compiling with the define |
Anna Bridge |
142:4eea097334d6 | 106 | * @ref SL_RAMFUNC_DISABLE, code placed in RAM by the SL_RAMFUNC macros |
Anna Bridge |
142:4eea097334d6 | 107 | * will be placed in default code space (Flash) instead. |
Anna Bridge |
142:4eea097334d6 | 108 | * |
Anna Bridge |
142:4eea097334d6 | 109 | * @note |
Anna Bridge |
142:4eea097334d6 | 110 | * This define is not present by default. |
Anna Bridge |
142:4eea097334d6 | 111 | */ |
Anna Bridge |
142:4eea097334d6 | 112 | #if defined(DOXY_DOC_ONLY) |
Anna Bridge |
142:4eea097334d6 | 113 | #define SL_RAMFUNC_DISABLE |
Anna Bridge |
142:4eea097334d6 | 114 | #endif |
Anna Bridge |
142:4eea097334d6 | 115 | |
Anna Bridge |
142:4eea097334d6 | 116 | #if defined(SL_RAMFUNC_DISABLE) |
Anna Bridge |
142:4eea097334d6 | 117 | /** @brief Compiler ported function declarator for RAM code. */ |
Anna Bridge |
142:4eea097334d6 | 118 | #define SL_RAMFUNC_DECLARATOR |
Anna Bridge |
142:4eea097334d6 | 119 | |
Anna Bridge |
142:4eea097334d6 | 120 | /** @brief Compiler ported function definition begin marker for RAM code. */ |
Anna Bridge |
142:4eea097334d6 | 121 | #define SL_RAMFUNC_DEFINITION_BEGIN |
Anna Bridge |
142:4eea097334d6 | 122 | |
Anna Bridge |
142:4eea097334d6 | 123 | /** @brief Compiler ported function definition end marker for RAM code. */ |
Anna Bridge |
142:4eea097334d6 | 124 | #define SL_RAMFUNC_DEFINITION_END |
Anna Bridge |
142:4eea097334d6 | 125 | |
Anna Bridge |
142:4eea097334d6 | 126 | #elif defined(__CC_ARM) |
Anna Bridge |
142:4eea097334d6 | 127 | /* MDK-ARM compiler */ |
Anna Bridge |
142:4eea097334d6 | 128 | #define SL_RAMFUNC_DECLARATOR |
Anna Bridge |
142:4eea097334d6 | 129 | #define SL_RAMFUNC_DEFINITION_BEGIN _Pragma("arm section code=\"ram_code\"") |
Anna Bridge |
142:4eea097334d6 | 130 | #define SL_RAMFUNC_DEFINITION_END _Pragma("arm section code") |
Anna Bridge |
142:4eea097334d6 | 131 | |
Anna Bridge |
142:4eea097334d6 | 132 | #elif defined(__ICCARM__) |
Anna Bridge |
142:4eea097334d6 | 133 | /* IAR Embedded Workbench */ |
Anna Bridge |
142:4eea097334d6 | 134 | #define SL_RAMFUNC_DECLARATOR __ramfunc |
Anna Bridge |
142:4eea097334d6 | 135 | #define SL_RAMFUNC_DEFINITION_BEGIN SL_RAMFUNC_DECLARATOR |
Anna Bridge |
142:4eea097334d6 | 136 | #define SL_RAMFUNC_DEFINITION_END |
Anna Bridge |
142:4eea097334d6 | 137 | |
Anna Bridge |
142:4eea097334d6 | 138 | #elif defined(__GNUC__) && defined(__CROSSWORKS_ARM) |
Anna Bridge |
142:4eea097334d6 | 139 | /* Rowley Crossworks */ |
Anna Bridge |
142:4eea097334d6 | 140 | #define SL_RAMFUNC_DECLARATOR __attribute__ ((section(".fast"))) |
Anna Bridge |
142:4eea097334d6 | 141 | #define SL_RAMFUNC_DEFINITION_BEGIN SL_RAMFUNC_DECLARATOR |
Anna Bridge |
142:4eea097334d6 | 142 | #define SL_RAMFUNC_DEFINITION_END |
Anna Bridge |
142:4eea097334d6 | 143 | |
Anna Bridge |
142:4eea097334d6 | 144 | #elif defined(__GNUC__) |
Anna Bridge |
142:4eea097334d6 | 145 | /* Simplicity Studio, Atollic and vanilla armgcc */ |
Anna Bridge |
142:4eea097334d6 | 146 | #define SL_RAMFUNC_DECLARATOR __attribute__ ((section(".ram"))) |
Anna Bridge |
142:4eea097334d6 | 147 | #define SL_RAMFUNC_DEFINITION_BEGIN SL_RAMFUNC_DECLARATOR |
Anna Bridge |
142:4eea097334d6 | 148 | #define SL_RAMFUNC_DEFINITION_END |
Anna Bridge |
142:4eea097334d6 | 149 | |
Anna Bridge |
142:4eea097334d6 | 150 | #endif |
Anna Bridge |
142:4eea097334d6 | 151 | |
Anna Bridge |
142:4eea097334d6 | 152 | /** @cond DO_NOT_INCLUDE_WITH_DOXYGEN */ |
Anna Bridge |
142:4eea097334d6 | 153 | /* Deprecated macro names and user config */ |
Anna Bridge |
142:4eea097334d6 | 154 | #if defined(RAMFUNC_DISABLE) |
Anna Bridge |
142:4eea097334d6 | 155 | #define SL_RAMFUNC_DISABLE |
Anna Bridge |
142:4eea097334d6 | 156 | #endif |
Anna Bridge |
142:4eea097334d6 | 157 | |
Anna Bridge |
142:4eea097334d6 | 158 | #define RAMFUNC_DECLARATOR SL_RAMFUNC_DECLARATOR |
Anna Bridge |
142:4eea097334d6 | 159 | #define RAMFUNC_DEFINITION_BEGIN SL_RAMFUNC_DEFINITION_BEGIN |
Anna Bridge |
142:4eea097334d6 | 160 | #define RAMFUNC_DEFINITION_END SL_RAMFUNC_DEFINITION_END |
Anna Bridge |
142:4eea097334d6 | 161 | /** @endcond */ |
Anna Bridge |
142:4eea097334d6 | 162 | |
Anna Bridge |
142:4eea097334d6 | 163 | /** @} (end addtogroup RAMFUNC) */ |
Anna Bridge |
142:4eea097334d6 | 164 | /** @} (end addtogroup emlib) */ |
Anna Bridge |
142:4eea097334d6 | 165 | |
Anna Bridge |
142:4eea097334d6 | 166 | #ifdef __cplusplus |
Anna Bridge |
142:4eea097334d6 | 167 | } |
Anna Bridge |
142:4eea097334d6 | 168 | #endif |
Anna Bridge |
142:4eea097334d6 | 169 | |
Anna Bridge |
142:4eea097334d6 | 170 | #endif /* EM_RAMFUNC_H */ |