diff --git a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_ARM_STD/MK64FN1M0xxx12.sct b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_ARM_STD/MK64FN1M0xxx12.sct index f15107b13f..9c6020c8a1 100644 --- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_ARM_STD/MK64FN1M0xxx12.sct +++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_ARM_STD/MK64FN1M0xxx12.sct @@ -64,6 +64,10 @@ #define MBED_APP_SIZE 0x100000 #endif +#if !defined(MBED_BOOT_STACK_SIZE) + #define MBED_BOOT_STACK_SIZE 0x400 +#endif + #define m_interrupts_start MBED_APP_START #define m_interrupts_size 0x00000400 @@ -86,7 +90,7 @@ #if (defined(__stack_size__)) #define Stack_Size __stack_size__ #else - #define Stack_Size 0x0400 + #define Stack_Size MBED_BOOT_STACK_SIZE #endif #if (defined(__heap_size__)) @@ -122,4 +126,6 @@ LR_IROM1 m_interrupts_start m_text_start+m_text_size-m_interrupts_start { ; lo } RW_IRAM1 ImageLimit(RW_m_data_2) { ; Heap region growing up } + ARM_LIB_STACK m_data_2_start+m_data_2_size EMPTY -Stack_Size { ; Stack region growing down + } } diff --git a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_GCC_ARM/MK64FN1M0xxx12.ld b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_GCC_ARM/MK64FN1M0xxx12.ld index 50136de643..0adf348da0 100644 --- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_GCC_ARM/MK64FN1M0xxx12.ld +++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_GCC_ARM/MK64FN1M0xxx12.ld @@ -53,12 +53,6 @@ ENTRY(Reset_Handler) __ram_vector_table__ = 1; -/* 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; - -__heap_size__ = 0x6000; - #if !defined(MBED_APP_START) #define MBED_APP_START 0 #endif @@ -67,6 +61,16 @@ __heap_size__ = 0x6000; #define MBED_APP_SIZE 0x100000 #endif +#if !defined(MBED_BOOT_STACK_SIZE) + #define MBED_BOOT_STACK_SIZE 0x400 +#endif + +/* 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__ = MBED_BOOT_STACK_SIZE; + +__heap_size__ = 0x6000; + HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400; STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400; M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0; @@ -259,7 +263,7 @@ SECTIONS __end__ = .; PROVIDE(end = .); __HeapBase = .; - . += HEAP_SIZE; + . = ORIGIN(m_data_2) + LENGTH(m_data_2) - STACK_SIZE; __HeapLimit = .; __heap_limit = .; /* Add for _sbrk */ } > m_data_2 diff --git a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_IAR/MK64FN1M0xxx12.icf b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_IAR/MK64FN1M0xxx12.icf index 3f32a84320..a56e50070f 100644 --- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_IAR/MK64FN1M0xxx12.icf +++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_IAR/MK64FN1M0xxx12.icf @@ -49,10 +49,6 @@ */ define symbol __ram_vector_table__ = 1; -/* Heap 1/4 of ram and stack 1/8 */ -define symbol __stack_size__=0x8000; -define symbol __heap_size__=0x10000; - if (!isdefinedsymbol(MBED_APP_START)) { define symbol MBED_APP_START = 0; } @@ -61,6 +57,13 @@ if (!isdefinedsymbol(MBED_APP_SIZE)) { define symbol MBED_APP_SIZE = 0x100000; } +if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) { + define symbol MBED_BOOT_STACK_SIZE = 0x400; +} + +define symbol __stack_size__=MBED_BOOT_STACK_SIZE; +define symbol __heap_size__=0x10000; + define symbol __ram_vector_table_size__ = isdefinedsymbol(__ram_vector_table__) ? 0x00000400 : 0; define symbol __ram_vector_table_offset__ = isdefinedsymbol(__ram_vector_table__) ? 0x000003FF : 0;