1/******************************************************************************* 2 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included 12 * in all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 * OTHER DEALINGS IN THE SOFTWARE. 21 * 22 * Except as contained in this notice, the name of Maxim Integrated 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated 24 * Products, Inc. Branding Policy. 25 * 26 * The mere transfer of this software does not imply any licenses 27 * of trade secrets, proprietary technology, copyrights, patents, 28 * trademarks, maskwork rights, or any other form of intellectual 29 * property whatsoever. Maxim Integrated Products, Inc. retains all 30 * ownership rights. 31 * 32 * $Date: 2018-12-18 15:37:22 -0600 (Tue, 18 Dec 2018) $ 33 * $Revision: 40072 $ 34 * 35 ******************************************************************************/ 36 37MEMORY { 38 FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K 39 SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 96K 40} 41 42SECTIONS { 43 .text : 44 { 45 _text = .; 46 KEEP(*(.isr_vector)) 47 *(.text*) /* program code */ 48 *(.rodata*) /* read-only data: "const" */ 49 50 KEEP(*(.init)) 51 KEEP(*(.fini)) 52 53 /* C++ Exception handling */ 54 KEEP(*(.eh_frame*)) 55 _etext = .; 56 } > FLASH 57 58 /* it's used for C++ exception handling */ 59 /* we need to keep this to avoid overlapping */ 60 .ARM.exidx : 61 { 62 __exidx_start = .; 63 *(.ARM.exidx*) 64 __exidx_end = .; 65 } > FLASH 66 67 .data : 68 { 69 _data = ALIGN(., 4); 70 *(.data*) /*read-write initialized data: initialized global variable*/ 71 *(.spix_config*) /* SPIX configuration functions need to be run from SRAM */ 72 73 /* These array sections are used by __libc_init_array to call static C++ constructors */ 74 . = ALIGN(4); 75 /* preinit data */ 76 PROVIDE_HIDDEN (__preinit_array_start = .); 77 KEEP(*(.preinit_array)) 78 PROVIDE_HIDDEN (__preinit_array_end = .); 79 80 . = ALIGN(4); 81 /* init data */ 82 PROVIDE_HIDDEN (__init_array_start = .); 83 KEEP(*(SORT(.init_array.*))) 84 KEEP(*(.init_array)) 85 PROVIDE_HIDDEN (__init_array_end = .); 86 87 . = ALIGN(4); 88 /* finit data */ 89 PROVIDE_HIDDEN (__fini_array_start = .); 90 KEEP(*(SORT(.fini_array.*))) 91 KEEP(*(.fini_array)) 92 PROVIDE_HIDDEN (__fini_array_end = .); 93 94 _edata = ALIGN(., 4); 95 } > SRAM AT>FLASH 96 __load_data = LOADADDR(.data); 97 98 .bss : 99 { 100 . = ALIGN(4); 101 _bss = .; 102 *(.bss*) /*read-write zero initialized data: uninitialzed global variable*/ 103 *(COMMON) 104 _ebss = ALIGN(., 4); 105 } > SRAM 106 107 /* Set stack top to end of RAM, and stack limit move down by 108 * size of stack_dummy section */ 109 __StackTop = ORIGIN(SRAM) + LENGTH(SRAM); 110 __StackLimit = __StackTop - SIZEOF(.stack_dummy); 111 112 /* .stack_dummy section doesn't contains any symbols. It is only 113 * used for linker to calculate size of stack sections, and assign 114 * values to stack symbols later */ 115 .stack_dummy (COPY): 116 { 117 *(.stack*) 118 } > SRAM 119 120 .heap (COPY): 121 { 122 . = ALIGN(4); 123 *(.heap*) 124 __HeapLimit = ABSOLUTE(__StackLimit); 125 } > SRAM 126 127 PROVIDE(__stack = __StackTop); 128 129 /* Check if data + heap + stack exceeds RAM limit */ 130 ASSERT(__StackLimit >= _ebss, "region RAM overflowed with stack") 131} 132