Skip to content

Commit 66cce67

Browse files
committed
Update the K64F to use boot stack size config
Update the K64F linker scripts to make use of the newly added stack size target config.
1 parent 1ead033 commit 66cce67

File tree

3 files changed

+25
-12
lines changed

3 files changed

+25
-12
lines changed

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_ARM_STD/MK64FN1M0xxx12.sct

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@
6464
#define MBED_APP_SIZE 0x100000
6565
#endif
6666

67+
#if !defined(MBED_BOOT_STACK_SIZE)
68+
#define MBED_BOOT_STACK_SIZE 0x400
69+
#endif
70+
6771
#define m_interrupts_start MBED_APP_START
6872
#define m_interrupts_size 0x00000400
6973

@@ -86,7 +90,7 @@
8690
#if (defined(__stack_size__))
8791
#define Stack_Size __stack_size__
8892
#else
89-
#define Stack_Size 0x0400
93+
#define Stack_Size MBED_BOOT_STACK_SIZE
9094
#endif
9195

9296
#if (defined(__heap_size__))
@@ -122,4 +126,6 @@ LR_IROM1 m_interrupts_start m_text_start+m_text_size-m_interrupts_start { ; lo
122126
}
123127
RW_IRAM1 ImageLimit(RW_m_data_2) { ; Heap region growing up
124128
}
129+
ARM_LIB_STACK m_data_2_start+m_data_2_size EMPTY -Stack_Size { ; Stack region growing down
130+
}
125131
}

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_GCC_ARM/MK64FN1M0xxx12.ld

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,6 @@ ENTRY(Reset_Handler)
5353

5454
__ram_vector_table__ = 1;
5555

56-
/* With the RTOS in use, this does not affect the main stack size. The size of
57-
* the stack where main runs is determined via the RTOS. */
58-
__stack_size__ = 0x400;
59-
60-
__heap_size__ = 0x6000;
61-
6256
#if !defined(MBED_APP_START)
6357
#define MBED_APP_START 0
6458
#endif
@@ -67,6 +61,16 @@ __heap_size__ = 0x6000;
6761
#define MBED_APP_SIZE 0x100000
6862
#endif
6963

64+
#if !defined(MBED_BOOT_STACK_SIZE)
65+
#define MBED_BOOT_STACK_SIZE 0x400
66+
#endif
67+
68+
/* With the RTOS in use, this does not affect the main stack size. The size of
69+
* the stack where main runs is determined via the RTOS. */
70+
__stack_size__ = MBED_BOOT_STACK_SIZE;
71+
72+
__heap_size__ = 0x6000;
73+
7074
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
7175
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
7276
M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0;
@@ -259,7 +263,7 @@ SECTIONS
259263
__end__ = .;
260264
PROVIDE(end = .);
261265
__HeapBase = .;
262-
. += HEAP_SIZE;
266+
. = ORIGIN(m_data_2) + LENGTH(m_data_2) - STACK_SIZE;
263267
__HeapLimit = .;
264268
__heap_limit = .; /* Add for _sbrk */
265269
} > m_data_2

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_IAR/MK64FN1M0xxx12.icf

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@
4949
*/
5050
define symbol __ram_vector_table__ = 1;
5151

52-
/* Heap 1/4 of ram and stack 1/8 */
53-
define symbol __stack_size__=0x8000;
54-
define symbol __heap_size__=0x10000;
55-
5652
if (!isdefinedsymbol(MBED_APP_START)) {
5753
define symbol MBED_APP_START = 0;
5854
}
@@ -61,6 +57,13 @@ if (!isdefinedsymbol(MBED_APP_SIZE)) {
6157
define symbol MBED_APP_SIZE = 0x100000;
6258
}
6359

60+
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
61+
define symbol MBED_BOOT_STACK_SIZE = 0x400;
62+
}
63+
64+
define symbol __stack_size__=MBED_BOOT_STACK_SIZE;
65+
define symbol __heap_size__=0x10000;
66+
6467
define symbol __ram_vector_table_size__ = isdefinedsymbol(__ram_vector_table__) ? 0x00000400 : 0;
6568
define symbol __ram_vector_table_offset__ = isdefinedsymbol(__ram_vector_table__) ? 0x000003FF : 0;
6669

0 commit comments

Comments
 (0)