1 /*********************************************************************************************************************** 2 * Copyright [2015-2017] Renesas Electronics Corporation and/or its licensors. All Rights Reserved. 3 * 4 * This file is part of Renesas SynergyTM Software Package (SSP) 5 * 6 * The contents of this file (the "contents") are proprietary and confidential to Renesas Electronics Corporation 7 * and/or its licensors ("Renesas") and subject to statutory and contractual protections. 8 * 9 * This file is subject to a Renesas SSP license agreement. Unless otherwise agreed in an SSP license agreement with 10 * Renesas: 1) you may not use, copy, modify, distribute, display, or perform the contents; 2) you may not use any name 11 * or mark of Renesas for advertising or publicity purposes or in connection with your use of the contents; 3) RENESAS 12 * MAKES NO WARRANTY OR REPRESENTATIONS ABOUT THE SUITABILITY OF THE CONTENTS FOR ANY PURPOSE; THE CONTENTS ARE PROVIDED 13 * "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 14 * PARTICULAR PURPOSE, AND NON-INFRINGEMENT; AND 4) RENESAS SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, OR 15 * CONSEQUENTIAL DAMAGES, INCLUDING DAMAGES RESULTING FROM LOSS OF USE, DATA, OR PROJECTS, WHETHER IN AN ACTION OF 16 * CONTRACT OR TORT, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE CONTENTS. Third-party contents 17 * included in this file may be subject to different terms. 18 **********************************************************************************************************************/ 19 /*********************************************************************************************************************** 20 * File Name : bsp_compiler_support.h 21 * Description : Contains macros to help support multiple compilers 22 ***********************************************************************************************************************/ 23 24 /*******************************************************************************************************************//** 25 * @ingroup BSP_MCU_COMMON 26 * @defgroup BSP_COMPILER_SUPPORT Compiler Support 27 * 28 * The macros in this file are defined based upon which compiler is being used. The macros abstract common section 29 * names and gives a common way to place code in a particular section. Some macros have a version that ends in V2. 30 * These were created to unify the usage between compilers while retaining backwards compatibility in the existing 31 * macros and should be preferred in new code. 32 * 33 * Description of macros: 34 * - BSP_SECTION_STACK - Name of section where stack(s) are stored 35 * - BSP_SECTION_HEAP - Name of section where heap(s) are stored 36 * - BSP_SECTION_VECTOR - Name of section where vector table is stored 37 * - BSP_SECTION_ROM_REGISTERS - Name of section where ROM registers are located 38 * - BSP_PLACE_IN_SECTION - Macro for placing code in a particular section 39 * - BSP_ALIGN_VARIABLE - Macro for specifiying a minimum alignment in bytes 40 * - BSP_PACKED - Macro for setting a 1 byte alignment to remove padding 41 * - BSP_DONT_REMOVE - Keyword to tell linker/compiler to not optimize out a variable or function 42 * 43 * @note Currently supported compilers are GCC and IAR 44 * 45 * @{ 46 **********************************************************************************************************************/ 47 48 #ifndef BSP_COMPILER_SUPPORT_H_ 49 #define BSP_COMPILER_SUPPORT_H_ 50 51 /*********************************************************************************************************************** 52 Macro definitions 53 ***********************************************************************************************************************/ 54 #if defined(__GNUC__) /* GCC Compiler */ 55 #define BSP_SECTION_STACK ".stack" 56 #define BSP_SECTION_HEAP ".heap" 57 #define BSP_SECTION_VECTOR ".vectors" 58 #define BSP_SECTION_ROM_REGISTERS ".rom_registers" 59 #define BSP_SECTION_ID_CODE_1 ".id_code_1" 60 #define BSP_SECTION_ID_CODE_2 ".id_code_2" 61 #define BSP_SECTION_ID_CODE_3 ".id_code_3" 62 #define BSP_SECTION_ID_CODE_4 ".id_code_4" 63 /*LDRA_INSPECTED 293 s SSP requires section support and there is no better option than to use an attribute in GCC. */ 64 /*LDRA_INSPECTED 77 S This macro does not work when surrounded by parentheses. */ 65 #define BSP_PLACE_IN_SECTION(x) __attribute__ ((section(x))) __attribute__ ((__used__)) 66 #define BSP_DONT_REMOVE 67 /*LDRA_INSPECTED 293 s SSP requires alignment support and there is no better option than to use an attribute in GCC. */ 68 /*LDRA_INSPECTED 77 S This macro does not work when surrounded by parentheses. */ 69 #define BSP_ALIGN_VARIABLE(x) __attribute__ ((aligned (x))) 70 /*LDRA_INSPECTED 77 S This macro does not work when surrounded by parentheses. */ 71 #define BSP_PACKED __attribute__ ((aligned(1))) 72 #elif defined(__ICCARM__) /* IAR Compiler */ 73 #define BSP_SECTION_STACK ".stack" 74 #define BSP_SECTION_HEAP "HEAP" 75 #define BSP_SECTION_VECTOR ".vectors" 76 #define BSP_SECTION_ROM_REGISTERS ".rom_registers" 77 #define BSP_SECTION_ID_CODE_1 ".id_code_1" 78 #define BSP_SECTION_ID_CODE_2 ".id_code_2" 79 #define BSP_SECTION_ID_CODE_3 ".id_code_3" 80 #define BSP_SECTION_ID_CODE_4 ".id_code_4" 81 #define BSP_PLACE_IN_SECTION(x) @ x 82 #define BSP_DONT_REMOVE __root 83 #define BSP_ALIGN_VARIABLE(x) 84 #define BSP_PACKED 85 #endif 86 87 /* Compiler neutral macros. Older versions kept for backwards compatibility. */ 88 /*LDRA_INSPECTED 293 s SSP requires section support and there is no better option than to use an attribute in GCC. */ 89 /*LDRA_INSPECTED 77 S This macro does not work when surrounded by parentheses. */ 90 #define BSP_PLACE_IN_SECTION_V2(x) __attribute__ ((section(x))) __attribute__ ((__used__)) 91 /*LDRA_INSPECTED 293 s SSP requires section support and there is no better option than to use an attribute in GCC. */ 92 /*LDRA_INSPECTED 77 S This macro does not work when surrounded by parentheses. */ 93 #define BSP_ALIGN_VARIABLE_V2(x) __attribute__ ((aligned (x))) 94 /*LDRA_INSPECTED 293 s SSP requires section support and there is no better option than to use an attribute in GCC. */ 95 /*LDRA_INSPECTED 77 S This macro does not work when surrounded by parentheses. */ 96 #define BSP_PACKED_V2 __attribute__ ((aligned(1))) 97 98 /*********************************************************************************************************************** 99 Typedef definitions 100 ***********************************************************************************************************************/ 101 102 /*********************************************************************************************************************** 103 Exported global variables 104 ***********************************************************************************************************************/ 105 106 /*********************************************************************************************************************** 107 Exported global functions (to be accessed by other files) 108 ***********************************************************************************************************************/ 109 110 #endif /* BSP_COMPILER_SUPPORT_H_ */ 111 112 /** @} (end of defgroup BSP_COMPILER_SUPPORT) */ 113