1 | /********************************************************************* |
---|
2 | * SEGGER Microcontroller GmbH * |
---|
3 | * The Embedded Experts * |
---|
4 | ********************************************************************** |
---|
5 | * * |
---|
6 | * (c) 2014 - 2020 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 : STM32G0xx_Flash.icf |
---|
39 | Purpose : STM32G0xx linker script for application placement in Flash, |
---|
40 | for use with the SEGGER Linker. |
---|
41 | */ |
---|
42 | |
---|
43 | define memory with size = 4G; |
---|
44 | |
---|
45 | // |
---|
46 | // Combined regions per memory type |
---|
47 | // |
---|
48 | define region FLASH = FLASH1; |
---|
49 | define region RAM = RAM1; |
---|
50 | |
---|
51 | // |
---|
52 | // Block definitions |
---|
53 | // |
---|
54 | define block vectors { section .vectors }; // Vector table section |
---|
55 | define block vectors_ram { section .vectors_ram }; // Vector table section |
---|
56 | define block ctors { section .ctors, section .ctors.*, block with alphabetical order { init_array } }; |
---|
57 | define block dtors { section .dtors, section .dtors.*, block with reverse alphabetical order { fini_array } }; |
---|
58 | define block exidx { section .ARM.exidx, section .ARM.exidx.* }; |
---|
59 | define block tbss { section .tbss, section .tbss.* }; |
---|
60 | define block tdata { section .tdata, section .tdata.* }; |
---|
61 | define block tls { block tbss, block tdata }; |
---|
62 | define block tdata_load { copy of block tdata }; |
---|
63 | define block heap with size = __HEAPSIZE__, alignment = 8, /* fill =0x00, */ readwrite access { }; |
---|
64 | define block stack with size = __STACKSIZE__, alignment = 8, /* fill =0xCD, */ readwrite access { }; |
---|
65 | // |
---|
66 | // Explicit initialization settings for sections |
---|
67 | // Packing options for initialize by copy: packing=auto/lzss/zpak/packbits |
---|
68 | // |
---|
69 | do not initialize { section .non_init, section .non_init.*, section .*.non_init, section .*.non_init.* }; |
---|
70 | do not initialize { section .no_init, section .no_init.*, section .*.no_init, section .*.no_init.* }; // Legacy sections, kept for backwards compatibility |
---|
71 | do not initialize { section .noinit, section .noinit.*, section .*.noinit, section .*.noinit.* }; // Legacy sections, used by some SDKs/HALs |
---|
72 | do not initialize { block vectors_ram }; |
---|
73 | initialize by copy with packing=auto { section .data, section .data.*, section .*.data, section .*.data.* }; // Static data sections |
---|
74 | initialize by copy with packing=auto { section .fast, section .fast.* }; // "RAM Code" sections |
---|
75 | initialize by symbol __SEGGER_init_heap { block heap }; // Init the heap if there is one |
---|
76 | initialize by symbol __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. |
---|
77 | |
---|
78 | // |
---|
79 | // Explicit placement in FLASHn |
---|
80 | // |
---|
81 | place in FLASH1 { section .FLASH1, section .FLASH1.* }; |
---|
82 | // |
---|
83 | // FLASH Placement |
---|
84 | // |
---|
85 | place at start of FLASH { block vectors }; // Vector table section |
---|
86 | place in FLASH with minimum size order { section .init, section .init.*, // Init code section |
---|
87 | section .init_rodata, section .init_rodata.*, // Init read-only section |
---|
88 | section .text, section .text.*, // Code section |
---|
89 | section .rodata, section .rodata.*, // Read-only data section |
---|
90 | section .segger.*, // Auto-generated initialization |
---|
91 | section .ARM.extab.*, // ARM exception table |
---|
92 | block exidx, // ARM exception unwinding block |
---|
93 | block ctors, // Constructors block |
---|
94 | block dtors }; // Destructors block |
---|
95 | place in FLASH { block tdata_load }; // Thread-local-storage load image |
---|
96 | |
---|
97 | // |
---|
98 | // Explicit placement in RAMn |
---|
99 | // |
---|
100 | place in RAM1 { section .RAM1, section .RAM1.* }; |
---|
101 | // |
---|
102 | // RAM Placement |
---|
103 | // |
---|
104 | place at start of RAM { block vectors_ram }; |
---|
105 | place in RAM { section .non_init, section .non_init.*, // No initialization section |
---|
106 | section .no_init, section .no_init.*, // No initialization section, for backwards compatibility |
---|
107 | section .noinit, section .noinit.*, // No initialization section, used by some SDKs/HALs |
---|
108 | block tls }; // Thread-local-storage block |
---|
109 | place in RAM with auto order { section .fast, section .fast.*, // "ramfunc" section |
---|
110 | section .RamFunc*, // "ramfunc" section |
---|
111 | section .data, section .data.*, // Initialized data section |
---|
112 | section .bss, section .bss.* // Static data section |
---|
113 | }; |
---|
114 | place in RAM { block heap }; // Heap reserved block |
---|
115 | place at end of RAM { block stack }; // Stack reserved block at the end |
---|
116 | |
---|
117 | define region CRC = [end(FLASH) - 4 size 4]; |
---|
118 | define region APP = FLASH - CRC; |
---|
119 | place in CRC { integrity check of APP with algorithm="CRC-32/STM32" fill=0xFF }; |
---|
120 | fill APP with 0xFF; |
---|