6
6
#define MBED_APP_SIZE 1024k
7
7
#endif
8
8
9
+ M_CRASH_DATA_RAM_SIZE = 0x100;
10
+
9
11
#if !defined(MBED_BOOT_STACK_SIZE)
10
12
#define MBED_BOOT_STACK_SIZE 0x400
11
13
#endif
12
14
13
15
STACK_SIZE = MBED_BOOT_STACK_SIZE;
14
16
15
- M_CRASH_DATA_RAM_SIZE = 0x100;
16
-
17
17
/* Linker script to configure memory regions. */
18
18
MEMORY
19
19
{
@@ -106,7 +106,7 @@ SECTIONS
106
106
__CRASH_DATA_RAM_END__ = .; /* Define a global symbol at data end */
107
107
} > SRAM2
108
108
109
- /* .stack section doesn't contains any symbols. It is only
109
+ /* .stack section doesn't contains any symbols. It is only
110
110
* used for linker to reserve space for the isr stack section
111
111
* WARNING : .stack should come immediately after the last secure memory
112
112
* section. This provides stack overflow detection. */
@@ -124,6 +124,17 @@ SECTIONS
124
124
__StackLimit = ADDR (.stack);
125
125
PROVIDE (__stack = __StackTop);
126
126
127
+ /* Place holder for additional heap */
128
+ .heap_0 (COPY) :
129
+ {
130
+ __mbed_sbrk_start_0 = .;
131
+ . += (ORIGIN (SRAM2) + LENGTH (SRAM2) - .);
132
+ __mbed_krbs_start_0 = .;
133
+ } > SRAM2
134
+
135
+ /* Check if heap exceeds SRAM2 */
136
+ ASSERT (__mbed_krbs_start_0 <= (ORIGIN (SRAM2)+LENGTH (SRAM2)), "Heap is too big for SRAM2")
137
+
127
138
.data : AT (__etext)
128
139
{
129
140
__data_start__ = .;
@@ -144,6 +155,7 @@ SECTIONS
144
155
KEEP(*(.init_array))
145
156
PROVIDE_HIDDEN (__init_array_end = .);
146
157
158
+
147
159
. = ALIGN (8);
148
160
/* finit data */
149
161
PROVIDE_HIDDEN (__fini_array_start = .);
@@ -156,6 +168,7 @@ SECTIONS
156
168
/* All data end */
157
169
__data_end__ = .;
158
170
_edata = .;
171
+
159
172
} > SRAM1
160
173
161
174
/* Check if bss exceeds SRAM1 */
@@ -176,17 +189,18 @@ SECTIONS
176
189
/* Check if bss exceeds SRAM1 */
177
190
ASSERT (__bss_end__ <= (ORIGIN (SRAM1)+LENGTH (SRAM1)), "BSS is too big for SRAM1")
178
191
192
+ /* Placeholder for default single heap */
179
193
.heap (COPY) :
180
194
{
181
195
__end__ = .;
182
- __mbed_sbrk_start_0 = .;
183
196
end = __end__;
197
+ __mbed_sbrk_start = .;
184
198
*(.heap*)
185
- . = (ORIGIN (SRAM2) + LENGTH (SRAM2));
186
- __mbed_krbs_start_0 = .;
187
- __mbed_sbrk_start = __bss_end__;
188
- . = (ORIGIN (SRAM1) + LENGTH (SRAM1));
199
+ . += (ORIGIN (SRAM1) + LENGTH (SRAM1) - .);
189
200
__mbed_krbs_start = .;
190
201
__HeapLimit = .;
191
- } > SRAM2
202
+ } > SRAM1
203
+
204
+ /* Check if heap exceeds SRAM1 */
205
+ ASSERT (__HeapLimit <= (ORIGIN (SRAM1)+LENGTH (SRAM1)), "Heap is too big for SRAM1")
192
206
}
0 commit comments