1/* 2 * Copyright (c) 2022 FuZhou Lockzhiner Electronic Co., Ltd. All rights reserved. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16#include "link.h" 17 18VENDOR_LOAD_ADDR = XIP_ADDR + FIRMWARE_VENDOR_OFFSET; 19VENDOR_LOAD_SIZE = FIRMWARE_WIFI_OFFSET - FIRMWARE_VENDOR_OFFSET; 20 21WIFI_LOAD_ADDR = VENDOR_LOAD_ADDR + VENDOR_LOAD_SIZE; 22WIFI_LOAD_SIZE = FIRMWARE_WIFI_SIZE; 23 24XIP_LOAD_ADDR = WIFI_LOAD_ADDR + WIFI_LOAD_SIZE; 25XIP_LOAD_SIZE = PART_LITEOS_BLOCKS * PART_BLOCK_SIZE - (XIP_LOAD_ADDR - XIP_ADDR); 26 27/* Entry Point */ 28ENTRY(Reset_Handler) 29 30/* Specify the memory areas */ 31MEMORY 32{ 33 SRAM_CODE (rwx) : ORIGIN = SRAM_CODE_ADDR, LENGTH = SRAM_CODE_SIZE 34 SRAM_DATA (rwx) : ORIGIN = SRAM_DATA_ADDR, LENGTH = SRAM_DATA_SIZE 35 PSRAM (rwx) : ORIGIN = PSRAM_ADDR, LENGTH = PSRAM_SIZE 36 VENDOR (rx) : ORIGIN = VENDOR_LOAD_ADDR, LENGTH = VENDOR_LOAD_SIZE 37 WIFI (rx) : ORIGIN = WIFI_LOAD_ADDR, LENGTH = WIFI_LOAD_SIZE 38 XIP (rx) : ORIGIN = XIP_LOAD_ADDR, LENGTH = XIP_LOAD_SIZE 39} 40 41SECTIONS 42{ 43 .isr.vector : 44 { 45 . = ALIGN(512); 46 KEEP(*(.isr_vector)) /* vector table */ 47 . = ALIGN(512); 48 *startup_rk2206.o (.text .text.*) 49 . = ALIGN(4); 50 } >VENDOR 51 52 .wifi_firmwave : 53 { 54 . = ALIGN(512); 55 KEEP(*(.wifi_firmwave)) /* wifi firmware */ 56 . = ALIGN(512); 57 . = ALIGN(4); 58 } >WIFI 59 60 /* zInit code and data - will be freed after init */ 61 .zInit : 62 { 63 __zinitcall_bsp_start = .; 64 KEEP (*(.zinitcall.bsp0.init)) 65 KEEP (*(.zinitcall.bsp1.init)) 66 KEEP (*(.zinitcall.bsp2.init)) 67 KEEP (*(.zinitcall.bsp3.init)) 68 KEEP (*(.zinitcall.bsp4.init)) 69 __zinitcall_bsp_end = .; 70 __zinitcall_device_start = .; 71 KEEP (*(.zinitcall.device0.init)) 72 KEEP (*(.zinitcall.device1.init)) 73 KEEP (*(.zinitcall.device2.init)) 74 KEEP (*(.zinitcall.device3.init)) 75 KEEP (*(.zinitcall.device4.init)) 76 __zinitcall_device_end = .; 77 __zinitcall_core_start = .; 78 KEEP (*(.zinitcall.core0.init)) 79 KEEP (*(.zinitcall.core1.init)) 80 KEEP (*(.zinitcall.core2.init)) 81 KEEP (*(.zinitcall.core3.init)) 82 KEEP (*(.zinitcall.core4.init)) 83 __zinitcall_core_end = .; 84 __zinitcall_sys_service_start = .; 85 KEEP (*(.zinitcall.sys.service0.init)) 86 KEEP (*(.zinitcall.sys.service1.init)) 87 KEEP (*(.zinitcall.sys.service2.init)) 88 KEEP (*(.zinitcall.sys.service3.init)) 89 KEEP (*(.zinitcall.sys.service4.init)) 90 __zinitcall_sys_service_end = .; 91 __zinitcall_sys_feature_start = .; 92 KEEP (*(.zinitcall.sys.feature0.init)) 93 KEEP (*(.zinitcall.sys.feature1.init)) 94 KEEP (*(.zinitcall.sys.feature2.init)) 95 KEEP (*(.zinitcall.sys.feature3.init)) 96 KEEP (*(.zinitcall.sys.feature4.init)) 97 __zinitcall_sys_feature_end = .; 98 __zinitcall_run_start = .; 99 KEEP (*(.zinitcall.run0.init)) 100 KEEP (*(.zinitcall.run1.init)) 101 KEEP (*(.zinitcall.run2.init)) 102 KEEP (*(.zinitcall.run3.init)) 103 KEEP (*(.zinitcall.run4.init)) 104 __zinitcall_run_end = .; 105 __zinitcall_app_service_start = .; 106 KEEP (*(.zinitcall.app.service0.init)) 107 KEEP (*(.zinitcall.app.service1.init)) 108 KEEP (*(.zinitcall.app.service2.init)) 109 KEEP (*(.zinitcall.app.service3.init)) 110 KEEP (*(.zinitcall.app.service4.init)) 111 __zinitcall_app_service_end = .; 112 __zinitcall_app_feature_start = .; 113 KEEP (*(.zinitcall.app.feature0.init)) 114 KEEP (*(.zinitcall.app.feature1.init)) 115 KEEP (*(.zinitcall.app.feature2.init)) 116 KEEP (*(.zinitcall.app.feature3.init)) 117 KEEP (*(.zinitcall.app.feature4.init)) 118 __zinitcall_app_feature_end = .; 119 __zinitcall_test_start = .; 120 KEEP (*(.zinitcall.test0.init)) 121 KEEP (*(.zinitcall.test1.init)) 122 KEEP (*(.zinitcall.test2.init)) 123 KEEP (*(.zinitcall.test3.init)) 124 KEEP (*(.zinitcall.test4.init)) 125 __zinitcall_test_end = .; 126 __zinitcall_exit_start = .; 127 KEEP (*(.zinitcall.exit0.init)) 128 KEEP (*(.zinitcall.exit1.init)) 129 KEEP (*(.zinitcall.exit2.init)) 130 KEEP (*(.zinitcall.exit3.init)) 131 KEEP (*(.zinitcall.exit4.init)) 132 __zinitcall_exit_end = .; 133 } >XIP 134 135 _shdf_text = .; 136 .hdf.text : 137 { 138 _hdf_text_start = .; 139 . = ALIGN(4); 140 *libhardware.a:*.o (.text .text.* .rodata .rodata*) 141 *libboard.a:*.o (.text .text.* .rodata .rodata*) 142 *libarch.a:*.o (.text .text.* .rodata .rodata*) 143 *libkernel.a:*.o (.text .text.* .rodata .rodata*) 144 *libgcc.a:*.o (.text .text.* .rodata .rodata*) 145 *libc.a:*.o (.text .text.* .rodata .rodata*) 146 *libcpup.a:*.o (.text .text.* .rodata .rodata*) 147 . = ALIGN(4); 148 _hdf_text_end = .; 149 } >SRAM_CODE AT >XIP 150 151 .hdf.driver : 152 { 153 _hdf_drivers_start = .; 154 . = ALIGN(4); 155 KEEP(*(.hdf.driver)) 156 . = ALIGN(4); 157 _hdf_drivers_end = .; 158 } >XIP 159 /* The program code and other data goes into FLASH */ 160 .text : 161 { 162 _stext = .; 163 . = ALIGN(4); 164 *(.text) /* .text sections (code) */ 165 *(.text*) /* .text* sections (code) */ 166 *(.glue_7) /* glue arm to thumb code */ 167 *(.glue_7t) /* glue thumb to arm code */ 168 *(.eh_frame) 169 170 KEEP (*(.init)) 171 KEEP (*(.fini)) 172 173 . = ALIGN(4); 174 _etext = .; /* define a global symbols at end of code */ 175 } >XIP 176 /* Constant data goes into FLASH */ 177 .rodata : 178 { 179 . = ALIGN(4); 180 *(.rodata) /* .rodata sections (constants, strings, etc.) */ 181 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ 182 . = ALIGN(4); 183 } >XIP 184 185 .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >XIP 186 .ARM : { 187 __exidx_start = .; 188 *(.ARM.exidx*) 189 __exidx_end = .; 190 } >XIP 191 192 _sdata = .; 193 /* Initialized data sections goes into RAM, load LMA copy after code */ 194 .data : 195 { 196 . = ALIGN(4); 197 _data_start = .; /* create a global symbol at data start */ 198 *(.data) /* .data sections */ 199 *(.data*) /* .data* sections */ 200 201 . = ALIGN(4); 202 _data_end = .; /* define a global symbol at data end */ 203 } >SRAM_DATA AT >XIP 204 205 /* Uninitialized data section */ 206 .bss : 207 { 208 /* This is used by the startup in order to initialize the .bss secion */ 209 . = ALIGN(4); 210 _bss_start = .; 211 *(.bss) 212 *(.bss*) 213 *(COMMON) 214 215 . = ALIGN(4); 216 _bss_end = .; 217 } >PSRAM 218 219 .stack : 220 { 221 . = ALIGN(8); 222 _sstack = .; 223 PROVIDE ( end = . ); 224 *(.stack*) 225 . = . + SYS_STACK_SIZE; 226 _estack = .; 227 PROVIDE(_StackTop = .); 228 . = ALIGN(8); 229 } >PSRAM 230 231 .heap : 232 { 233 . = ALIGN(8); 234 _heap_start = .; 235 . = ALIGN(8); 236 } >PSRAM 237 238 /* Remove information from the standard libraries */ 239 /DISCARD/ : 240 { 241 libc.a ( * ) 242 libm.a ( * ) 243 libgcc.a ( * ) 244 } 245 246 .ARM.attributes 0 : { *(.ARM.attributes) } 247} 248