From 1e464fba4d108059b02019a0fbd21f9ff840ed2f Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Mon, 21 Aug 2023 09:08:55 +0200 Subject: [PATCH] Expanded RAM space for App 64->128 KB --- hal/stm32_tz.c | 15 +++++++++++---- test-app/ARM-stm32l5-ns.ld | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/hal/stm32_tz.c b/hal/stm32_tz.c index 0288067bd..a039b4e4c 100644 --- a/hal/stm32_tz.c +++ b/hal/stm32_tz.c @@ -119,18 +119,25 @@ void hal_tz_release_nonsecure_area(void) void hal_gtzc_init(void) { int i; - /* Configure lower half of total RAM as secure */ + /* Configure lower half of total RAM as secure + * 0x3000 0000 : 0x3001 FFFF - 128KB + */ for (i = 0; i < 16; i++) { SET_GTZC_MPCBBx_S_VCTR(1, i, 0xFFFFFFFF); } - /* Configure rest of SRAM1 as non-secure */ + + /* Configure high portion of SRAM1 as non-secure + * 0x2002 0000 : 0x2002 FFFF - 64 KB + */ for (i = 16; i < 24; i++) { SET_GTZC_MPCBBx_S_VCTR(1, i, 0x0); } - /* Configure SRAM2 as secure */ + /* Configure SRAM2 as non-secure + * 0x2003 0000 : 0x2003 FFFF - 64 KB + */ for (i = 0; i < 8; i++) { - SET_GTZC_MPCBBx_S_VCTR(2, i, 0xFFFFFFFF); + SET_GTZC_MPCBBx_S_VCTR(2, i, 0x0); } } diff --git a/test-app/ARM-stm32l5-ns.ld b/test-app/ARM-stm32l5-ns.ld index db2548f4d..ab154492c 100644 --- a/test-app/ARM-stm32l5-ns.ld +++ b/test-app/ARM-stm32l5-ns.ld @@ -1,7 +1,7 @@ MEMORY { FLASH (rx) : ORIGIN = @WOLFBOOT_TEST_APP_ADDRESS@, LENGTH = @WOLFBOOT_TEST_APP_SIZE@ - RAM (rwx) : ORIGIN = 0x20020000, LENGTH = 0x10000 + RAM (rwx) : ORIGIN = 0x20020000, LENGTH = 0x20000 } SECTIONS