Skip to content

Commit c5f8dc2

Browse files
author
deepikabhavnani
committed
Add aligment and unitialized section in GCC linker script sample
1 parent 5bdc302 commit c5f8dc2

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

docs/porting/target/bootstrap.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ GCC linker script template:
151151
#if !defined(MBED_BOOT_STACK_SIZE)
152152
/* This value is normally defined by the tools
153153
to 0x1000 for baremetal and 0x400 for RTOS */
154-
#define MBED_BOOT_STACK_SIZE 0x1000
154+
#define MBED_BOOT_STACK_SIZE 0x400
155155
#endif
156156
157157
/* Round up VECTORS_SIZE to 8 bytes */
@@ -234,49 +234,62 @@ SECTIONS
234234
235235
/* Location counter can end up 2byte aligned with narrow Thumb code but
236236
__etext is assumed by startup code to be the LMA of a section in RAM
237-
which must be 4byte aligned */
238-
__etext = ALIGN (4);
237+
which must be 8-byte aligned */
238+
__etext = ALIGN (8);
239239
240240
.data : AT (__etext)
241241
{
242242
__data_start__ = .;
243243
*(vtable)
244244
*(.data*)
245245
246-
. = ALIGN(4);
246+
. = ALIGN(8);
247247
/* preinit data */
248248
PROVIDE_HIDDEN (__preinit_array_start = .);
249249
KEEP(*(.preinit_array))
250250
PROVIDE_HIDDEN (__preinit_array_end = .);
251251
252-
. = ALIGN(4);
252+
. = ALIGN(8);
253253
/* init data */
254254
PROVIDE_HIDDEN (__init_array_start = .);
255255
KEEP(*(SORT(.init_array.*)))
256256
KEEP(*(.init_array))
257257
PROVIDE_HIDDEN (__init_array_end = .);
258258
259-
. = ALIGN(4);
259+
. = ALIGN(8);
260260
/* finit data */
261261
PROVIDE_HIDDEN (__fini_array_start = .);
262262
KEEP(*(SORT(.fini_array.*)))
263263
KEEP(*(.fini_array))
264264
PROVIDE_HIDDEN (__fini_array_end = .);
265265
266266
KEEP(*(.jcr*))
267-
. = ALIGN(4);
267+
. = ALIGN(8);
268268
/* All data end */
269269
__data_end__ = .;
270270
271271
} > RAM
272272
273+
/* Uninitialized data section
274+
* This region is not initialized by the C/C++ library and can be used to
275+
* store state across soft reboots. */
276+
.uninitialized (NOLOAD):
277+
{
278+
. = ALIGN(32);
279+
__uninitialized_start = .;
280+
*(.uninitialized)
281+
KEEP(*(.keep.uninitialized))
282+
. = ALIGN(32);
283+
__uninitialized_end = .;
284+
} > RAM
285+
273286
.bss :
274287
{
275-
. = ALIGN(4);
288+
. = ALIGN(8);
276289
__bss_start__ = .;
277290
*(.bss*)
278291
*(COMMON)
279-
. = ALIGN(4);
292+
. = ALIGN(8);
280293
__bss_end__ = .;
281294
} > RAM
282295

0 commit comments

Comments
 (0)