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  boot_entry_text :
19        org = IMR_BOOT_LDR_TEXT_ENTRY_BASE,
20        len = IMR_BOOT_LDR_TEXT_ENTRY_SIZE
21  boot_entry_lit :
22        org = IMR_BOOT_LDR_LIT_BASE,
23        len = IMR_BOOT_LDR_LIT_SIZE
24  sof_text :
25        org = IMR_BOOT_LDR_TEXT_BASE,
26        len = IMR_BOOT_LDR_TEXT_SIZE,
27  sof_data :
28        org = IMR_BOOT_LDR_DATA_BASE,
29        len = IMR_BOOT_LDR_DATA_SIZE
30  sof_bss_data :
31        org = IMR_BOOT_LDR_BSS_BASE,
32        len = IMR_BOOT_LDR_BSS_SIZE
33  sof_stack :
34        org = BOOT_LDR_STACK_BASE,
35        len = BOOT_LDR_STACK_SIZE
36  wnd0 :
37        org = HP_SRAM_WIN0_BASE,
38        len = HP_SRAM_WIN0_SIZE
39  lpsram_mem :
40        org = LP_SRAM_BASE,
41        len = LP_SRAM_SIZE
42}
43
44PHDRS
45{
46  boot_entry_text_phdr PT_LOAD;
47  boot_entry_lit_phdr PT_LOAD;
48  sof_text_phdr PT_LOAD;
49  sof_data_phdr PT_LOAD;
50  sof_bss_data_phdr PT_LOAD;
51  sof_stack_phdr PT_LOAD;
52  wnd0_phdr PT_LOAD;
53  lpsram_mem_phdr PT_LOAD;
54}
55
56/*  Default entry point:  */
57ENTRY(boot_entry)
58EXTERN(reset_vector)
59
60SECTIONS
61{
62  .boot_entry.text : ALIGN(4)
63  {
64    _boot_entry_text_start = ABSOLUTE(.);
65    KEEP (*(.boot_entry.text))
66    _boot_entry_text_end = ABSOLUTE(.);
67  } >boot_entry_text :boot_entry_text_phdr
68
69  .boot_entry.literal : ALIGN(4)
70  {
71    _boot_entry_literal_start = ABSOLUTE(.);
72    *(.boot_entry.literal)
73    *(.literal .literal.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
74    _boot_entry_literal_end = ABSOLUTE(.);
75  } >boot_entry_lit :boot_entry_lit_phdr
76
77  .text : ALIGN(4)
78  {
79    _stext = .;
80    _text_start = ABSOLUTE(.);
81    *(.entry.text)
82    *(.init.literal)
83    KEEP(*(.init))
84    *( .text .text.*)
85    *(.fini.literal)
86    KEEP(*(.fini))
87    *(.gnu.version)
88    KEEP (*(.ResetVector.text))
89    KEEP (*(.ResetHandler.text))
90    _text_end = ABSOLUTE(.);
91    _etext = .;
92  } >sof_text :sof_text_phdr
93
94  .rodata : ALIGN(4)
95  {
96    _rodata_start = ABSOLUTE(.);
97    *(.rodata)
98    *(.rodata.*)
99    *(.gnu.linkonce.r.*)
100    *(.rodata1)
101    __XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
102    KEEP (*(.xt_except_table))
103    KEEP (*(.gcc_except_table))
104    *(.gnu.linkonce.e.*)
105    *(.gnu.version_r)
106    KEEP (*(.eh_frame))
107    /*  C++ constructor and destructor tables, properly ordered:  */
108    KEEP (*crtbegin.o(.ctors))
109    KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
110    KEEP (*(SORT(.ctors.*)))
111    KEEP (*(.ctors))
112    KEEP (*crtbegin.o(.dtors))
113    KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
114    KEEP (*(SORT(.dtors.*)))
115    KEEP (*(.dtors))
116    /*  C++ exception handlers table:  */
117    __XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
118    *(.xt_except_desc)
119    *(.gnu.linkonce.h.*)
120    __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
121    *(.xt_except_desc_end)
122    *(.dynamic)
123    *(.gnu.version_d)
124    . = ALIGN(4);		/* this table MUST be 4-byte aligned */
125    _bss_table_start = ABSOLUTE(.);
126    LONG(_bss_start)
127    LONG(_bss_end)
128    _bss_table_end = ABSOLUTE(.);
129    _rodata_end = ABSOLUTE(.);
130  } >sof_data :sof_data_phdr
131
132  .data : ALIGN(4)
133  {
134    _data_start = ABSOLUTE(.);
135    *(.data)
136    *(.data.*)
137    *(.gnu.linkonce.d.*)
138    KEEP(*(.gnu.linkonce.d.*personality*))
139    *(.data1)
140    *(.sdata)
141    *(.sdata.*)
142    *(.gnu.linkonce.s.*)
143    *(.sdata2)
144    *(.sdata2.*)
145    *(.gnu.linkonce.s2.*)
146    KEEP(*(.jcr))
147    _data_end = ABSOLUTE(.);
148  } >sof_data :sof_data_phdr
149
150  .lit4 : ALIGN(4)
151  {
152    _lit4_start = ABSOLUTE(.);
153    *(*.lit4)
154    *(.lit4.*)
155    *(.gnu.linkonce.lit4.*)
156    _lit4_end = ABSOLUTE(.);
157  } >sof_data :sof_data_phdr
158
159  .bss (NOLOAD) : ALIGN(8)
160  {
161    . = ALIGN (8);
162    _bss_start = ABSOLUTE(.);
163    *(.dynsbss)
164    *(.sbss)
165    *(.sbss.*)
166    *(.gnu.linkonce.sb.*)
167    *(.scommon)
168    *(.sbss2)
169    *(.sbss2.*)
170    *(.gnu.linkonce.sb2.*)
171    *(.dynbss)
172    *(.bss)
173    *(.bss.*)
174    *(.gnu.linkonce.b.*)
175    *(COMMON)
176    . = ALIGN (8);
177    _bss_end = ABSOLUTE(.);
178  } >sof_bss_data :sof_bss_data_phdr
179
180 _man = 0x1234567;
181
182  PROVIDE(_memmap_vecbase_reset = HP_SRAM_VECBASE_RESET);
183
184  _memmap_cacheattr_wbna_trapnull = 0xFF42FFF2;
185  PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wbna_trapnull);
186
187  __stack = BOOT_LDR_STACK_BASE + BOOT_LDR_STACK_SIZE;
188  __wnd0 = HP_SRAM_WIN0_BASE;
189  __wnd0_size = HP_SRAM_WIN0_SIZE;
190
191  .debug  0 :  { *(.debug) }
192  .line  0 :  { *(.line) }
193  .debug_srcinfo  0 :  { *(.debug_srcinfo) }
194  .debug_sfnames  0 :  { *(.debug_sfnames) }
195  .debug_aranges  0 :  { *(.debug_aranges) }
196  .debug_pubnames  0 :  { *(.debug_pubnames) }
197  .debug_info  0 :  { *(.debug_info) }
198  .debug_abbrev  0 :  { *(.debug_abbrev) }
199  .debug_line  0 :  { *(.debug_line) }
200  .debug_frame  0 :  { *(.debug_frame) }
201  .debug_str  0 :  { *(.debug_str) }
202  .debug_loc  0 :  { *(.debug_loc) }
203  .debug_macinfo  0 :  { *(.debug_macinfo) }
204  .debug_weaknames  0 :  { *(.debug_weaknames) }
205  .debug_funcnames  0 :  { *(.debug_funcnames) }
206  .debug_typenames  0 :  { *(.debug_typenames) }
207  .debug_varnames  0 :  { *(.debug_varnames) }
208
209  .xt.insn 0 :
210  {
211    KEEP (*(.xt.insn))
212    KEEP (*(.gnu.linkonce.x.*))
213  }
214  .xt.prop 0 :
215  {
216    KEEP (*(.xt.prop))
217    KEEP (*(.xt.prop.*))
218    KEEP (*(.gnu.linkonce.prop.*))
219  }
220  .xt.lit 0 :
221  {
222    KEEP (*(.xt.lit))
223    KEEP (*(.xt.lit.*))
224    KEEP (*(.gnu.linkonce.p.*))
225  }
226  .xt.profile_range 0 :
227  {
228    KEEP (*(.xt.profile_range))
229    KEEP (*(.gnu.linkonce.profile_range.*))
230  }
231  .xt.profile_ranges 0 :
232  {
233    KEEP (*(.xt.profile_ranges))
234    KEEP (*(.gnu.linkonce.xt.profile_ranges.*))
235  }
236  .xt.profile_files 0 :
237  {
238    KEEP (*(.xt.profile_files))
239    KEEP (*(.gnu.linkonce.xt.profile_files.*))
240  }
241  .lpsram(NOLOAD) : ALIGN(8)
242  {
243    _lpsram_start = ABSOLUTE(.);
244    KEEP (*(*.lpsram))
245    _lpsram_end = ABSOLUTE(.);
246  } >lpsram_mem :lpsram_mem_phdr
247}
248