1 /*********************************************************************************************************************** 2 * Copyright [2020-2022] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved. 3 * 4 * This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products 5 * of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are 6 * sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use 7 * of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property 8 * right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas 9 * reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION 10 * IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT 11 * PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES 12 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR 13 * DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM 14 * EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION 15 * (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING, 16 * WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS, 17 * OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY 18 * OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS. 19 **********************************************************************************************************************/ 20 21 /*******************************************************************************************************************//** 22 * @addtogroup BSP_MCU 23 * @{ 24 **********************************************************************************************************************/ 25 26 #ifndef BSP_COMPILER_SUPPORT_H 27 #define BSP_COMPILER_SUPPORT_H 28 29 #if (defined(__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3)) 30 #include "arm_cmse.h" 31 #endif 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 /*********************************************************************************************************************** 38 * Macro definitions 39 **********************************************************************************************************************/ 40 #if defined(__ARMCC_VERSION) /* AC6 compiler */ 41 42 /* The AC6 linker requires uninitialized code to be placed in a section that starts with ".bss." Without this, load 43 * memory (ROM) is reserved unnecessarily. */ 44 #define BSP_UNINIT_SECTION_PREFIX ".bss" 45 #define BSP_SECTION_HEAP BSP_UNINIT_SECTION_PREFIX ".heap" 46 #define BSP_DONT_REMOVE 47 #define BSP_ATTRIBUTE_STACKLESS __attribute__((naked)) 48 #define BSP_FORCE_INLINE __attribute__((always_inline)) 49 #elif defined(__GNUC__) /* GCC compiler */ 50 #define BSP_UNINIT_SECTION_PREFIX 51 #define BSP_SECTION_HEAP ".heap" 52 #define BSP_DONT_REMOVE 53 #define BSP_ATTRIBUTE_STACKLESS __attribute__((naked)) 54 #define BSP_FORCE_INLINE __attribute__((always_inline)) 55 #elif defined(__ICCARM__) /* IAR compiler */ 56 #define BSP_UNINIT_SECTION_PREFIX 57 #define BSP_SECTION_HEAP "HEAP" 58 #define BSP_DONT_REMOVE __root 59 #define BSP_ATTRIBUTE_STACKLESS __stackless 60 #define BSP_FORCE_INLINE _Pragma("inline=forced") 61 #endif 62 63 #define BSP_SECTION_STACK BSP_UNINIT_SECTION_PREFIX ".stack" 64 #define BSP_SECTION_NOINIT BSP_UNINIT_SECTION_PREFIX ".noinit" 65 #define BSP_SECTION_FIXED_VECTORS ".fixed_vectors" 66 #define BSP_SECTION_APPLICATION_VECTORS ".application_vectors" 67 #define BSP_SECTION_ROM_REGISTERS ".rom_registers" 68 #define BSP_SECTION_ID_CODE ".id_code" 69 70 /* Compiler neutral macros. */ 71 #define BSP_PLACE_IN_SECTION(x) __attribute__((section(x))) __attribute__((__used__)) 72 73 #define BSP_ALIGN_VARIABLE(x) __attribute__((aligned(x))) 74 75 #define BSP_PACKED __attribute__((aligned(1))) // DEPRECATED 76 77 #define BSP_WEAK_REFERENCE __attribute__((weak)) 78 79 /** Stacks (and heap) must be sized and aligned to an integer multiple of this number. */ 80 #define BSP_STACK_ALIGNMENT (8) 81 82 /*********************************************************************************************************************** 83 * TrustZone definitions 84 **********************************************************************************************************************/ 85 #if (defined(__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3)) && !defined(__clang_analyzer__) 86 #if defined(__ICCARM__) /* IAR compiler */ 87 #define BSP_CMSE_NONSECURE_CALL __cmse_nonsecure_call 88 #define BSP_CMSE_NONSECURE_ENTRY __cmse_nonsecure_entry 89 #else 90 #define BSP_CMSE_NONSECURE_CALL __attribute__((cmse_nonsecure_call)) 91 #define BSP_CMSE_NONSECURE_ENTRY __attribute__((cmse_nonsecure_entry)) 92 #endif 93 #else 94 #define BSP_CMSE_NONSECURE_CALL 95 #define BSP_CMSE_NONSECURE_ENTRY 96 #endif 97 98 /*********************************************************************************************************************** 99 * Exported global variables 100 **********************************************************************************************************************/ 101 102 /*********************************************************************************************************************** 103 * Exported global functions (to be accessed by other files) 104 **********************************************************************************************************************/ 105 106 /** @} (end of addtogroup BSP_MCU) */ 107 108 #ifdef __cplusplus 109 } 110 #endif 111 112 #endif 113