• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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	.dlm_data	: AT(ALIGN(LOADADDR (.exec.itable) + SIZEOF (.exec.itable),  8))
72		{ KEEP(*(.dlm_data )) }
73	PROVIDE (_DLM_DATA_VMA_START = ADDR(.dlm_data));
74	PROVIDE (_DLM_DATA_LMA_START = LOADADDR(.dlm_data));
75	PROVIDE (_DLM_DATA_VMA_END = .);
76	PROVIDE (BIN_SIZE = LOADADDR(.dlm_data) + SIZEOF(.dlm_data) - BIN_BEGIN);
77
78	. = 0x0001c000;
79	PROVIDE( __global_pointer$ = . + (4K / 2) );
80	.data	: AT(ALIGN(LOADADDR (.dlm_data) + SIZEOF (.dlm_data),  ALIGNOF(.data)))
81		{ *(.data .data.* .gnu.linkonce.d.* ) KEEP(*(.gnu.linkonce.d.*personality* )) SORT(CONSTRUCTORS)
82		  *(.sdata .sdata.* .gnu.linkonce.s.* )
83		}
84    PROVIDE (_DATA_VMA_END = .);
85    PROVIDE (_DATA_VMA_START = ADDR(.data));
86	PROVIDE (_DATA_LMA_START = LOADADDR(.data));
87
88	. = ALIGN(8);
89	PROVIDE (_BSS_VMA_START = .);
90	.sbss 	(NOLOAD)	: { *(.dynsbss ) *(.sbss .sbss.* .gnu.linkonce.sb.* ) *(.scommon .scommon.* ) }
91	.bss 	(NOLOAD)	: { *(.dynbss ) *(.bss .bss.* .gnu.linkonce.b.* ) *(COMMON ) . = ALIGN(8); }
92	PROVIDE (_BSS_VMA_END = .);
93
94	. = ALIGN(8);
95	/* end is the starting address of the heap, the heap grows upward */
96	_end = .;
97	PROVIDE (end = .);
98	PROVIDE (_STACK_TOP = 0x0020000);/*Need to prevent stack overflow*/
99	PROVIDE (FLASH_SIZE = 0x0100000);
100}
101
102ASSERT((BIN_SIZE)<= FLASH_SIZE, "BIN FILE OVERFLOW");
103