-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathlink.x.in
99 lines (83 loc) · 3 KB
/
link.x.in
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
INCLUDE memory.x
/* Entry point */
ENTRY(Reset);
EXTERN(__RESET_VECTOR);
/* Create an undefined reference to the INTERRUPTS symbol. This is required to
force the linker to *not* drop the INTERRUPTS symbol if it comes from an
object file that's passed to the linker *before* this crate */
EXTERN(__INTERRUPTS);
/* # Pre-initialization function */
/* If the user overrides this using the `pre_init!` macro or by creating a `__pre_init` function,
then the function this points to will be called before the RAM is initialized. */
PROVIDE(PreInit = PreInit_);
/* # Default interrupt handler */
EXTERN(DefaultHandler); /* If this line is not here, all unused interrupt
handlers will be zeroed out instead of doing
to the DefaultHandler! */
PROVIDE(DefaultHandler = DefaultHandler_);
/* XXX Are there use cases for making this user overridable? */
_stack_start = ORIGIN(RAM) + LENGTH(RAM);
SECTIONS
{
.vector_table ORIGIN(VECTORS) : ALIGN(2)
{
KEEP(*(.vector_table.interrupts));
KEEP(*(.__RESET_VECTOR));
} > VECTORS
.text ORIGIN(ROM) :
{
/* Put the reset handler at the beginning of the .text section */
KEEP(*(.Reset));
*(.text .text.*);
} > ROM
.rodata : ALIGN(2)
{
*(.rodata .rodata.*);
. = ALIGN(2);
} > ROM
.bss : ALIGN(2)
{
_sbss = .;
*(.bss .bss.*);
. = ALIGN(2);
_ebss = .;
} > RAM
.data : ALIGN(2)
{
_sidata = LOADADDR(.data);
_sdata = .;
*(.data .data.*);
. = ALIGN(2);
_edata = .;
} > RAM AT > ROM
/* fake output .got section */
/* Dynamic relocations are unsupported. This section is only used to detect
relocatable code in the input files and raise an error if relocatable code
is found */
.got :
{
_sgot = .;
KEEP(*(.got .got.*));
_egot = .;
} > RAM AT > ROM
/* The heap starts right after the .bss + .data section ends */
_sheap = _edata;
}
/* Do not exceed this mark in the error messages below | */
ASSERT(ORIGIN(VECTORS) + LENGTH(VECTORS) == 0x10000, "
ERROR(msp430-rt): The VECTORS memory region must end at address 0x10000. Check memory.x");
ASSERT(ADDR(.vector_table) + SIZEOF(.vector_table) == 0x10000, "
ERROR(msp430-rt): .vector_table is shorter than expected.
Possible solutions, from most likely to less likely:
- Link to a svd2rust generated pac crate, if you are not
- Fix _sinterrupts in memory.x; it doesn't match the number of interrupts provided by the
pac crate
- Disable the 'device' feature of msp430-rt to build a generic application; a dependency
may be enabling it
");
ASSERT(_sgot == _egot, "
ERROR(msp430-rt): .got section detected in the input object files
Dynamic relocations are not supported. If you are linking to C code compiled using
the 'cc' crate then modify your build script to compile the C code _without_
the -fPIC flag. See the documentation of the `cc::Build.pic` method for details.");
/* Do not exceed this mark in the error messages above | */