From 4780dd55e5fc6eb20186346c7232dc030c687be7 Mon Sep 17 00:00:00 2001 From: Hugues Kamba Date: Fri, 8 Jan 2021 18:32:46 +0000 Subject: [PATCH] NRF52840: Fix heap size formula in scatter files The heap size was incorrectly calculated. This fixes it by subtracting the Stack size, any memory chunks allocated before the start of the application (for vectors and/or crash report), and finally the size of the application from the total RAM size. --- .../TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52840.sct | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52840.sct b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52840.sct index 0d7920daa3..db0e96cdd4 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52840.sct +++ b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52840.sct @@ -50,7 +50,7 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE { RW_IRAM1 MBED_RAM1_START MBED_RAM1_SIZE { .ANY (+RW +ZI) } - ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY (MBED_RAM_SIZE - RAM_FIXED_SIZE + MBED_RAM_START - AlignExpr(ImageLimit(RW_IRAM1), 16)) { + ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY (MBED_RAM_SIZE - RAM_FIXED_SIZE + MBED_RAM1_START - AlignExpr(ImageLimit(RW_IRAM1), 16)) { } ARM_LIB_STACK MBED_RAM1_START + MBED_RAM1_SIZE EMPTY - Stack_Size { ; Stack region growing down }