1 /* 2 * Arm SCP/MCP Software 3 * Copyright (c) 2015-2022, Arm Limited and Contributors. All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 * 7 * Description: 8 * Common linker script configuration options. 9 * 10 * There are three supported memory layouts for the ARM-M architectures: 11 * 12 * Layout 1 - Single region: 13 * This layout uses a single read/write/execute memory region for all data. 14 * This is traditionally used by firmware running from a general-purpose 15 * RAM region. In this configuration MEM0 represents the RAM region, and 16 * MEM1 is unused. 17 * 18 * Layout 2 - Dual region with relocation: 19 * This layout uses a read/execute memory region for read-only and 20 * executable data, and a write memory region for writable data. This is 21 * traditionally used by firmware running from a ROM region. In this 22 * configuration MEM0 represents the ROM region and MEM1 represents the RAM 23 * region. 24 * 25 * Layout 3 - Dual region without relocation: 26 * This layout uses an execute memory region for executable data, and a 27 * read/write memory region for writable data. This is traditionally used 28 * by firmware running from a RAM region attached to the instruction bus. 29 * In this configuration MEM0 represents the RAM region attached to the 30 * instruction bus and MEM1 represents the RAM region attached to the data 31 * bus. 32 */ 33 34 #ifndef ARCH_SCATTER_H 35 #define ARCH_SCATTER_H 36 37 #define ARCH_MEM_MODE_SINGLE_REGION 0 38 #define ARCH_MEM_MODE_DUAL_REGION_RELOCATION 1 39 #define ARCH_MEM_MODE_DUAL_REGION_NO_RELOCATION 2 40 41 #include <fmw_memory.h> 42 43 #ifndef FMW_MEM_MODE 44 # error "FMW_MEM_MODE has not been configured" 45 #endif 46 47 #if (FMW_MEM_MODE != ARCH_MEM_MODE_SINGLE_REGION) && \ 48 (FMW_MEM_MODE != ARCH_MEM_MODE_DUAL_REGION_RELOCATION) && \ 49 (FMW_MEM_MODE != ARCH_MEM_MODE_DUAL_REGION_NO_RELOCATION) 50 # error "FMW_MEM_MODE has been configured improperly" 51 #endif 52 53 #ifndef FMW_MEM0_BASE 54 # error "FMW_MEM0_BASE has not been configured" 55 #endif 56 57 #ifndef FMW_MEM0_SIZE 58 # error "FMW_MEM0_SIZE has not been configured" 59 #endif 60 61 #define ARCH_MEM0_LIMIT (FMW_MEM0_BASE + FMW_MEM0_SIZE) 62 63 #if FMW_MEM_MODE != ARCH_MEM_MODE_SINGLE_REGION 64 # ifndef FMW_MEM1_BASE 65 # error "FMW_MEM1_BASE has not been configured" 66 # endif 67 68 # ifndef FMW_MEM1_SIZE 69 # error "FMW_MEM1_SIZE has not been configured" 70 # endif 71 72 # define ARCH_MEM1_LIMIT (FMW_MEM1_BASE + FMW_MEM1_SIZE) 73 #endif 74 75 #endif /* ARCH_SCATTER_H */ 76