[Realtek] Support boot stack size configuration option

pull/9092/head
Przemyslaw Stekiel 2018-12-18 08:54:39 +01:00
parent 36ff05345e
commit 3525f6b393
4 changed files with 22 additions and 18 deletions

View File

@ -1,3 +1,4 @@
#! armcc -E
; Realtek Semiconductor Corp.
;
; RTL8195A ARMCC Scatter File
@ -10,6 +11,12 @@
; DRAM (rwx) : ORIGIN = 0x30000000, LENGTH = 2M
; }
#if !defined(MBED_BOOT_STACK_SIZE)
#define MBED_BOOT_STACK_SIZE 0x400
#endif
#define Stack_Size MBED_BOOT_STACK_SIZE
LR_IRAM 0x10007000 (0x70000 - 0x7000) {
IMAGE2_TABLE 0x10007000 FIXED {
@ -43,7 +50,7 @@ LR_IRAM 0x10007000 (0x70000 - 0x7000) {
*mbed_boot*.o (+ZI)
}
ARM_LIB_STACK (0x10070000 - 0x1000) EMPTY 0x1000 {
ARM_LIB_STACK (0x10070000) EMPTY -Stack_Size {
}
}

View File

@ -25,8 +25,12 @@ MEMORY
SRAM2 (rwx) : ORIGIN = 0x30000000, LENGTH = 2M
}
#if !defined(MBED_BOOT_STACK_SIZE)
#define MBED_BOOT_STACK_SIZE 0x400
#endif
/* Stack sizes: */
StackSize = 0x1000;
StackSize = MBED_BOOT_STACK_SIZE;
/* Linker script to place sections and symbol values. Should be used together
* with other linker script that defines memory regions FLASH and RAM.
@ -221,7 +225,7 @@ SECTIONS
/* Set stack top to end of RAM, and stack limit move down by
* size of stack_dummy section */
__StackTop = ORIGIN(SRAM1) + LENGTH(SRAM1);
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
__StackLimit = __StackTop - StackSize;
PROVIDE(__stack = __StackTop);
/* Check if data + heap + stack exceeds RAM limit */

View File

@ -29,7 +29,11 @@ define region TCM_region = mem:[from __DTCM_start__ to __DTCM_end__];
define region RAM_region = mem:[from __SRAM_start__ to __SRAM_end__] |
mem:[from __DRAM_start__ to __DRAM_end__];
define block CSTACK with alignment = 8, size = 0x1000 { };
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
define symbol MBED_BOOT_STACK_SIZE = 0x400;
}
define block CSTACK with alignment = 8, size = MBED_BOOT_STACK_SIZE { };
define block HEAP with alignment = 8, size = 0x19000 { };
do not initialize { section .noinit };

View File

@ -23,21 +23,10 @@
#if defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Base[];
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Length[];
#define ISR_STACK_START (unsigned char *)(Image$$ARM_LIB_STACK$$ZI$$Base)
#define ISR_STACK_SIZE (uint32_t)(Image$$ARM_LIB_STACK$$ZI$$Length)
#define INITIAL_SP (uint32_t)(Image$$ARM_LIB_STACK$$ZI$$Base)
#define INITIAL_SP ((uint32_t)(Image$$ARM_LIB_STACK$$ZI$$Base))
#elif defined(__GNUC__)
extern uint32_t __StackTop[];
extern uint32_t __StackLimit[];
extern uint32_t __HeapLimit[];
#define INITIAL_SP (__StackTop)
#endif
#if defined(__GNUC__)
#ifndef ISR_STACK_SIZE
#define ISR_STACK_SIZE (0x1000)
#endif
extern uint32_t __StackTop;
#define INITIAL_SP ((uint32_t)(&__StackTop))
#endif
#endif