From 96a8ed14b74cca33a8caf567d0f0a2d3b2483a3b Mon Sep 17 00:00:00 2001 From: Jiafei Pan Date: Thu, 24 Feb 2022 10:47:33 +0800 Subject: feat(bl2): add support to separate no-loadable sections Add new options SEPARATE_BL2_NOLOAD_REGION to separate no-loadable sections (.bss, stack, page tables) to a ram region specified by BL2_NOLOAD_START and BL2_NOLOAD_LIMIT. Signed-off-by: Jiafei Pan Change-Id: I844ee0fc405474af0aff978d292c826fbe0a82fd --- bl2/bl2_el3.ld.S | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'bl2') diff --git a/bl2/bl2_el3.ld.S b/bl2/bl2_el3.ld.S index bc1794c06..6aa7afd61 100644 --- a/bl2/bl2_el3.ld.S +++ b/bl2/bl2_el3.ld.S @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2022, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -17,6 +17,11 @@ MEMORY { RAM (rwx): ORIGIN = BL2_RW_BASE, LENGTH = BL2_RW_LIMIT - BL2_RW_BASE #else RAM (rwx): ORIGIN = BL2_BASE, LENGTH = BL2_LIMIT - BL2_BASE +#if SEPARATE_BL2_NOLOAD_REGION + RAM_NOLOAD (rw!a): ORIGIN = BL2_NOLOAD_START, LENGTH = BL2_NOLOAD_LIMIT - BL2_NOLOAD_START +#else +#define RAM_NOLOAD RAM +#endif #endif } @@ -106,9 +111,18 @@ SECTIONS __DATA_RAM_END__ = __DATA_END__; RELA_SECTION >RAM - STACK_SECTION >RAM - BSS_SECTION >RAM - XLAT_TABLE_SECTION >RAM +#if SEPARATE_BL2_NOLOAD_REGION + SAVED_ADDR = .; + . = BL2_NOLOAD_START; + __BL2_NOLOAD_START__ = .; +#endif + STACK_SECTION >RAM_NOLOAD + BSS_SECTION >RAM_NOLOAD + XLAT_TABLE_SECTION >RAM_NOLOAD +#if SEPARATE_BL2_NOLOAD_REGION + __BL2_NOLOAD_END__ = .; + . = SAVED_ADDR; +#endif #if USE_COHERENT_MEM /* -- cgit v1.2.3