1 /* 2 * Copyright (c) 2022 Cypress Semiconductor Corporation (an Infineon company) 3 * or an affiliate of Cypress Semiconductor Corporation. All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 * 7 */ 8 9 /* This file defines default alignments for TFM secure linker script sections. 10 * If needed, platform may define some/all of them in its' region_defs.h 11 * file.*/ 12 13 #ifndef __TFM_S_LINKER_ALIGNMENTS__ 14 #define __TFM_S_LINKER_ALIGNMENTS__ 15 16 /* Helper macro that can be used to round up to multiple to satisfy required 17 * alignment. */ 18 #define ROUND_UP_TO_MULTIPLE(number, multiple) \ 19 ((((number) + (multiple) - 1) / (multiple)) * (multiple)) 20 21 /* Default alignment for linker file sections is set to 32 because ARM TrustZone 22 * protection units (SAU and MPU) require regions to be 32 bytes aligned. */ 23 #ifndef TFM_LINKER_DEFAULT_ALIGNMENT 24 #define TFM_LINKER_DEFAULT_ALIGNMENT 32 25 #endif 26 27 #ifndef TFM_LINKER_VENEERS_ALIGNMENT 28 #define TFM_LINKER_VENEERS_ALIGNMENT TFM_LINKER_DEFAULT_ALIGNMENT 29 #endif 30 31 #ifndef TFM_LINKER_PSA_ROT_LINKER_CODE_ALIGNMENT 32 #define TFM_LINKER_PSA_ROT_LINKER_CODE_ALIGNMENT TFM_LINKER_DEFAULT_ALIGNMENT 33 #endif 34 35 #ifndef TFM_LINKER_APP_ROT_LINKER_CODE_ALIGNMENT 36 #define TFM_LINKER_APP_ROT_LINKER_CODE_ALIGNMENT TFM_LINKER_DEFAULT_ALIGNMENT 37 #endif 38 39 #ifndef TFM_LINKER_SHARED_SYMBOLS_ALIGNMENT 40 #define TFM_LINKER_SHARED_SYMBOLS_ALIGNMENT TFM_LINKER_DEFAULT_ALIGNMENT 41 #endif 42 43 #ifndef TFM_LINKER_BL2_SHARED_DATA_ALIGNMENT 44 #define TFM_LINKER_BL2_SHARED_DATA_ALIGNMENT TFM_LINKER_DEFAULT_ALIGNMENT 45 #endif 46 47 #ifndef TFM_LINKER_MSP_STACK_ALIGNMENT 48 #define TFM_LINKER_MSP_STACK_ALIGNMENT TFM_LINKER_DEFAULT_ALIGNMENT 49 #endif 50 51 #ifndef TFM_LINKER_SP_META_PTR_ALIGNMENT 52 #define TFM_LINKER_SP_META_PTR_ALIGNMENT TFM_LINKER_DEFAULT_ALIGNMENT 53 #endif 54 55 #ifndef TFM_LINKER_APP_ROT_LINKER_DATA_ALIGNMENT 56 #define TFM_LINKER_APP_ROT_LINKER_DATA_ALIGNMENT TFM_LINKER_DEFAULT_ALIGNMENT 57 #endif 58 59 #ifndef TFM_LINKER_PSA_ROT_LINKER_DATA_ALIGNMENT 60 #define TFM_LINKER_PSA_ROT_LINKER_DATA_ALIGNMENT TFM_LINKER_DEFAULT_ALIGNMENT 61 #endif 62 63 #ifndef TFM_LINKER_UNPRIV_CODE_ALIGNMENT 64 #define TFM_LINKER_UNPRIV_CODE_ALIGNMENT TFM_LINKER_DEFAULT_ALIGNMENT 65 #endif 66 67 #ifndef TFM_LINKER_PT_RO_ALIGNMENT 68 #define TFM_LINKER_PT_RO_ALIGNMENT TFM_LINKER_DEFAULT_ALIGNMENT 69 #endif 70 71 #ifndef TFM_LINKER_PT_PRIV_RWZI_ALIGNMENT 72 #define TFM_LINKER_PT_PRIV_RWZI_ALIGNMENT TFM_LINKER_DEFAULT_ALIGNMENT 73 #endif 74 75 #ifndef TFM_LINKER_SECURE_DATA_ALIGNMENT 76 #define TFM_LINKER_SECURE_DATA_ALIGNMENT TFM_LINKER_DEFAULT_ALIGNMENT 77 #endif 78 79 /* Alignment of stack of NS agent TZ partition. This should not be needed once 80 * TZ NS agent partition is reworked to use manifest files. */ 81 #ifndef TFM_LINKER_NS_AGENT_TZ_STACK_ALIGNMENT 82 #define TFM_LINKER_NS_AGENT_TZ_STACK_ALIGNMENT TFM_LINKER_DEFAULT_ALIGNMENT 83 #endif 84 85 /* Alignment of stack of Idle partition. This should not be needed once Idle 86 * partition is reworked to use manifest files. */ 87 #ifndef TFM_LINKER_IDLE_PARTITION_STACK_ALIGNMENT 88 #define TFM_LINKER_IDLE_PARTITION_STACK_ALIGNMENT TFM_LINKER_DEFAULT_ALIGNMENT 89 #endif 90 91 /* Alignment of RAM vector table */ 92 #ifndef TFM_LINKER_RAM_VECTORS_ALIGNMENT 93 #define TFM_LINKER_RAM_VECTORS_ALIGNMENT 256 94 #endif 95 96 #endif /* __TFM_S_LINKER_ALIGNMENTS__ */ 97