1 /***************************************************************************//**
2  * @file
3  * @brief Code Classification API
4  *******************************************************************************
5  * # License
6  * <b>Copyright 2023 Silicon Laboratories Inc. www.silabs.com</b>
7  *******************************************************************************
8  *
9  * SPDX-License-Identifier: Zlib
10  *
11  * The licensor of this software is Silicon Laboratories Inc.
12  *
13  * This software is provided 'as-is', without any express or implied
14  * warranty. In no event will the authors be held liable for any damages
15  * arising from the use of this software.
16  *
17  * Permission is granted to anyone to use this software for any purpose,
18  * including commercial applications, and to alter it and redistribute it
19  * freely, subject to the following restrictions:
20  *
21  * 1. The origin of this software must not be misrepresented; you must not
22  *    claim that you wrote the original software. If you use this software
23  *    in a product, an acknowledgment in the product documentation would be
24  *    appreciated but is not required.
25  * 2. Altered source versions must be plainly marked as such, and must not be
26  *    misrepresented as being the original software.
27  * 3. This notice may not be removed or altered from any source distribution.
28  *
29  ******************************************************************************/
30 
31 #ifndef _SL_CODE_CLASSIFICATION_H_
32 #define _SL_CODE_CLASSIFICATION_H_
33 
34 #include "sli_code_classification.h"
35 
36 // NOTE: This API is for use by applications only.
37 
38 /**************************************************************************//**
39  * @addtogroup code_placement
40  * @brief Code Classification API
41  * @{
42  *****************************************************************************/
43 
44 /******************************************************************************/
45 /* Macro API                                                                  */
46 /******************************************************************************/
47 #if defined(__GNUC__) && !defined(__llvm__)
48 
49 // With GCC, __attribute__ can be used to specify the input section of
50 // functions.
51 
52 /// Prepend a function definition with this macro to place it in RAM.
53 #define SL_CODE_RAM \
54   __attribute__((section("text_application_ram")))
55 
56 #elif defined(__ICCARM__)
57 
58 // With IAR, _Pragma can be used to specify the input section of
59 // functions.
60 
61 /// Prepend a function definition with this macro to place it in RAM.
62 #define SL_CODE_RAM \
63   _Pragma("location =\"text_application_ram\"")
64 
65 #elif defined(__llvm__)
66 
67 #define SL_CODE_RAM
68 
69 #else
70   #error "(sl_code_classification.h): Code classification does not support \
71   the chosen compiler."
72 #endif // __GNUC__
73 
74 /** @} (end addtogroup code_placement) */
75 #endif // _SL_CODE_CLASSIFICATION_H_
76