Skip to content

Commit 3525f6b

Browse files
committed
[Realtek] Support boot stack size configuration option
1 parent 36ff053 commit 3525f6b

File tree

4 files changed

+22
-18
lines changed

4 files changed

+22
-18
lines changed

targets/TARGET_Realtek/TARGET_AMEBA/TARGET_MCU_RTL8195A/device/TOOLCHAIN_ARM_STD/rtl8195a.sct

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#! armcc -E
12
; Realtek Semiconductor Corp.
23
;
34
; RTL8195A ARMCC Scatter File
@@ -10,6 +11,12 @@
1011
; DRAM (rwx) : ORIGIN = 0x30000000, LENGTH = 2M
1112
; }
1213

14+
#if !defined(MBED_BOOT_STACK_SIZE)
15+
#define MBED_BOOT_STACK_SIZE 0x400
16+
#endif
17+
18+
#define Stack_Size MBED_BOOT_STACK_SIZE
19+
1320
LR_IRAM 0x10007000 (0x70000 - 0x7000) {
1421

1522
IMAGE2_TABLE 0x10007000 FIXED {
@@ -43,7 +50,7 @@ LR_IRAM 0x10007000 (0x70000 - 0x7000) {
4350
*mbed_boot*.o (+ZI)
4451
}
4552

46-
ARM_LIB_STACK (0x10070000 - 0x1000) EMPTY 0x1000 {
53+
ARM_LIB_STACK (0x10070000) EMPTY -Stack_Size {
4754
}
4855
}
4956

targets/TARGET_Realtek/TARGET_AMEBA/TARGET_MCU_RTL8195A/device/TOOLCHAIN_GCC_ARM/rtl8195a.ld

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ MEMORY
2525
SRAM2 (rwx) : ORIGIN = 0x30000000, LENGTH = 2M
2626
}
2727

28+
#if !defined(MBED_BOOT_STACK_SIZE)
29+
#define MBED_BOOT_STACK_SIZE 0x400
30+
#endif
31+
2832
/* Stack sizes: */
29-
StackSize = 0x1000;
33+
StackSize = MBED_BOOT_STACK_SIZE;
3034

3135
/* Linker script to place sections and symbol values. Should be used together
3236
* with other linker script that defines memory regions FLASH and RAM.
@@ -221,7 +225,7 @@ SECTIONS
221225
/* Set stack top to end of RAM, and stack limit move down by
222226
* size of stack_dummy section */
223227
__StackTop = ORIGIN(SRAM1) + LENGTH(SRAM1);
224-
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
228+
__StackLimit = __StackTop - StackSize;
225229
PROVIDE(__stack = __StackTop);
226230

227231
/* Check if data + heap + stack exceeds RAM limit */

targets/TARGET_Realtek/TARGET_AMEBA/TARGET_MCU_RTL8195A/device/TOOLCHAIN_IAR/rtl8195a.icf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ define region TCM_region = mem:[from __DTCM_start__ to __DTCM_end__];
2929
define region RAM_region = mem:[from __SRAM_start__ to __SRAM_end__] |
3030
mem:[from __DRAM_start__ to __DRAM_end__];
3131

32-
define block CSTACK with alignment = 8, size = 0x1000 { };
32+
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
33+
define symbol MBED_BOOT_STACK_SIZE = 0x400;
34+
}
35+
36+
define block CSTACK with alignment = 8, size = MBED_BOOT_STACK_SIZE { };
3337
define block HEAP with alignment = 8, size = 0x19000 { };
3438

3539
do not initialize { section .noinit };

targets/TARGET_Realtek/mbed_rtx.h

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,10 @@
2323

2424
#if defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
2525
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Base[];
26-
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Length[];
27-
#define ISR_STACK_START (unsigned char *)(Image$$ARM_LIB_STACK$$ZI$$Base)
28-
#define ISR_STACK_SIZE (uint32_t)(Image$$ARM_LIB_STACK$$ZI$$Length)
29-
#define INITIAL_SP (uint32_t)(Image$$ARM_LIB_STACK$$ZI$$Base)
26+
#define INITIAL_SP ((uint32_t)(Image$$ARM_LIB_STACK$$ZI$$Base))
3027
#elif defined(__GNUC__)
31-
extern uint32_t __StackTop[];
32-
extern uint32_t __StackLimit[];
33-
extern uint32_t __HeapLimit[];
34-
#define INITIAL_SP (__StackTop)
35-
#endif
36-
37-
#if defined(__GNUC__)
38-
#ifndef ISR_STACK_SIZE
39-
#define ISR_STACK_SIZE (0x1000)
40-
#endif
28+
extern uint32_t __StackTop;
29+
#define INITIAL_SP ((uint32_t)(&__StackTop))
4130
#endif
4231

4332
#endif

0 commit comments

Comments
 (0)