| [16] | 1 | /*********************************************************************
|
|---|
| 2 | * SEGGER Microcontroller GmbH *
|
|---|
| 3 | * The Embedded Experts *
|
|---|
| 4 | **********************************************************************
|
|---|
| 5 | * *
|
|---|
| 6 | * (c) 2014 - 2026 SEGGER Microcontroller GmbH *
|
|---|
| 7 | * *
|
|---|
| 8 | * www.segger.com Support: support@segger.com *
|
|---|
| 9 | * *
|
|---|
| 10 | **********************************************************************
|
|---|
| 11 | * *
|
|---|
| 12 | * All rights reserved. *
|
|---|
| 13 | * *
|
|---|
| 14 | * Redistribution and use in source and binary forms, with or *
|
|---|
| 15 | * without modification, are permitted provided that the following *
|
|---|
| 16 | * condition is met: *
|
|---|
| 17 | * *
|
|---|
| 18 | * - Redistributions of source code must retain the above copyright *
|
|---|
| 19 | * notice, this condition and the following disclaimer. *
|
|---|
| 20 | * *
|
|---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
|
|---|
| 22 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
|
|---|
| 23 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
|
|---|
| 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
|
|---|
| 25 | * DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
|
|---|
| 26 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
|
|---|
| 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
|
|---|
| 28 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
|
|---|
| 29 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
|
|---|
| 30 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
|
|---|
| 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
|
|---|
| 32 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
|
|---|
| 33 | * DAMAGE. *
|
|---|
| 34 | * *
|
|---|
| 35 | **********************************************************************
|
|---|
| 36 | -------------------------- END-OF-HEADER -----------------------------
|
|---|
| 37 |
|
|---|
| 38 | File : STM32N6xx_RAM.icf
|
|---|
| 39 | Purpose : STM32N6xx linker script for application placement in RAM
|
|---|
| 40 | (to be copied to RAM by bootloader or debugger)
|
|---|
| 41 | for use with the SEGGER Linker.
|
|---|
| 42 | Maps : STM32N645A0HxQ, STM32N645B0HxQ, STM32N645I0HxQ, STM32N645L0HxQ,
|
|---|
| 43 | STM32N645X0HxQ, STM32N645Z0HxQ, STM32N647A0HxQ, STM32N647B0HxQ,
|
|---|
| 44 | STM32N647I0HxQ, STM32N647L0HxQ, STM32N647X0HxQ, STM32N647Z0HxQ,
|
|---|
| 45 | STM32N655A0HxQ, STM32N655B0HxQ, STM32N655I0HxQ, STM32N655L0HxQ,
|
|---|
| 46 | STM32N655X0HxQ, STM32N655Z0HxQ, STM32N657A0HxQ, STM32N657B0HxQ,
|
|---|
| 47 | STM32N657I0HxQ, STM32N657L0HxQ, STM32N657X0HxQ, STM32N657Z0HxQ
|
|---|
| 48 | Literature:
|
|---|
| 49 | [1] SEGGER Linker User Guide (https://www.segger.com/doc/UM20005_Linker.html)
|
|---|
| 50 | [2] SEGGER Linker Section Placement (https://wiki.segger.com/SEGGER_Linker_Script_Files)
|
|---|
| 51 | */
|
|---|
| 52 |
|
|---|
| 53 | define memory with size = 4G;
|
|---|
| 54 |
|
|---|
| 55 | //
|
|---|
| 56 | // Combined regions per memory type
|
|---|
| 57 | //
|
|---|
| 58 | define region RAM = AXI_RAM2;
|
|---|
| 59 |
|
|---|
| 60 | //
|
|---|
| 61 | // Block definitions
|
|---|
| 62 | //
|
|---|
| 63 | define block ctors { section .ctors, section .ctors.*, block with alphabetical order { init_array } };
|
|---|
| 64 | define block dtors { section .dtors, section .dtors.*, block with reverse alphabetical order { fini_array } };
|
|---|
| 65 | define block exidx { section .ARM.exidx, section .ARM.exidx.* };
|
|---|
| 66 | define block tbss { section .tbss, section .tbss.* };
|
|---|
| 67 | define block tdata { section .tdata, section .tdata.* };
|
|---|
| 68 | define block tls with fixed order { block tbss, block tdata };
|
|---|
| 69 | define block tdata_load { copy of block tdata };
|
|---|
| 70 | define block heap with auto size = __HEAPSIZE__, alignment = 8, readwrite access { };
|
|---|
| 71 | define block stack with size = __STACKSIZE__, alignment = 8, readwrite access { };
|
|---|
| 72 | define block stack_process with size = __STACKSIZE_PROCESS__, alignment = 8, /* fill =0xCD, */ readwrite access { };
|
|---|
| 73 |
|
|---|
| 74 | //
|
|---|
| 75 | // Explicit initialization settings for sections
|
|---|
| 76 | // Packing options for initialize by copy: packing=auto/lzss/zpak/packbits
|
|---|
| 77 | //
|
|---|
| 78 | do not initialize { section .non_init, section .non_init.*, section .*.non_init, section .*.non_init.* };
|
|---|
| 79 | do not initialize { section .no_init, section .no_init.*, section .*.no_init, section .*.no_init.* }; // Legacy sections, kept for backwards compatibility
|
|---|
| 80 | do not initialize { section .noinit, section .noinit.*, section .*.noinit, section .*.noinit.* }; // Legacy sections, used by some SDKs/HALs
|
|---|
| 81 | do not initialize { section .vectors_ram };
|
|---|
| 82 | initialize by copy with packing=auto { section .data, section .data.*, section .*.data, section .*.data.* }; // Static data sections
|
|---|
| 83 | initialize by copy with packing=auto { section .fast, section .fast.*, section .*.fast, section .*.fast.* }; // "RAM Code" sections
|
|---|
| 84 |
|
|---|
| 85 | initialize by calling __SEGGER_STOP_X_InitLimits { section .data.stop.* };
|
|---|
| 86 |
|
|---|
| 87 | #define USES_ALLOC_FUNC \
|
|---|
| 88 | linked symbol malloc || linked symbol aligned_alloc || \
|
|---|
| 89 | linked symbol calloc || linked symbol realloc
|
|---|
| 90 |
|
|---|
| 91 | initialize by calling __SEGGER_init_heap if USES_ALLOC_FUNC { block heap }; // Init the heap if one is required
|
|---|
| 92 | initialize by calling __SEGGER_init_ctors { block ctors }; // Call constructors for global objects which need to be constructed before reaching main (if any). Make sure this is done after setting up heap.
|
|---|
| 93 |
|
|---|
| 94 | //assert with warning "free() linked into application but there are no calls to an allocation function!" {
|
|---|
| 95 | // linked symbol free => USES_ALLOC_FUNC
|
|---|
| 96 | //};
|
|---|
| 97 |
|
|---|
| 98 | assert with error "heap is too small!" { USES_ALLOC_FUNC => size of block heap >= 48 };
|
|---|
| 99 | assert with error "heap size not a multiple of 8!" { USES_ALLOC_FUNC => size of block heap % 8 == 0 };
|
|---|
| 100 | assert with error "heap not correctly aligned!" { USES_ALLOC_FUNC => start of block heap % 8 == 0 };
|
|---|
| 101 |
|
|---|
| 102 | //
|
|---|
| 103 | // Explicit placement in RAMn
|
|---|
| 104 | //
|
|---|
| 105 | place in AHB_RAM1 { section .AHB_RAM1, section .AHB_RAM1.* };
|
|---|
| 106 | place in AHB_RAM2 { section .AHB_RAM2, section .AHB_RAM2.* };
|
|---|
| 107 | place in AXI_RAM1 { section .AXI_RAM1, section .AXI_RAM1.* }; // This region may be deactivated and not accessible
|
|---|
| 108 | place in AXI_RAM2 { section .AXI_RAM2, section .AXI_RAM2.* }; // This region may be deactivated and not accessible
|
|---|
| 109 | place in AXI_RAM3 { section .AXI_RAM3, section .AXI_RAM3.* }; // This region may be deactivated and not accessible
|
|---|
| 110 | place in AXI_RAM4 { section .AXI_RAM4, section .AXI_RAM4.* }; // This region may be deactivated and not accessible
|
|---|
| 111 | place in BKP_RAM { section .BKP_RAM, section .BKP_RAM.* }; // This region may be deactivated and not accessible
|
|---|
| 112 | place in DTCM_RAM { section .DTCM_RAM, section .DTCM_RAM.* }; // This region may be deactivated and not accessible
|
|---|
| 113 | place in FLEX_RAM { section .FLEX_RAM, section .FLEX_RAM.* };
|
|---|
| 114 | place in ITCM_RAM { section .ITCM_RAM, section .ITCM_RAM.* }; // This region may be deactivated and not accessible
|
|---|
| 115 |
|
|---|
| 116 | //
|
|---|
| 117 | // RAM Placement
|
|---|
| 118 | //
|
|---|
| 119 | place at start of RAM { section .vectors }; // Vector table section
|
|---|
| 120 | place in RAM with minimum size order { block tdata_load, // Thread-local-storage load image
|
|---|
| 121 | block exidx, // ARM exception unwinding block
|
|---|
| 122 | block ctors, // Constructors block
|
|---|
| 123 | block dtors, // Destructors block
|
|---|
| 124 | readonly, // Catch-all for readonly data (e.g. .rodata, .srodata)
|
|---|
| 125 | readexec // Catch-all for (readonly) executable code (e.g. .text)
|
|---|
| 126 | };
|
|---|
| 127 | place in RAM { section .fast, section .fast.* }; // "ramfunc" section
|
|---|
| 128 | place in RAM with auto order { block tls, // Thread-local-storage block
|
|---|
| 129 | readwrite, // Catch-all for initialized/uninitialized data sections (e.g. .data, .noinit)
|
|---|
| 130 | zeroinit // Catch-all for zero-initialized data sections (e.g. .bss)
|
|---|
| 131 | };
|
|---|
| 132 | place in RAM { block heap }; // Heap reserved block
|
|---|
| 133 | place at end of RAM { block stack }; // Stack reserved block at the end
|
|---|