| 1 | // ********************************************************************** |
|---|
| 2 | // * SEGGER Microcontroller GmbH * |
|---|
| 3 | // * The Embedded Experts * |
|---|
| 4 | // ********************************************************************** |
|---|
| 5 | // * * |
|---|
| 6 | // * (c) 2014 - 2020 SEGGER Microcontroller GmbH * |
|---|
| 7 | // * (c) 2001 - 2020 Rowley Associates Limited * |
|---|
| 8 | // * * |
|---|
| 9 | // * www.segger.com Support: support@segger.com * |
|---|
| 10 | // * * |
|---|
| 11 | // ********************************************************************** |
|---|
| 12 | // * * |
|---|
| 13 | // * All rights reserved. * |
|---|
| 14 | // * * |
|---|
| 15 | // * Redistribution and use in source and binary forms, with or * |
|---|
| 16 | // * without modification, are permitted provided that the following * |
|---|
| 17 | // * conditions are met: * |
|---|
| 18 | // * * |
|---|
| 19 | // * - Redistributions of source code must retain the above copyright * |
|---|
| 20 | // * notice, this list of conditions and the following disclaimer. * |
|---|
| 21 | // * * |
|---|
| 22 | // * - Neither the name of SEGGER Microcontroller GmbH * |
|---|
| 23 | // * nor the names of its contributors may be used to endorse or * |
|---|
| 24 | // * promote products derived from this software without specific * |
|---|
| 25 | // * prior written permission. * |
|---|
| 26 | // * * |
|---|
| 27 | // * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * |
|---|
| 28 | // * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * |
|---|
| 29 | // * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * |
|---|
| 30 | // * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
|---|
| 31 | // * DISCLAIMED. * |
|---|
| 32 | // * IN NO EVENT SHALL SEGGER Microcontroller GmbH BE LIABLE FOR * |
|---|
| 33 | // * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * |
|---|
| 34 | // * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * |
|---|
| 35 | // * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * |
|---|
| 36 | // * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * |
|---|
| 37 | // * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
|---|
| 38 | // * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * |
|---|
| 39 | // * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * |
|---|
| 40 | // * DAMAGE. * |
|---|
| 41 | // * * |
|---|
| 42 | // ********************************************************************** |
|---|
| 43 | |
|---|
| 44 | define memory with size = 4G; |
|---|
| 45 | |
|---|
| 46 | // |
|---|
| 47 | // Combined regions per memory type |
|---|
| 48 | // |
|---|
| 49 | define region FLASH = FLASH1; |
|---|
| 50 | define region RAM = RAM1; |
|---|
| 51 | |
|---|
| 52 | // |
|---|
| 53 | // Block definitions |
|---|
| 54 | // |
|---|
| 55 | define block vectors { section .vectors }; // Vector table section |
|---|
| 56 | define block vectors_ram { section .vectors_ram }; // Vector table section |
|---|
| 57 | define block ctors { section .ctors, section .ctors.*, block with alphabetical order { init_array } }; |
|---|
| 58 | define block dtors { section .dtors, section .dtors.*, block with reverse alphabetical order { fini_array } }; |
|---|
| 59 | define block exidx { section .ARM.exidx, section .ARM.exidx.* }; |
|---|
| 60 | define block tbss { section .tbss, section .tbss.* }; |
|---|
| 61 | define block tdata { section .tdata, section .tdata.* }; |
|---|
| 62 | define block tls { block tbss, block tdata }; |
|---|
| 63 | define block tdata_load { copy of block tdata }; |
|---|
| 64 | define block heap with size = __HEAPSIZE__, alignment = 8, /* fill =0x00, */ readwrite access { }; |
|---|
| 65 | define block stack with size = __STACKSIZE__, alignment = 8, /* fill =0xCD, */ readwrite access { }; |
|---|
| 66 | // |
|---|
| 67 | // Explicit initialization settings for sections |
|---|
| 68 | // |
|---|
| 69 | do not initialize { section .non_init, section .non_init.*, section .*.non_init, section .*.non_init.* }; |
|---|
| 70 | initialize by copy /* with packing=auto */ { section .data, section .data.*, section .*.data, section .*.data.* }; |
|---|
| 71 | initialize by copy /* with packing=auto */ { section .fast, section .fast.* }; |
|---|
| 72 | |
|---|
| 73 | // |
|---|
| 74 | // Explicit placement in FLASHn |
|---|
| 75 | // |
|---|
| 76 | place in FLASH1 { section .FLASH1, section .FLASH1.* }; |
|---|
| 77 | // |
|---|
| 78 | // FLASH Placement |
|---|
| 79 | // |
|---|
| 80 | place at start of FLASH { block vectors }; // Vector table section |
|---|
| 81 | place in FLASH with minimum size order { section .init, section .init.*, // Init code section |
|---|
| 82 | section .init_rodata, section .init_rodata.*, // Init read-only section |
|---|
| 83 | section .text, section .text.*, // Code section |
|---|
| 84 | section .rodata, section .rodata.*, // Read-only data section |
|---|
| 85 | section .segger.*, // Auto-generated initialization |
|---|
| 86 | block exidx, // ARM exception unwinding block |
|---|
| 87 | block ctors, // Constructors block |
|---|
| 88 | block dtors }; // Destructors block |
|---|
| 89 | place in FLASH { block tdata_load }; // Thread-local-storage load image |
|---|
| 90 | |
|---|
| 91 | // |
|---|
| 92 | // Explicit placement in RAMn |
|---|
| 93 | // |
|---|
| 94 | place in RAM1 { section .RAM1, section .RAM1.* }; |
|---|
| 95 | // |
|---|
| 96 | // RAM Placement |
|---|
| 97 | // |
|---|
| 98 | place at start of RAM { block vectors_ram }; |
|---|
| 99 | place in RAM { section .non_init, section .non_init.*, // No initialization section |
|---|
| 100 | block tls }; // Thread-local-storage block |
|---|
| 101 | place in RAM with auto order { section .fast, section .fast.*, // "ramfunc" section |
|---|
| 102 | section .data, section .data.*, // Initialized data section |
|---|
| 103 | section .bss, section .bss.* |
|---|
| 104 | }; // Static data section |
|---|
| 105 | place in RAM { block heap }; // Heap reserved block |
|---|
| 106 | place at end of RAM { block stack }; // Stack reserved block at the end |
|---|