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