1/****************************************************************************** 2 * Copyright (c) 2022 Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 3 * All rights reserved. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 *****************************************************************************/ 18 19ENTRY(_RESET_ENTRY) 20SECTIONS 21{ 22 NDS_SAG_LMA_FLASH = 0x20000000 ; 23 . = 0x20000000; 24 PROVIDE (BIN_BEGIN = .); 25 .vectors : { KEEP(*(.vectors )) } 26 . = 0x00000000; 27 .retention_reset : AT( ALIGN(LOADADDR (.vectors) + SIZEOF (.vectors),8)) 28 { KEEP(*(.retention_reset )) } 29 PROVIDE (_RETENTION_RESET_VMA_START = ADDR(.retention_reset)); 30 PROVIDE (_RETENTION_RESET_LMA_START = LOADADDR(.retention_reset)); 31 PROVIDE (_RETENTION_RESET_VMA_END = .); 32 /* By default,the aes_data section can only be used in the first 64K of IRAM, */ 33 /* please do not change the position of this section,unless you know the correct way to use */ 34 . = ALIGN(8); 35 PROVIDE (_AES_VMA_START = .); 36 .aes_data (NOLOAD) : { KEEP(*(.aes_data )) } 37 PROVIDE (_AES_VMA_END = .); 38 . = ALIGN(8); 39 .retention_data : AT( ALIGN(LOADADDR (.retention_reset) + SIZEOF (.retention_reset),8)) 40 { KEEP(*(.retention_data )) } 41 PROVIDE (_RETENTION_DATA_VMA_START = ADDR(.retention_data)); 42 PROVIDE (_RETENTION_DATA_LMA_START = LOADADDR(.retention_data)); 43 PROVIDE (_RETENTION_DATA_VMA_END = .); 44 45 . = ALIGN(8); 46 .ram_code : AT( ALIGN(LOADADDR (.retention_data) + SIZEOF (.retention_data),8)) 47 { KEEP(*(.ram_code )) } 48 PROVIDE (_RAMCODE_VMA_END = .); 49 PROVIDE (_RAMCODE_VMA_START = ADDR(.ram_code)); 50 PROVIDE (_RAMCODE_LMA_START = LOADADDR(.ram_code)); 51 PROVIDE (_RAMCODE_SIZE = SIZEOF (.ram_code)); 52 53 . = ALIGN(LOADADDR (.ram_code) + SIZEOF (.ram_code), 8); 54 .text : AT(ALIGN(LOADADDR (.ram_code) + SIZEOF (.ram_code), 8)) 55 { *(.text .stub .text.* .gnu.linkonce.t.* ) KEEP(*(.text.*personality* )) *(.gnu.warning ) } 56 .rodata : AT(ALIGN(LOADADDR (.text) + SIZEOF (.text), ALIGNOF(.rodata))) 57 { *(.rodata .rodata.* .gnu.linkonce.r.* ) 58 *(.srodata.cst16 ) *(.srodata.cst8 ) *(.srodata.cst4 ) *(.srodata.cst2 ) *(.srodata .srodata.* ) 59 *(.sdata2 .sdata2.* .gnu.linkonce.s.* ) 60 } 61 .eh_frame_hdr : AT(ALIGN(LOADADDR (.rodata) + SIZEOF (.rodata), ALIGNOF(.eh_frame_hdr))) 62 { *(.eh_frame_hdr ) } 63 . = ALIGN(0x20); 64 .eh_frame : AT(ALIGN(LOADADDR (.eh_frame_hdr) + SIZEOF (.eh_frame_hdr), 32)) 65 { KEEP(*(.eh_frame )) } 66 67 .exec.itable : AT(ALIGN(LOADADDR (.eh_frame) + SIZEOF (.eh_frame), ALIGNOF(.exec.itable))) 68 { KEEP(*(.exec.itable)) } 69 70 . = 0x00080000; 71 PROVIDE( __global_pointer$ = . + (4K / 2) ); 72 .data : AT(ALIGN(LOADADDR (.exec.itable) + SIZEOF (.exec.itable), ALIGNOF(.data))) 73 { *(.data .data.* .gnu.linkonce.d.* ) KEEP(*(.gnu.linkonce.d.*personality* )) SORT(CONSTRUCTORS) 74 *(.sdata .sdata.* .gnu.linkonce.s.* ) 75 } 76 PROVIDE (_DATA_VMA_END = .); 77 PROVIDE (_DATA_VMA_START = ADDR(.data)); 78 PROVIDE (_DATA_LMA_START = LOADADDR(.data)); 79 PROVIDE (BIN_SIZE = LOADADDR(.data) + SIZEOF(.data) - BIN_BEGIN); 80 81 . = ALIGN(8); 82 PROVIDE (_BSS_VMA_START = .); 83 .sbss (NOLOAD) : { *(.dynsbss ) *(.sbss .sbss.* .gnu.linkonce.sb.* ) *(.scommon .scommon.* ) } 84 .bss (NOLOAD) : { *(.dynbss ) *(.bss .bss.* .gnu.linkonce.b.* ) *(COMMON ) . = ALIGN(8); } 85 PROVIDE (_BSS_VMA_END = .); 86 87 . = ALIGN(8); 88 /* end is the starting address of the heap, the heap grows upward */ 89 _end = .; 90 PROVIDE (end = .); 91 PROVIDE (_STACK_TOP = 0x00a0000);/*Need to prevent stack overflow*/ 92 PROVIDE (FLASH_SIZE = FLASH_SIZE_CONFIG); 93} 94 95ASSERT((BIN_SIZE)<= FLASH_SIZE, "BIN FILE OVERFLOW"); 96