summaryrefslogtreecommitdiff
path: root/ports/cortex_m55/gnu/example_build/sample_threadx.ld
blob: 107e0e41bf832f7e60a1a991b8e2b65152445df7 (plain)
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
MEMORY
{
  RAM (wx) : ORIGIN = 0x20000000, LENGTH = 0x00800000
  FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00400000
}

__STACKSIZE__ = 1024;
__STACKSIZE_PROCESS__ = 0;
__HEAPSIZE__ = 128;

SECTIONS
{
  .vectors :
  {
    KEEP(*(.vectors .vectors.*))
  } > FLASH

	.text :
	{
		__text_start__ = .;

		*(.text*)

		KEEP(*(.init))
		KEEP(*(.fini))

		/* .ctors */
		*crtbegin.o(.ctors)
		*crtbegin?.o(.ctors)
		*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
		__ctors_load_start__ = .;
		__ctors_start__ = ALIGN(4);
		*(SORT(.ctors.*))
		*(.ctors)
		__ctors_end__ = ALIGN(4);

		/* .dtors */
		*crtbegin.o(.dtors)
		*crtbegin?.o(.dtors)
		*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
		__dtors_load_start__ = .;
		__dtors_start__ = ALIGN(4);
		*(SORT(.dtors.*))
		*(.dtors)
		__dtors_end__ = ALIGN(4);

		KEEP(*(.eh_frame*))

		__text_end__ = ALIGN(4);
	} > FLASH

	__text_load_start__ = LOADADDR(.text);

	.rodata :
	{
		__rodata_start__ = .;
		*(.rodata*)
		__rodata_end__ = ALIGN(4);
	} > FLASH

	__rodata_load_start__ = LOADADDR(.rodata);

	.ARM.extab :
	{
		*(.ARM.extab* .gnu.linkonce.armextab.*)
	} > FLASH

	__exidx_start = .;
	.ARM.exidx :
	{
		*(.ARM.exidx* .gnu.linkonce.armexidx.*)
	} > FLASH
	__exidx_end = .;

	__data_load_start__ = ALIGN (4);

	/* Fast section: for time-critical code/data to be copied from FLASH to RAM at startup.
	   No .fast content in this sample; symbols defined so crt0 startup copy is a no-op. */
	.fast (NOLOAD) :
	{
		__fast_start__ = .;
		*(.fast*)
		__fast_end__ = .;
	} > RAM

	__fast_load_start__ = __fast_start__;

	.data : AT (__data_load_start__)
	{
		__data_start__ = .;

		*(vtable)
		*(.data*)

		. = ALIGN(4);
		/* preinit data */
		PROVIDE_HIDDEN (__preinit_array_start = .);
		KEEP(*(.preinit_array))
		PROVIDE_HIDDEN (__preinit_array_end = .);

		. = ALIGN(4);
		/* init data */
		PROVIDE_HIDDEN (__init_array_start = .);
		KEEP(*(SORT(.init_array.*)))
		KEEP(*(.init_array))
		PROVIDE_HIDDEN (__init_array_end = .);

		. = ALIGN(4);
		/* finit data */
		PROVIDE_HIDDEN (__fini_array_start = .);
		KEEP(*(SORT(.fini_array.*)))
		KEEP(*(.fini_array))
		PROVIDE_HIDDEN (__fini_array_end = .);

		KEEP(*(.jcr*))
		. = ALIGN(4);
		/* All data end */

    __data_end__ = .;

	} > RAM

	.bss :
	{
		. = ALIGN(4);
		__bss_start__ = .;
		*(.bss*)
		*(COMMON)
		. = ALIGN(4);
		__bss_end__ = .;

	} > RAM

	.heap (COPY):
	{
    __heap_start__ = ALIGN(4);
    *(.heap)
    . = ALIGN(. + __HEAPSIZE__, 4);
    __heap_end__ = ALIGN(4);
	} > RAM

  /* This port's tx.a carries tx_thread_secure_stack.c, which calls malloc and
     free. That pulls newlib's allocator, whose _sbrk takes the heap base from
     "end". The Cortex-M3, M4 and M7 examples never reference the allocator, so
     their linker scripts do not define it and this section is the difference. */

  PROVIDE(end  = __heap_start__);
  PROVIDE(_end = __heap_start__);

  /* picolibc, which Arm Toolchain for Embedded ships, takes the heap bounds
     from __heap_start and __heap_end instead of from end. */

  PROVIDE(__heap_start = __heap_start__);
  PROVIDE(__heap_end   = __heap_end__);

  .stack ALIGN(4) (NOLOAD) :
  {
    __stack_start__ = ALIGN(4);
    *(.stack)
    . = ALIGN(. + __STACKSIZE__, 4);
    __stack_end__ = ALIGN(4);
  } > RAM

  __RAM_segment_used_end__ = .;
}