1/*
2 * Copyright (C) 2018 Marvell International Ltd.
3 *
4 * SPDX-License-Identifier:     BSD-3-Clause
5 * https://spdx.org/licenses
6 */
7
8#include <platform_def.h>
9
10OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT)
11OUTPUT_ARCH(PLATFORM_LINKER_ARCH)
12ENTRY(ble_main)
13
14MEMORY {
15    RAM (rwx): ORIGIN = BLE_BASE, LENGTH = BLE_LIMIT - BLE_BASE
16}
17
18SECTIONS
19{
20    . = BLE_BASE;
21
22    ro . : {
23        __RO_START__ = .;
24        *ble_main.o(.entry*)
25        *(.text*)
26        *(.rodata*)
27        __RO_END_UNALIGNED__ = .;
28        __RO_END__ = .;
29    } >RAM
30
31    /*
32     * Define a linker symbol to mark start of the RW memory area for this
33     * image.
34     */
35    __RW_START__ = . ;
36
37    .data . : {
38        __DATA_START__ = .;
39        *(.data*)
40        __DATA_END__ = .;
41    } >RAM
42
43    stacks . (NOLOAD) : {
44        __STACKS_START__ = .;
45        *(tzfw_normal_stacks)
46        __STACKS_END__ = .;
47    } >RAM
48
49    .bss : {
50        __BSS_START__ = .;
51        *(.bss*)
52        __BSS_END__ = .;
53    } >RAM
54
55   /*
56    * Extend the BLE binary to the maximum size allocated for it in platform
57    * definition files and prevent overlapping between BLE BSS section and
58    * additional extensions that can follow the BLE in flash image preamble.
59    * This situation happens for instance when secure extension is added to
60    * the image preamble.
61    */
62   .fill LOADADDR(.bss) + SIZEOF(.bss) : {
63       FILL(0xDEADC0DE);
64       . = ORIGIN(RAM) + LENGTH(RAM) - 1;
65       BYTE(0x00)
66   } >RAM
67
68    /*
69     * Define a linker symbol to mark end of the RW memory area for this
70     * image.
71     */
72    __RW_END__ = .;
73    __BLE_END__ = .;
74
75    __BSS_SIZE__ = SIZEOF(.bss);
76}
77