-
Notifications
You must be signed in to change notification settings - Fork 0
/
linker.ld
95 lines (77 loc) · 1.93 KB
/
linker.ld
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
/* linker.ld: example linker script for STM32H563
* Copyright (C) 2023 Mete Balci
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
__FLASH_BASE = 0x08000000;
__FLASH_SIZE = 2048K;
__RAM_BASE = 0x20000000;
__RAM_SIZE = 640K;
/* heap is just after bss section */
__HEAP_SIZE = 1K;
/* stack is at the end of memory, growing down */
__STACK_SIZE = 1K;
/* No need to set an explicit entry point */
/* defaults to start of code section, .text, thus __FLASH_BASE */
/*ENTRY(Reset_Handler)*/
/* Memories */
/* org is shortcut for ORIGIN, len for LENGTH */
MEMORY
{
RAM (rwx) : org = __RAM_BASE, len = __RAM_SIZE
FLASH (rx) : org = __FLASH_BASE, len = __FLASH_SIZE
}
/* Sections */
SECTIONS
{
.text :
{
KEEP(*(.vectors))
*(.text*)
*(.rodata*)
. = ALIGN(4);
} >FLASH
_sidata = LOADADDR(.data);
.data :
{
. = ALIGN(4);
_sdata = .;
*(.data*)
. = ALIGN(4);
_edata = .;
} >RAM AT> FLASH
.bss :
{
. = ALIGN(4);
_sbss = .;
*(.bss*)
. = ALIGN(4);
_ebss = .;
/* end is used by _sbrk call in libnosys */
end = .;
} >RAM
.heap (COPY) :
{
. = ALIGN(4);
__end__ = .;
. = . + __HEAP_SIZE;
. = ALIGN(4);
__HeapLimit = .;
} > RAM
.stack (COPY) :
{
. = ALIGN(4);
__StackLimit = .;
. = . + __STACK_SIZE;
. = ALIGN(4);
__StackTop = .;
} > RAM
}