1/*
2 * Linker Script for Tigerlake Bootloader.
3 *
4 * This script is run through the GNU C preprocessor to align the memory
5 * offsets with headers.
6 *
7 * Use spaces for formatting as cpp ignore tab sizes.
8 */
9
10
11#include <sof/lib/memory.h>
12#include <xtensa/config/core-isa.h>
13
14OUTPUT_ARCH(xtensa)
15
16MEMORY
17{
18  vector_reset_text :
19        org = ROM_BASE,
20        len = ROM_RESET_TEXT_SIZE
21  vector_reset_lit :
22        org = ROM_BASE + ROM_RESET_TEXT_SIZE,
23        len = ROM_RESET_LIT_SIZE
24  vector_base_text :
25	org = ROM_BASE + ROM_RESET_TEXT_SIZE + ROM_RESET_LIT_SIZE,
26        len = SOF_MEM_VECBASE_LIT_SIZE
27  vector_int2_lit :
28        org = ROM_BASE + XCHAL_INTLEVEL2_VECOFS - SOF_MEM_VECT_LIT_SIZE,
29        len = SOF_MEM_VECT_LIT_SIZE
30  vector_int2_text :
31        org = ROM_BASE + XCHAL_INTLEVEL2_VECOFS,
32        len = SOF_MEM_VECT_TEXT_SIZE
33  vector_int3_lit :
34        org = ROM_BASE + XCHAL_INTLEVEL3_VECOFS - SOF_MEM_VECT_LIT_SIZE,
35        len = SOF_MEM_VECT_LIT_SIZE
36  vector_int3_text :
37        org = ROM_BASE + XCHAL_INTLEVEL3_VECOFS,
38        len = SOF_MEM_VECT_TEXT_SIZE
39  vector_int4_lit :
40        org = ROM_BASE + XCHAL_INTLEVEL4_VECOFS - SOF_MEM_VECT_LIT_SIZE,
41        len = SOF_MEM_VECT_LIT_SIZE
42  vector_int4_text :
43        org = ROM_BASE + XCHAL_INTLEVEL4_VECOFS,
44        len = SOF_MEM_VECT_TEXT_SIZE
45  vector_int5_lit :
46        org = ROM_BASE + XCHAL_INTLEVEL5_VECOFS - SOF_MEM_VECT_LIT_SIZE,
47        len = SOF_MEM_VECT_LIT_SIZE
48  vector_int5_text :
49        org = ROM_BASE + XCHAL_INTLEVEL5_VECOFS,
50        len = SOF_MEM_VECT_TEXT_SIZE
51  vector_int6_lit :
52        org = ROM_BASE + XCHAL_INTLEVEL6_VECOFS - SOF_MEM_VECT_LIT_SIZE,
53        len = SOF_MEM_VECT_LIT_SIZE
54  vector_int6_text :
55        org = ROM_BASE + XCHAL_INTLEVEL6_VECOFS,
56        len = SOF_MEM_VECT_TEXT_SIZE
57  vector_int7_lit :
58        org = ROM_BASE + XCHAL_INTLEVEL7_VECOFS - SOF_MEM_VECT_LIT_SIZE,
59        len = SOF_MEM_VECT_LIT_SIZE
60  vector_int7_text :
61        org = ROM_BASE + XCHAL_INTLEVEL7_VECOFS,
62        len = SOF_MEM_VECT_TEXT_SIZE
63  vector_kernel_lit :
64        org = ROM_BASE + XCHAL_KERNEL_VECOFS - SOF_MEM_VECT_LIT_SIZE,
65        len = SOF_MEM_VECT_LIT_SIZE
66  vector_kernel_text :
67        org = ROM_BASE + XCHAL_KERNEL_VECOFS,
68        len = SOF_MEM_VECT_TEXT_SIZE
69  vector_user_lit :
70        org = ROM_BASE + XCHAL_USER_VECOFS - SOF_MEM_VECT_LIT_SIZE,
71        len = SOF_MEM_VECT_LIT_SIZE
72  vector_user_text :
73        org = ROM_BASE + XCHAL_USER_VECOFS,
74        len = SOF_MEM_VECT_TEXT_SIZE
75  vector_double_lit :
76        org = ROM_BASE + XCHAL_DOUBLEEXC_VECOFS - SOF_MEM_VECT_LIT_SIZE,
77        len = SOF_MEM_VECT_LIT_SIZE
78  vector_double_text :
79        org = ROM_BASE + XCHAL_DOUBLEEXC_VECOFS,
80        len = SOF_MEM_VECT_TEXT_SIZE
81  sof_text :
82	org = ROM_BASE + 0x800,
83        len = ROM_SIZE,
84  sof_stack :
85        org = BOOT_LDR_STACK_BASE,
86        len = BOOT_LDR_STACK_SIZE
87}
88
89PHDRS
90{
91  vector_reset_text_phdr PT_LOAD;
92  vector_reset_lit_phdr PT_LOAD;
93  vector_base_text_phdr PT_LOAD;
94  vector_int2_lit_phdr PT_LOAD;
95  vector_int2_text_phdr PT_LOAD;
96  vector_int3_lit_phdr PT_LOAD;
97  vector_int3_text_phdr PT_LOAD;
98  vector_int4_lit_phdr PT_LOAD;
99  vector_int4_text_phdr PT_LOAD;
100  vector_int5_lit_phdr PT_LOAD;
101  vector_int5_text_phdr PT_LOAD;
102  vector_int6_lit_phdr PT_LOAD;
103  vector_int6_text_phdr PT_LOAD;
104  vector_int7_lit_phdr PT_LOAD;
105  vector_int7_text_phdr PT_LOAD;
106  vector_kernel_lit_phdr PT_LOAD;
107  vector_kernel_text_phdr PT_LOAD;
108  vector_user_lit_phdr PT_LOAD;
109  vector_user_text_phdr PT_LOAD;
110  vector_double_lit_phdr PT_LOAD;
111  vector_double_text_phdr PT_LOAD;
112  sof_text_phdr PT_LOAD;
113  sof_stack_phdr PT_LOAD;
114}
115
116_rom_store_table = 0;
117
118/* ABI0 does not use Window base */
119PROVIDE(_memmap_vecbase_reset = ROM_BASE);
120
121/* Various memory-map dependent cache attribute settings: */
122_memmap_cacheattr_wbna_trapnull = 0xFF42FFF2;
123PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wbna_trapnull);
124
125SECTIONS
126{
127 .ResetVector.text : ALIGN(4)
128  {
129    _ResetVector_text_start = ABSOLUTE(.);
130    KEEP (*(.ResetVector.text))
131    _ResetVector_text_end = ABSOLUTE(.);
132  } >vector_reset_text :vector_reset_text_phdr
133
134  .ResetVector.literal : ALIGN(4)
135  {
136    _ResetVector_literal_start = ABSOLUTE(.);
137    *(.ResetVector.literal)
138    _ResetVector_literal_end = ABSOLUTE(.);
139  } >vector_reset_lit :vector_reset_lit_phdr
140
141  .WindowVectors.text : ALIGN(4)
142  {
143    _WindowVectors_text_start = ABSOLUTE(.);
144    KEEP (*(.WindowVectors.text))
145    _WindowVectors_text_end = ABSOLUTE(.);
146  } >vector_base_text :vector_base_text_phdr
147
148  .Level2InterruptVector.literal : ALIGN(4)
149  {
150    _Level2InterruptVector_literal_start = ABSOLUTE(.);
151    *(.Level2InterruptVector.literal)
152    _Level2InterruptVector_literal_end = ABSOLUTE(.);
153  } >vector_int2_lit :vector_int2_lit_phdr
154
155  .Level2InterruptVector.text : ALIGN(4)
156  {
157    _Level2InterruptVector_text_start = ABSOLUTE(.);
158    KEEP (*(.Level2InterruptVector.text))
159    _Level2InterruptVector_text_end = ABSOLUTE(.);
160  } >vector_int2_text :vector_int2_text_phdr
161
162  .Level3InterruptVector.literal : ALIGN(4)
163  {
164    _Level3InterruptVector_literal_start = ABSOLUTE(.);
165    *(.Level3InterruptVector.literal)
166    _Level3InterruptVector_literal_end = ABSOLUTE(.);
167  } >vector_int3_lit :vector_int3_lit_phdr
168
169  .Level3InterruptVector.text : ALIGN(4)
170  {
171    _Level3InterruptVector_text_start = ABSOLUTE(.);
172    KEEP (*(.Level3InterruptVector.text))
173    _Level3InterruptVector_text_end = ABSOLUTE(.);
174  } >vector_int3_text :vector_int3_text_phdr
175
176  .Level4InterruptVector.literal : ALIGN(4)
177  {
178    _Level4InterruptVector_literal_start = ABSOLUTE(.);
179    *(.Level4InterruptVector.literal)
180    _Level4InterruptVector_literal_end = ABSOLUTE(.);
181  } >vector_int4_lit :vector_int4_lit_phdr
182
183  .Level4InterruptVector.text : ALIGN(4)
184  {
185    _Level4InterruptVector_text_start = ABSOLUTE(.);
186    KEEP (*(.Level4InterruptVector.text))
187    _Level4InterruptVector_text_end = ABSOLUTE(.);
188  } >vector_int4_text :vector_int4_text_phdr
189
190  .Level5InterruptVector.literal : ALIGN(4)
191  {
192    _Level5InterruptVector_literal_start = ABSOLUTE(.);
193    *(.Level5InterruptVector.literal)
194    _Level5InterruptVector_literal_end = ABSOLUTE(.);
195  } >vector_int5_lit :vector_int5_lit_phdr
196
197  .Level5InterruptVector.text : ALIGN(4)
198  {
199    _Level5InterruptVector_text_start = ABSOLUTE(.);
200    KEEP (*(.Level5InterruptVector.text))
201    _Level5InterruptVector_text_end = ABSOLUTE(.);
202  } >vector_int5_text :vector_int5_text_phdr
203
204  .DebugExceptionVector.literal : ALIGN(4)
205  {
206    _DebugExceptionVector_literal_start = ABSOLUTE(.);
207    *(.DebugExceptionVector.literal)
208    _DebugExceptionVector_literal_end = ABSOLUTE(.);
209  } >vector_int6_lit :vector_int6_lit_phdr
210
211  .DebugExceptionVector.text : ALIGN(4)
212  {
213    _DebugExceptionVector_text_start = ABSOLUTE(.);
214    KEEP (*(.DebugExceptionVector.text))
215    _DebugExceptionVector_text_end = ABSOLUTE(.);
216  } >vector_int6_text :vector_int6_text_phdr
217
218  .NMIExceptionVector.literal : ALIGN(4)
219  {
220    _NMIExceptionVector_literal_start = ABSOLUTE(.);
221    *(.NMIExceptionVector.literal)
222    _NMIExceptionVector_literal_end = ABSOLUTE(.);
223  } >vector_int7_lit :vector_int7_lit_phdr
224
225  .NMIExceptionVector.text : ALIGN(4)
226  {
227    _NMIExceptionVector_text_start = ABSOLUTE(.);
228    KEEP (*(.NMIExceptionVector.text))
229    _NMIExceptionVector_text_end = ABSOLUTE(.);
230  } >vector_int7_text :vector_int7_text_phdr
231
232  .KernelExceptionVector.literal : ALIGN(4)
233  {
234    _KernelExceptionVector_literal_start = ABSOLUTE(.);
235    *(.KernelExceptionVector.literal)
236    _KernelExceptionVector_literal_end = ABSOLUTE(.);
237  } >vector_kernel_lit :vector_kernel_lit_phdr
238
239  .KernelExceptionVector.text : ALIGN(4)
240  {
241    _KernelExceptionVector_text_start = ABSOLUTE(.);
242    KEEP (*(.KernelExceptionVector.text))
243    _KernelExceptionVector_text_end = ABSOLUTE(.);
244  } >vector_kernel_text :vector_kernel_text_phdr
245
246  .UserExceptionVector.literal : ALIGN(4)
247  {
248    _UserExceptionVector_literal_start = ABSOLUTE(.);
249    *(.UserExceptionVector.literal)
250    _UserExceptionVector_literal_end = ABSOLUTE(.);
251  } >vector_user_lit :vector_user_lit_phdr
252
253  .UserExceptionVector.text : ALIGN(4)
254  {
255    _UserExceptionVector_text_start = ABSOLUTE(.);
256    KEEP (*(.UserExceptionVector.text))
257    _UserExceptionVector_text_end = ABSOLUTE(.);
258  } >vector_user_text :vector_user_text_phdr
259
260  .DoubleExceptionVector.literal : ALIGN(4)
261  {
262    _DoubleExceptionVector_literal_start = ABSOLUTE(.);
263    *(.DoubleExceptionVector.literal)
264    _DoubleExceptionVector_literal_end = ABSOLUTE(.);
265  } >vector_double_lit :vector_double_lit_phdr
266
267  .DoubleExceptionVector.text : ALIGN(4)
268  {
269    _DoubleExceptionVector_text_start = ABSOLUTE(.);
270    KEEP (*(.DoubleExceptionVector.text))
271    _DoubleExceptionVector_text_end = ABSOLUTE(.);
272  } >vector_double_text :vector_double_text_phdr
273
274  .text : ALIGN(4)
275  {
276    _stext = .;
277    _text_start = ABSOLUTE(.);
278    KEEP (*(.MainEntry.text))
279    *(.entry.text)
280    *(.init.literal)
281    KEEP(*(.init))
282    *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
283    *(.fini.literal)
284    KEEP(*(.fini))
285    *(.gnu.version)
286    _text_end = ABSOLUTE(.);
287    _etext = .;
288  } >sof_text :sof_text_phdr
289
290  /* stack */
291  _end = BOOT_LDR_STACK_BASE;
292  PROVIDE(end = BOOT_LDR_STACK_BASE);
293  _stack_sentry = BOOT_LDR_STACK_BASE;
294  __stack = BOOT_LDR_STACK_BASE + BOOT_LDR_STACK_SIZE;
295
296  .debug  0 :  { *(.debug) }
297  .line  0 :  { *(.line) }
298  .debug_srcinfo  0 :  { *(.debug_srcinfo) }
299  .debug_sfnames  0 :  { *(.debug_sfnames) }
300  .debug_aranges  0 :  { *(.debug_aranges) }
301  .debug_pubnames  0 :  { *(.debug_pubnames) }
302  .debug_info  0 :  { *(.debug_info) }
303  .debug_abbrev  0 :  { *(.debug_abbrev) }
304  .debug_line  0 :  { *(.debug_line) }
305  .debug_frame  0 :  { *(.debug_frame) }
306  .debug_str  0 :  { *(.debug_str) }
307  .debug_loc  0 :  { *(.debug_loc) }
308  .debug_macinfo  0 :  { *(.debug_macinfo) }
309  .debug_weaknames  0 :  { *(.debug_weaknames) }
310  .debug_funcnames  0 :  { *(.debug_funcnames) }
311  .debug_typenames  0 :  { *(.debug_typenames) }
312  .debug_varnames  0 :  { *(.debug_varnames) }
313
314  .xt.insn 0 :
315  {
316    KEEP (*(.xt.insn))
317    KEEP (*(.gnu.linkonce.x.*))
318  }
319  .xt.prop 0 :
320  {
321    KEEP (*(.xt.prop))
322    KEEP (*(.xt.prop.*))
323    KEEP (*(.gnu.linkonce.prop.*))
324  }
325  .xt.lit 0 :
326  {
327    KEEP (*(.xt.lit))
328    KEEP (*(.xt.lit.*))
329    KEEP (*(.gnu.linkonce.p.*))
330  }
331  .xt.profile_range 0 :
332  {
333    KEEP (*(.xt.profile_range))
334    KEEP (*(.gnu.linkonce.profile_range.*))
335  }
336  .xt.profile_ranges 0 :
337  {
338    KEEP (*(.xt.profile_ranges))
339    KEEP (*(.gnu.linkonce.xt.profile_ranges.*))
340  }
341  .xt.profile_files 0 :
342  {
343    KEEP (*(.xt.profile_files))
344    KEEP (*(.gnu.linkonce.xt.profile_files.*))
345  }
346}
347
348