-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathneotron-cortex-m.ld
103 lines (92 loc) · 2.46 KB
/
neotron-cortex-m.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
95
96
97
98
99
100
101
102
103
/*
* Neotron Application linker script for Arm Cortex-M systems.
*
* Based on the [Rust Embedded Cortex-M crate](https://github.com/rust-embedded/cortex-m).
*
* Copyright (c) 2016 Jorge Aparicio.
* Copyright (c) 2024 Jonathan 'theJPster' Pallant and the Neotron Developers.
*/
MEMORY
{
/*
* This is the Transient Program Area.
*
* This is defined by the Neotron specification for a given platform. On this
* Cortex-M based platform, it's the start of Cortex-M SRAM, plus 4 KiB, or
* 0x2000_1000.
*/
RAM (rwx) : ORIGIN = 0x20001000, LENGTH = 256K
}
/* # Entry point = what the BIOS calls to start the OS */
EXTERN(app_entry);
ENTRY(app_entry);
/* # Sections */
SECTIONS
{
/* ## .text */
/* All the executable code for our program */
.text : ALIGN(4)
{
. = ALIGN(4);
*(.text .text.*);
. = ALIGN(4);
} > RAM
/* ## .rodata */
/* All the read-only static data for our program */
.rodata : ALIGN(4)
{
. = ALIGN(4);
*(.rodata .rodata.*);
. = ALIGN(4);
} > RAM
/* ## .data */
/* All the read-write non-zero-initialised static data for our program */
.data : ALIGN(4)
{
. = ALIGN(4);
*(.data .data.*);
. = ALIGN(4);
} > RAM
/* ## .bss */
/* All the read-write zero-initialised static data for our program */
.bss : ALIGN(4)
{
. = ALIGN(4);
*(.bss .bss.*);
. = ALIGN(4);
} > RAM
/* ## .uninit */
/* All the read-write uninitialised static data for our program */
.uninit (NOLOAD) : ALIGN(4)
{
. = ALIGN(4);
*(.uninit .uninit.*);
. = ALIGN(4);
} > RAM
/* ## Start of Heap */
/* Newlib's `sbrk` syscall uses the `end` symbol to mark the start of heap
memory. The `sbrk` syscall has a static variable tracking the edge of the
heap (`heap_end`) and that value moves upwards as more heap memory is
required. The `heap_end` value is initialised with the address of the `end`
symbol on first allocation.
See https://github.com/bminor/newlib/blob/master/libgloss/libnosys/sbrk.c
*/
. = ALIGN(4);
end = .;
/* ## .got */
/* 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 (NOLOAD) :
{
KEEP(*(.got .got.*));
}
/* ## Discarded sections */
/DISCARD/ :
{
/* Unused exception related info that only wastes space */
*(.ARM.exidx);
*(.ARM.exidx.*);
*(.ARM.extab.*);
}
}