Skip to content

Commit d2cf36f

Browse files
committed
TARGET_Realtek: ISR stack size unification
Unify ISR stack size for targets which support MBED 5 (or MBED 2 and MBED 5). MBED 5 : 1 boards ---------------- REALTEK_RTL8195AM MBED 2, 5 : 0 boards ---------------- MBED 2 : 0 boards (skipped) ----------------
1 parent 5798434 commit d2cf36f

File tree

5 files changed

+30
-27
lines changed

5 files changed

+30
-27
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#! armcc -E
2+
#include "mbed_config.h"
13
; Realtek Semiconductor Corp.
24
;
35
; RTL8195A ARMCC Scatter File
@@ -10,6 +12,16 @@
1012
; DRAM (rwx) : ORIGIN = 0x30000000, LENGTH = 2M
1113
; }
1214

15+
#if (defined(__stack_size__))
16+
#define Stack_Size __stack_size__
17+
#else
18+
#if (defined(MBED_CONF_RTOS_PRESENT))
19+
#define Stack_Size 0x0400
20+
#else
21+
#define Stack_Size 0x1000
22+
#endif
23+
#endif
24+
1325
LR_IRAM 0x10007000 (0x70000 - 0x7000) {
1426

1527
IMAGE2_TABLE 0x10007000 FIXED {
@@ -43,7 +55,7 @@ LR_IRAM 0x10007000 (0x70000 - 0x7000) {
4355
*mbed_boot*.o (+ZI)
4456
}
4557

46-
ARM_LIB_STACK (0x10070000 - 0x1000) EMPTY 0x1000 {
58+
ARM_LIB_STACK (0x10070000 - Stack_Size) EMPTY Stack_Size {
4759
}
4860
}
4961

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

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

28-
/* Stack sizes: */
29-
StackSize = 0x1000;
30-
3128
/* Linker script to place sections and symbol values. Should be used together
3229
* with other linker script that defines memory regions FLASH and RAM.
3330
* It references following symbols, which must be defined in code:
@@ -195,7 +192,7 @@ SECTIONS
195192
__end__ = .;
196193
end = __end__;
197194
*(.heap*)
198-
. = ORIGIN(SRAM1) + LENGTH(SRAM1) - StackSize;
195+
. = ORIGIN(SRAM1) + LENGTH(SRAM1) - Stack_Size;
199196
__HeapLimit = .;
200197
} > SRAM1
201198

@@ -215,13 +212,13 @@ SECTIONS
215212
{
216213
__StackLimit = .;
217214
*(.stack)
218-
. += StackSize - (. - __StackLimit);
215+
. += Stack_Size;
219216
} > SRAM1
220217

221218
/* Set stack top to end of RAM, and stack limit move down by
222219
* size of stack_dummy section */
223220
__StackTop = ORIGIN(SRAM1) + LENGTH(SRAM1);
224-
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
221+
__StackLimit = __StackTop - Stack_Size;
225222
PROVIDE(__stack = __StackTop);
226223

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

targets/TARGET_Realtek/TARGET_AMEBA/TARGET_RTL8195A/device/TOOLCHAIN_GCC_ARM/rtl8195a_startup.S

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@
1717
.syntax unified
1818
.thumb
1919

20+
.section .stack
21+
.align 3
22+
#ifdef __STACK_SIZE
23+
.equ Stack_Size, __STACK_SIZE
24+
#else
25+
#if defined(MBED_CONF_RTOS_PRESENT)
26+
.equ Stack_Size, 0x400
27+
#else
28+
.equ Stack_Size, 0x1000
29+
#endif
30+
#endif
31+
32+
.global Stack_Size
2033
.global __StackTop
2134
.global PLAT_Init
2235

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ 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+
define block CSTACK with alignment = 8, size = 0x400 { };
3333
define block HEAP with alignment = 8, size = 0x19000 { };
3434

3535
do not initialize { section .noinit };

targets/TARGET_Realtek/mbed_rtx.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,5 @@
2121

2222
#include "rtl8195a.h"
2323

24-
#if defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
25-
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)
30-
#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
41-
#endif
42-
4324
#endif
4425
#endif

0 commit comments

Comments
 (0)