File tree Expand file tree Collapse file tree 8 files changed +74
-14
lines changed Expand file tree Collapse file tree 8 files changed +74
-14
lines changed Original file line number Diff line number Diff line change
1
+ #! armcc -E
2
+ #include "mbed_config.h"
3
+
1
4
;/*
2
5
; * BEETLE CMSIS Library
3
6
; */
22
25
; *** Scatter-Loading Description File ***
23
26
; *************************************************************
24
27
28
+ #if (defined(__stack_size__))
29
+ #define Stack_Size __stack_size__
30
+ #else
31
+ #if (defined(MBED_CONF_RTOS_PRESENT))
32
+ #define Stack_Size 0x0400
33
+ #else
34
+ #define Stack_Size 0x1000
35
+ #endif
36
+ #endif
37
+
25
38
LR_IROM1 0x00000000 0x00040000 { ; load region size_region
26
39
ER_IROM1 0x00000000 0x00040000 { ; load address = execution address
27
40
*.o (RESET, +FIRST)
@@ -30,7 +43,10 @@ LR_IROM1 0x00000000 0x00040000 { ; load region size_region
30
43
CORDIO_RO_2.1.o (*)
31
44
}
32
45
; Total: 80 vectors = 320 bytes (0x140) to be reserved in RAM
33
- RW_IRAM1 (0x20000000+0x140) (0x20000-0x140) { ; RW data
46
+ RW_IRAM1 (0x20000000+0x140) (0x20000-0x140-Stack_Size ) { ; RW data
34
47
.ANY (+RW +ZI)
35
48
}
49
+
50
+ ARM_LIB_STACK (0x20000000 + 0x20000) EMPTY -Stack_Size { ; Stack region growing down
51
+ }
36
52
}
Original file line number Diff line number Diff line change @@ -59,10 +59,6 @@ MEMORY
59
59
*/
60
60
ENTRY (Reset_Handler )
61
61
62
- /* Heap 1/4 of ram and stack 1/8 */
63
- __stack_size__ = 0x4000;
64
- __heap_size__ = 0x8000;
65
-
66
62
HEAP_SIZE = DEFINED (__heap_size__) ? __heap_size__ : 0x0400;
67
63
STACK_SIZE = DEFINED (__stack_size__) ? __stack_size__ : 0x0400;
68
64
@@ -202,11 +198,17 @@ SECTIONS
202
198
__end__ = .;
203
199
PROVIDE (end = .);
204
200
__HeapBase = .;
205
- . += HEAP_SIZE ;
201
+ . = ORIGIN (RAM) + LENGTH (RAM) - Stack_Size ;
206
202
__HeapLimit = .;
207
203
__heap_limit = .; /* Add for _sbrk */
208
204
} > RAM
209
205
206
+ .stack_dummy :
207
+ {
208
+ *(.stack)
209
+ . += Stack_Size;
210
+ } > RAM
211
+
210
212
/* Set stack top to end of RAM, and stack limit move down by
211
213
* size of stack_dummy section */
212
214
__StackTop = ORIGIN (RAM) + LENGTH (RAM);
Original file line number Diff line number Diff line change 24
24
.syntax unified
25
25
.arch armv7 - m
26
26
27
+ . section .stack
28
+ . align 3
29
+ #ifdef __STACK_SIZE
30
+ . equ Stack_Size , __STACK_SIZE
31
+ #else
32
+ #if defined(MBED_CONF_RTOS_PRESENT)
33
+ . equ Stack_Size , 0x400
34
+ #else
35
+ . equ Stack_Size , 0x1000
36
+ #endif
37
+ #endif
38
+ .globl Stack_Size
39
+
27
40
. section .vector_table , "a" , %progbits
28
41
. align 2
29
42
.globl __isr_vector
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ define symbol __ICFEDIT_region_RAM_start__ = 0x20000140;
30
30
define symbol __ICFEDIT_region_RAM_end__ = 0x2001FFFF;
31
31
/*-Sizes-*/
32
32
/* Heap and Stack size */
33
- define symbol __ICFEDIT_size_cstack__ = 0x1000 ;
33
+ define symbol __ICFEDIT_size_cstack__ = 0x400 ;
34
34
define symbol __ICFEDIT_size_heap__ = 0x4000;
35
35
/**** End of ICF editor section. ###ICF###*/
36
36
Original file line number Diff line number Diff line change 1
1
#! armcc -E
2
+ #include "mbed_config.h"
2
3
3
4
/*
4
5
* MPS2 CMSIS Library
29
30
#include "../memory_zones.h"
30
31
#include "../cmsis_nvic.h"
31
32
33
+ #if (defined(__stack_size__))
34
+ #define Stack_Size __stack_size__
35
+ #else
36
+ #if (defined(MBED_CONF_RTOS_PRESENT))
37
+ #define Stack_Size 0x0400
38
+ #else
39
+ #define Stack_Size 0x1000
40
+ #endif
41
+ #endif
42
+
32
43
; The vector table is loaded at address 0x00000000 in Flash memory region.
33
44
LR_IROM1 FLASH_START FLASH_SIZE {
34
45
ER_IROM1 FLASH_START FLASH_SIZE {
@@ -44,8 +55,10 @@ LR_IROM2 ZBT_SSRAM1_START ZBT_SSRAM1_SIZE {
44
55
}
45
56
; At execution, RAM is set to be in ZBT SSRAM2 and 3, just after the vector
46
57
; table previously moved from Flash.
47
- RW_IRAM1 (ZBT_SSRAM23_START + NVIC_VECTORS_SIZE) (ZBT_SSRAM23_SIZE - NVIC_VECTORS_SIZE) {
58
+ RW_IRAM1 (ZBT_SSRAM23_START + NVIC_VECTORS_SIZE) (ZBT_SSRAM23_SIZE - NVIC_VECTORS_SIZE - Stack_Size ) {
48
59
.ANY (+RW +ZI)
49
60
}
61
+ ARM_LIB_STACK (ZBT_SSRAM23_START + ZBT_SSRAM23_SIZE) EMPTY -Stack_Size { ; Stack region growing down
62
+ }
50
63
}
51
64
Original file line number Diff line number Diff line change 60
60
*/
61
61
ENTRY (Reset_Handler )
62
62
63
- HEAP_SIZE = 0x4000;
64
- STACK_SIZE = 0x1000;
65
-
66
63
/* Size of the vector table in SRAM */
67
64
M_VECTOR_RAM_SIZE = NVIC_VECTORS_SIZE;
68
65
@@ -192,15 +189,21 @@ SECTIONS
192
189
__end__ = .;
193
190
PROVIDE (end = .);
194
191
__HeapBase = .;
195
- . += HEAP_SIZE ;
192
+ . = ORIGIN (RAM) + LENGTH (RAM) - Stack_Size ;
196
193
__HeapLimit = .;
197
194
__heap_limit = .; /* Add for _sbrk */
198
195
} > RAM
199
196
197
+ .stack_dummy :
198
+ {
199
+ *(.stack)
200
+ . += Stack_Size;
201
+ } > RAM
202
+
200
203
/* Set stack top to end of RAM, and stack limit move down by
201
204
* size of stack_dummy section */
202
205
__StackTop = ORIGIN (RAM) + LENGTH (RAM);
203
- __StackLimit = __StackTop - STACK_SIZE ;
206
+ __StackLimit = __StackTop - Stack_Size ;
204
207
PROVIDE (__stack = __StackTop);
205
208
206
209
/* Check if data + heap + stack exceeds RAM limit */
Original file line number Diff line number Diff line change 24
24
.syntax unified
25
25
.arch armv7 - m
26
26
27
+ . section .stack
28
+ . align 3
29
+ #ifdef __STACK_SIZE
30
+ . equ Stack_Size , __STACK_SIZE
31
+ #else
32
+ #if defined(MBED_CONF_RTOS_PRESENT)
33
+ . equ Stack_Size , 0x400
34
+ #else
35
+ . equ Stack_Size , 0x1000
36
+ #endif
37
+ #endif
38
+ .globl Stack_Size
39
+
27
40
. section .vector_table , "a" , %progbits
28
41
. align 2
29
42
.globl __isr_vector
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ define symbol __ICFEDIT_region_RAM_end__ = ZBT_SSRAM23_START + ZBT_SSRAM23_
58
58
/* Sizes */
59
59
/* Heap and Stack size */
60
60
define symbol __ICFEDIT_size_heap__ = 0xF000;
61
- define symbol __ICFEDIT_size_cstack__ = 0x1000 ;
61
+ define symbol __ICFEDIT_size_cstack__ = 0x400 ;
62
62
63
63
define memory mem with size = 4G;
64
64
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
You can’t perform that action at this time.
0 commit comments