From 8298345c1bde79ef01b679b47222ebc4d3860cea Mon Sep 17 00:00:00 2001 From: Mahadevan Mahesh Date: Thu, 23 Mar 2017 16:35:06 -0500 Subject: [PATCH] Issue 3763: Reduce heap allocation in the GCC linker file Signed-off-by: Mahadevan Mahesh --- .../device/TOOLCHAIN_GCC_ARM/MK66FN2M0xxx18.ld | 12 +++++++++--- .../device/TOOLCHAIN_GCC_ARM/MK82FN256xxx15.ld | 12 +++++++++--- .../device/TOOLCHAIN_GCC_ARM/MKL27Z64xxx4.ld | 8 +++++--- .../device/TOOLCHAIN_GCC_ARM/MKL43Z256xxx4.ld | 10 ++++++++-- .../device/TOOLCHAIN_GCC_ARM/MKL82Z128xxx7.ld | 10 ++++++++-- .../device/TOOLCHAIN_GCC_ARM/MKW24D512xxx5.ld | 10 ++++++++-- .../device/TOOLCHAIN_GCC_ARM/MKW41Z512xxx4.ld | 12 +++++++++--- 7 files changed, 56 insertions(+), 18 deletions(-) diff --git a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K66F/device/TOOLCHAIN_GCC_ARM/MK66FN2M0xxx18.ld b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K66F/device/TOOLCHAIN_GCC_ARM/MK66FN2M0xxx18.ld index 78d2490314..945f6c2da2 100644 --- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K66F/device/TOOLCHAIN_GCC_ARM/MK66FN2M0xxx18.ld +++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K66F/device/TOOLCHAIN_GCC_ARM/MK66FN2M0xxx18.ld @@ -50,9 +50,15 @@ ENTRY(Reset_Handler) __ram_vector_table__ = 1; -/* Heap 1/4 of ram and stack 1/8 */ -__stack_size__ = 0x8000; -__heap_size__ = 0x10000; +/* With the RTOS in use, this does not affect the main stack size. The size of + * the stack where main runs is determined via the RTOS. */ +__stack_size__ = 0x400; + +/* This is the guaranteed minimum available heap size for an application. When + * uVisor is enabled, this is also the maximum available heap size. The + * HEAP_SIZE value is set by uVisor porters to balance the size of the legacy + * heap and the page heap in uVisor applications. */ +__heap_size__ = 0x6000; HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400; STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400; diff --git a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K82F/device/TOOLCHAIN_GCC_ARM/MK82FN256xxx15.ld b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K82F/device/TOOLCHAIN_GCC_ARM/MK82FN256xxx15.ld index 982f9a5528..329f63e36e 100644 --- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K82F/device/TOOLCHAIN_GCC_ARM/MK82FN256xxx15.ld +++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K82F/device/TOOLCHAIN_GCC_ARM/MK82FN256xxx15.ld @@ -52,9 +52,15 @@ ENTRY(Reset_Handler) __ram_vector_table__ = 1; -/* Heap 1/4 of ram and stack 1/8 */ -__stack_size__ = 0x8000; -__heap_size__ = 0x10000; +/* With the RTOS in use, this does not affect the main stack size. The size of + * the stack where main runs is determined via the RTOS. */ +__stack_size__ = 0x400; + +/* This is the guaranteed minimum available heap size for an application. When + * uVisor is enabled, this is also the maximum available heap size. The + * HEAP_SIZE value is set by uVisor porters to balance the size of the legacy + * heap and the page heap in uVisor applications. */ +__heap_size__ = 0x6000; HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400; STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400; diff --git a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL27Z/device/TOOLCHAIN_GCC_ARM/MKL27Z64xxx4.ld b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL27Z/device/TOOLCHAIN_GCC_ARM/MKL27Z64xxx4.ld index 10d3cc4bdc..d07efd1a04 100644 --- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL27Z/device/TOOLCHAIN_GCC_ARM/MKL27Z64xxx4.ld +++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL27Z/device/TOOLCHAIN_GCC_ARM/MKL27Z64xxx4.ld @@ -53,9 +53,11 @@ ENTRY(Reset_Handler) __ram_vector_table__ = 1; -/* Heap 1/4 of ram and stack 1/8 */ -__stack_size__ = 0x800; -__heap_size__ = 0x1000; +/* With the RTOS in use, this does not affect the main stack size. The size of + * the stack where main runs is determined via the RTOS. */ +__stack_size__ = 0x400; +/* With the RTOS in use, this does not affect the main heap size. */ +__heap_size__ = 0x0; HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400; STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400; diff --git a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL43Z/device/TOOLCHAIN_GCC_ARM/MKL43Z256xxx4.ld b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL43Z/device/TOOLCHAIN_GCC_ARM/MKL43Z256xxx4.ld index 08920c6e25..d5390db1b7 100644 --- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL43Z/device/TOOLCHAIN_GCC_ARM/MKL43Z256xxx4.ld +++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL43Z/device/TOOLCHAIN_GCC_ARM/MKL43Z256xxx4.ld @@ -50,8 +50,14 @@ ENTRY(Reset_Handler) __ram_vector_table__ = 1; -/* Heap 1/4 of ram and stack 1/8 */ -__stack_size__ = 0x1000; +/* With the RTOS in use, this does not affect the main stack size. The size of + * the stack where main runs is determined via the RTOS. */ +__stack_size__ = 0x400; + +/* This is the guaranteed minimum available heap size for an application. When + * uVisor is enabled, this is also the maximum available heap size. The + * HEAP_SIZE value is set by uVisor porters to balance the size of the legacy + * heap and the page heap in uVisor applications. */ __heap_size__ = 0x2800; HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400; diff --git a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL82Z/device/TOOLCHAIN_GCC_ARM/MKL82Z128xxx7.ld b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL82Z/device/TOOLCHAIN_GCC_ARM/MKL82Z128xxx7.ld index 53fa9d29a4..7c88f8dc8b 100644 --- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL82Z/device/TOOLCHAIN_GCC_ARM/MKL82Z128xxx7.ld +++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL82Z/device/TOOLCHAIN_GCC_ARM/MKL82Z128xxx7.ld @@ -53,8 +53,14 @@ ENTRY(Reset_Handler) __ram_vector_table__ = 1; -/* Heap 1/4 of ram and stack 1/8 */ -__stack_size__ = 0x3000; +/* With the RTOS in use, this does not affect the main stack size. The size of + * the stack where main runs is determined via the RTOS. */ +__stack_size__ = 0x400; + +/* This is the guaranteed minimum available heap size for an application. When + * uVisor is enabled, this is also the maximum available heap size. The + * HEAP_SIZE value is set by uVisor porters to balance the size of the legacy + * heap and the page heap in uVisor applications. */ __heap_size__ = 0x6000; HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400; diff --git a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KW24D/device/TOOLCHAIN_GCC_ARM/MKW24D512xxx5.ld b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KW24D/device/TOOLCHAIN_GCC_ARM/MKW24D512xxx5.ld index a5a078e418..3ee0095bd3 100644 --- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KW24D/device/TOOLCHAIN_GCC_ARM/MKW24D512xxx5.ld +++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KW24D/device/TOOLCHAIN_GCC_ARM/MKW24D512xxx5.ld @@ -48,8 +48,14 @@ ENTRY(Reset_Handler) __ram_vector_table__ = 1; -/* Heap 1/4 of ram and stack 1/8 */ -__stack_size__ = 0x2000; +/* With the RTOS in use, this does not affect the main stack size. The size of + * the stack where main runs is determined via the RTOS. */ +__stack_size__ = 0x400; + +/* This is the guaranteed minimum available heap size for an application. When + * uVisor is enabled, this is also the maximum available heap size. The + * HEAP_SIZE value is set by uVisor porters to balance the size of the legacy + * heap and the page heap in uVisor applications. */ __heap_size__ = 0x4000; HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400; diff --git a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KW41Z/device/TOOLCHAIN_GCC_ARM/MKW41Z512xxx4.ld b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KW41Z/device/TOOLCHAIN_GCC_ARM/MKW41Z512xxx4.ld index 5d6da3d5ae..69f56747fc 100644 --- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KW41Z/device/TOOLCHAIN_GCC_ARM/MKW41Z512xxx4.ld +++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KW41Z/device/TOOLCHAIN_GCC_ARM/MKW41Z512xxx4.ld @@ -48,9 +48,15 @@ ENTRY(Reset_Handler) __ram_vector_table__ = 1; -/* Heap 1/4 of ram and stack 1/8 */ -__stack_size__ = 0x4000; -__heap_size__ = 0x8000; +/* With the RTOS in use, this does not affect the main stack size. The size of + * the stack where main runs is determined via the RTOS. */ +__stack_size__ = 0x400; + +/* This is the guaranteed minimum available heap size for an application. When + * uVisor is enabled, this is also the maximum available heap size. The + * HEAP_SIZE value is set by uVisor porters to balance the size of the legacy + * heap and the page heap in uVisor applications. */ +__heap_size__ = 0x6000; HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400; STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;