summaryrefslogtreecommitdiff
path: root/core/cortex-m/ec.lds.S
blob: ea89e241e9f4de612589352002126d9c8351d2e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#include "config.h"

#define CONFIG_FW_SECT_OFF(section) CONFIG_FW_##section##_OFF
#define CONFIG_FW_BASE(section) (CONFIG_FLASH_BASE + CONFIG_FW_SECT_OFF(section))

OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(reset)
MEMORY
{
    FLASH (rx) : ORIGIN = CONFIG_FW_BASE(SECTION), LENGTH = CONFIG_FW_IMAGE_SIZE
    IRAM (rw)  : ORIGIN = CONFIG_RAM_BASE, LENGTH = CONFIG_RAM_SIZE
}
SECTIONS
{
    .text : {
        OUTDIR/core/CORE/init.o (.text.vecttable)
        . = ALIGN(4);
        *(.rodata.ver)
        . = ALIGN(4);
        OUTDIR/core/CORE/init.o (.text)
        *(.text*)
#ifdef COMPILE_FOR_RAM
    } > IRAM
#else
    } > FLASH
#endif
    . = ALIGN(4);
    .rodata : {
	/* Symbols defined here are declared in link_defs.h */
        __irqprio = .;
        *(.rodata.irqprio)
        __irqprio_end = .;

        . = ALIGN(4);
        __cmds = .;
        *(.rodata.cmds)
        __cmds_end = .;

        . = ALIGN(4);
        __hcmds = .;
        *(.rodata.hcmds)
        __hcmds_end = .;

        . = ALIGN(4);
        __hooks_init = .;
        *(.rodata.HOOK_INIT)
        __hooks_init_end = .;

        __hooks_freq_change = .;
        *(.rodata.HOOK_FREQ_CHANGE)
        __hooks_freq_change_end = .;

        __hooks_sysjump = .;
        *(.rodata.HOOK_SYSJUMP)
        __hooks_sysjump_end = .;

        . = ALIGN(4);
        *(.rodata*)
        . = ALIGN(4);
#ifdef COMPILE_FOR_RAM
    } > IRAM
    __ro_end = . ;
    .data : {
#else
    } > FLASH
    __ro_end = . ;
    .data : AT(ADDR(.rodata) + SIZEOF(.rodata)) {
#endif
        . = ALIGN(4);
        __data_start = .;
        *(.data.tasks)
        *(.data)
        . = ALIGN(4);
        *(.iram.text)
        . = ALIGN(4);
        __data_end = .;
    } > IRAM
#if defined(SECTION_IS_RO) && defined(CONFIG_VBOOT)
    .google CONFIG_FMAP_OFF : AT(CONFIG_FMAP_OFF) {
        *(.google)
    } > FLASH
#else
    /DISCARD/ : {
              *(.google)
              }
#endif
    .bss : {
        . = ALIGN(4);
        __bss_start = .;
        *(.bss)
        . = ALIGN(4);
        __bss_end = .;

	/* Shared memory buffer must be at the end of preallocated RAM, so it
	 * can expand to use all the remaining RAM. */
	__shared_mem_buf = .;
    } > IRAM

    /DISCARD/ : { *(.ARM.*) }
}