3 * Copyright (c) 2020 Project CHIP Authors
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 /***************************************************************************//**
19 * Linker script for Silicon Labs EFR32MG12P devices
21 *******************************************************************************
23 * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
24 *******************************************************************************
26 * SPDX-License-Identifier: Zlib
28 * The licensor of this software is Silicon Laboratories Inc.
30 * This software is provided 'as-is', without any express or implied
31 * warranty. In no event will the authors be held liable for any damages
32 * arising from the use of this software.
34 * Permission is granted to anyone to use this software for any purpose,
35 * including commercial applications, and to alter it and redistribute it
36 * freely, subject to the following restrictions:
38 * 1. The origin of this software must not be misrepresented; you must not
39 * claim that you wrote the original software. If you use this software
40 * in a product, an acknowledgment in the product documentation would be
41 * appreciated but is not required.
42 * 2. Altered source versions must be plainly marked as such, and must not be
43 * misrepresented as being the original software.
44 * 3. This notice may not be removed or altered from any source distribution.
46 ******************************************************************************/
50 FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 1048576
51 RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 262144
54 /* Linker script to place sections and symbol values. Should be used together
55 * with other linker script that defines memory regions FLASH and RAM.
56 * It references following symbols, which must be defined in code:
57 * Reset_Handler : Entry of reset handler
59 * It defines following symbols, which code can use without definition:
62 * __copy_table_start__
64 * __zero_table_start__
68 * __preinit_array_start
95 __Vectors_Size = __Vectors_End - __Vectors;
103 KEEP(*(.application_properties))
104 KEEP(*(.gecko_configuration))
105 KEEP(*(.xo_configuration))
106 KEEP(*(.gatt_header))
112 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
119 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
132 *(.ARM.extab* .gnu.linkonce.armextab.*)
138 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
144 /* To copy multiple ROM to RAM sections,
145 * uncomment .copy.table section and,
146 * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */
151 __copy_table_start__ = .;
153 LONG (__data_start__)
154 LONG (__data_end__ - __data_start__)
156 LONG (__data2_start__)
157 LONG (__data2_end__ - __data2_start__)
158 __copy_table_end__ = .;
162 /* To clear multiple BSS sections,
163 * uncomment .zero.table section and,
164 * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */
169 __zero_table_start__ = .;
171 LONG (__bss_end__ - __bss_start__)
172 LONG (__bss2_start__)
173 LONG (__bss2_end__ - __bss2_start__)
174 __zero_table_end__ = .;
180 /*******************************************************************/
181 /* Define flash block for BLE-simee & chip-nvm3 */
182 /* simee: 9000H (36k) bytes for BLE nvm3 */
183 /* chipNvm3_section: 4000H (16k) bytes for chip nvm3. */
184 /* 8K is reserved for OpenThread's NVM which is mapped directly at */
185 /* the top of flash */
186 /*******************************************************************/
188 OPENTHREAD_NVM_SIZE = 8192;
192 __nvm3_dummy_begin = .;
194 __nvm3_dummy_simee = .;
197 __nvm3_dummy_chip = .;
198 KEEP(*(chipNvm3_section));
200 . += OPENTHREAD_NVM_SIZE;
204 /* Set NVM to end of FLASH */
205 __nvm3Base = LENGTH(FLASH) - SIZEOF(.nvm_dummy) + (__nvm3_dummy_simee - __nvm3_dummy_begin);
206 __chipNvm3Base = LENGTH(FLASH) - SIZEOF(.nvm_dummy) + (__nvm3_dummy_chip - __nvm3_dummy_begin);
209 /*******************************************************************/
217 PROVIDE (__ram_func_section_start = .);
219 PROVIDE (__ram_func_section_end = .);
223 PROVIDE_HIDDEN (__preinit_array_start = .);
224 KEEP(*(.preinit_array))
225 PROVIDE_HIDDEN (__preinit_array_end = .);
229 PROVIDE_HIDDEN (__init_array_start = .);
230 KEEP(*(SORT(.init_array.*)))
232 PROVIDE_HIDDEN (__init_array_end = .);
236 PROVIDE_HIDDEN (__fini_array_start = .);
237 KEEP(*(SORT(.fini_array.*)))
239 PROVIDE_HIDDEN (__fini_array_end = .);
268 /* .stack_dummy section doesn't contains any symbols. It is only
269 * used for linker to calculate size of stack sections, and assign
270 * values to stack symbols later */
276 /* Set stack top to end of RAM, and stack limit move down by
277 * size of stack_dummy section */
278 __StackTop = ORIGIN(RAM) + LENGTH(RAM);
279 __StackLimit = __StackTop - SIZEOF(.stack_dummy);
280 PROVIDE(__stack = __StackTop);
282 /* Check if data + heap + stack exceeds RAM limit */
283 ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
286 /* Check if FLASH usage exceeds FLASH size */
287 ASSERT( LENGTH(FLASH) >= (__etext + SIZEOF(.data)), "FLASH memory overflowed !")
288 ASSERT((__etext + SIZEOF(.data)) <= __nvm3Base, "FLASH memory overlapped with NVM section.")