-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstmf103.ld
86 lines (71 loc) · 2.18 KB
/
stmf103.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
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 64K /*adjust for correct amount of memory*/
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
}
/*This code already defines _start as reset handler*/
/* Set stack start to the end of RAM (stack grows from high memory addresses -> low) */
PROVIDE(__stack = ORIGIN(RAM) + LENGTH(RAM));
SECTIONS
{
/* Ensuring our vector table is placed at the beginning of FLASH */
.isr_vector :
{
. = ALIGN(4);
KEEP(*(.isr_vector))
. = ALIGN(4);
} >FLASH
/* Program code and other data goes into FLASH */
.text :
{
. = ALIGN(4);
*(.text)
*(.text*)
*(.glue_7) /* glue arm to thumb code, TODO: Likely not required if not mixing thumb/arm ISAs */
*(.glue_7t) /* glue thumb to arm code, TODO: Likely not required if not mixing thumb/arm ISAs */
. = ALIGN(4);
} >FLASH
/* Constant data */
.rodata :
{
. = ALIGN(4);
*(.rodata)
*(.rodata*)
. = ALIGN(4);
} >FLASH
/* Special ARM debug info */
/* TODO: Not sure precisely what this does */
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
.ARM : {
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
} >FLASH
/* Loads the FLASH (LOAD) address that holds initalization data */
_sidata = LOADADDR(.data);
/* Specifies that initialization data is stored in FLASH (LMA), but has an associated location in RAM (VMA) */
/* Startup code will copy initalization data from FLASH to RAM */
.data :
{
. = ALIGN(4);
_sdata = .; /* create a global symbol at data start */
*(.data)
*(.data*)
. = ALIGN(4);
_edata = .; /* define a global symbol at data end */
} >RAM AT> FLASH
/* Uninitialized data section, startup code will set this to all 0 */
. = ALIGN(4);
.bss :
{
/* This is used by the startup in order to initialize the .bss secion */
_sbss = .; /* define a global symbol at bss start */
*(.bss)
*(.bss*)
*(COMMON)
. = ALIGN(4);
_ebss = .; /* define a global symbol at bss end */
} >RAM
/* TODO: Not sure precisely what this does */
.ARM.attributes 0 : { *(.ARM.attributes) }
}