Debian Codegraph @

ports/qemu/mcu/rv32/virt.ld

raw
1 /*
2 * This file is part of the MicroPython project, http://micropython.org/
3 *
4 * The MIT License (MIT)
5 *
6 * Copyright (c) 2023 Alessandro Gatti
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 */
26
27 /* Output format is 32 bits little endian. */
28 OUTPUT_FORMAT("elf32-littleriscv", "elf32-littleriscv", "elf32-littleriscv");
29
30 /*
31 * Memory layout:
32 *
33 * 0x8000_0000: .text
34 * .........: .rodata
35 * 0x8040_0000: .data
36 * .........: _global_pointer
37 * .........: .bss
38 * 0x8060_0000: .stack
39 * 0x8060_0000: _sstack
40 * 0x8060_FFFF: _estack
41 */
42 MEMORY
43 {
44 ROM (xr) : ORIGIN = 0x80000000, LENGTH = 4M
45 RAM (xrw) : ORIGIN = ORIGIN(ROM) + LENGTH(ROM), LENGTH = 2M
46 STACK (rw) : ORIGIN = ORIGIN(RAM) + LENGTH(RAM), LENGTH = 64K
47 }
48
49 SECTIONS
50 {
51 /* Code + Read-Only data segment */
52
53 .text : ALIGN (4K)
54 {
55 *(.start)
56 *(.text)
57 . = ALIGN (4K);
58 *(.rodata)
59 _sirodata = .;
60 } > ROM
61
62 .rodata : AT (_sirodata) ALIGN (4K)
63 {
64 *(.rodata)
65 } > ROM
66
67 /* Data + BSS segment */
68
69 .data : ALIGN (4K)
70 {
71 *(.data)
72 _sibss = .;
73 } > RAM
74
75 .bss : AT (_sibss) ALIGN (4K)
76 {
77 /* Mark global pointer address. */
78 _global_pointer = .;
79
80 /* Mark BSS start. */
81 . = . + 4;
82 _sbss = .;
83 *(.bss)
84 /* Mark BSS end. */
85 _ebss = .;
86 } > RAM
87
88 /* Isolated stack segment. */
89
90 .stack : ALIGN(4K)
91 {
92 /* Mark stack start. */
93 _sstack = .;
94 . = LENGTH(STACK);
95 /* Mark stack end. */
96 _estack = .;
97 } > STACK
98 }