source: trunk/fw_g473rct/SES/STM32G4xx_Flash.icf@ 28

Last change on this file since 28 was 28, checked in by f.jahn, 3 months ago
File size: 11.4 KB
Line 
1/*********************************************************************
2* SEGGER Microcontroller GmbH *
3* The Embedded Experts *
4**********************************************************************
5* *
6* (c) 2014 - 2024 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
38File : STM32G4xx_Flash.icf
39Purpose : STM32G4xx linker script for application placement in Flash,
40 for use with the SEGGER Linker.
41Maps : STM32G431C6Tx, STM32G431C6Ux, STM32G431C8Tx, STM32G431C8Ux,
42 STM32G431CBTx, STM32G431CBUx, STM32G431CBYx, STM32G431K6Tx,
43 STM32G431K6Ux, STM32G431K8Tx, STM32G431K8Ux, STM32G431KBTx,
44 STM32G431KBUx, STM32G431M6Tx, STM32G431M8Tx, STM32G431MBTx,
45 STM32G431R6Ix, STM32G431R6Tx, STM32G431R8Ix, STM32G431R8Tx,
46 STM32G431RBIx, STM32G431RBTx, STM32G431V6Tx, STM32G431V8Tx,
47 STM32G431VBTx, STM32G441CBTx, STM32G441CBUx, STM32G441CBYx,
48 STM32G441KBTx, STM32G441KBUx, STM32G441MBTx, STM32G441RBIx,
49 STM32G441RBTx, STM32G441VBTx, STM32G471CCTx, STM32G471CCUx,
50 STM32G471CETx, STM32G471CEUx, STM32G471MCTx, STM32G471METx,
51 STM32G471MEYx, STM32G471QCTx, STM32G471QETx, STM32G471RCTx,
52 STM32G471RETx, STM32G471VCHx, STM32G471VCIx, STM32G471VCTx,
53 STM32G471VEHx, STM32G471VEIx, STM32G471VETx, STM32G473CBTx,
54 STM32G473CBUx, STM32G473CCTx, STM32G473CCUx, STM32G473CETx,
55 STM32G473CEUx, STM32G473MBTx, STM32G473MCTx, STM32G473METx,
56 STM32G473MEYx, STM32G473PBIx, STM32G473PCIx, STM32G473PEIx,
57 STM32G473QBTx, STM32G473QCTx, STM32G473QETx, STM32G473RBTx,
58 STM32G473RCTx, STM32G473RETx, STM32G473VBHx, STM32G473VBIx,
59 STM32G473VBTx, STM32G473VCHx, STM32G473VCIx, STM32G473VCTx,
60 STM32G473VEHx, STM32G473VEIx, STM32G473VETx, STM32G474CBTx,
61 STM32G474CBUx, STM32G474CCTx, STM32G474CCUx, STM32G474CETx,
62 STM32G474CEUx, STM32G474MBTx, STM32G474MCTx, STM32G474METx,
63 STM32G474MEYx, STM32G474PBIx, STM32G474PCIx, STM32G474PEIx,
64 STM32G474QBTx, STM32G474QCTx, STM32G474QETx, STM32G474RBTx,
65 STM32G474RCTx, STM32G474RETx, STM32G474VBHx, STM32G474VBIx,
66 STM32G474VBTx, STM32G474VCHx, STM32G474VCIx, STM32G474VCTx,
67 STM32G474VEHx, STM32G474VEIx, STM32G474VETx, STM32G483CETx,
68 STM32G483CEUx, STM32G483METx, STM32G483MEYx, STM32G483PEIx,
69 STM32G483QETx, STM32G483RETx, STM32G483VEHx, STM32G483VEIx,
70 STM32G483VETx, STM32G484CETx, STM32G484CEUx, STM32G484METx,
71 STM32G484MEYx, STM32G484PEIx, STM32G484QETx, STM32G484RETx,
72 STM32G484VEHx, STM32G484VEIx, STM32G484VETx, STM32G491CCTx,
73 STM32G491CCUx, STM32G491CETx, STM32G491CEUx, STM32G491KCUx,
74 STM32G491KEUx, STM32G491MCSx, STM32G491MCTx, STM32G491MESx,
75 STM32G491METx, STM32G491RCIx, STM32G491RCTx, STM32G491REIx,
76 STM32G491RETx, STM32G491REYx, STM32G491VCTx, STM32G491VETx,
77 STM32G4A1CETx, STM32G4A1CEUx, STM32G4A1KEUx, STM32G4A1MESx,
78 STM32G4A1METx, STM32G4A1REIx, STM32G4A1RETx, STM32G4A1REYx,
79 STM32G4A1VETx
80Literature:
81 [1] SEGGER Linker User Guide (https://www.segger.com/doc/UM20005_Linker.html)
82 [2] SEGGER Linker Section Placement (https://wiki.segger.com/SEGGER_Linker_Script_Files)
83*/
84
85define memory with size = 4G;
86
87//
88// Combined regions per memory type
89//
90define region FLASH = FLASH1;
91define region RAM = CCM_RAM1 + RAM1 + RAM2;
92
93//
94// Block definitions
95//
96define block vectors { section .vectors }; // Vector table section
97define block vectors_ram { section .vectors_ram }; // Vector table section
98define block ctors { section .ctors, section .ctors.*, block with alphabetical order { init_array } };
99define block dtors { section .dtors, section .dtors.*, block with reverse alphabetical order { fini_array } };
100define block exidx { section .ARM.exidx, section .ARM.exidx.* };
101define block tbss { section .tbss, section .tbss.* };
102define block tdata { section .tdata, section .tdata.* };
103define block tls with fixed order { block tbss, block tdata };
104define block tdata_load { copy of block tdata };
105define block heap with auto size = __HEAPSIZE__, alignment = 8, readwrite access { };
106define block stack with size = __STACKSIZE__, alignment = 8, readwrite access { };
107define block stack_process with size = __STACKSIZE_PROCESS__, alignment = 8, /* fill =0xCD, */ readwrite access { };
108
109//
110// Explicit initialization settings for sections
111// Packing options for initialize by copy: packing=auto/lzss/zpak/packbits
112//
113do not initialize { section .non_init, section .non_init.*, section .*.non_init, section .*.non_init.* };
114do not initialize { section .no_init, section .no_init.*, section .*.no_init, section .*.no_init.* }; // Legacy sections, kept for backwards compatibility
115do not initialize { section .noinit, section .noinit.*, section .*.noinit, section .*.noinit.* }; // Legacy sections, used by some SDKs/HALs
116do not initialize { block vectors_ram };
117initialize by copy with packing=auto { section .data, section .data.*, section .*.data, section .*.data.* }; // Static data sections
118initialize by copy with packing=auto { section .fast, section .fast.*, section .*.fast, section .*.fast.* }; // "RAM Code" sections
119
120initialize by calling __SEGGER_STOP_X_InitLimits { section .data.stop.* };
121
122#define USES_ALLOC_FUNC \
123 linked symbol malloc || linked symbol aligned_alloc || \
124 linked symbol calloc || linked symbol realloc
125
126initialize by calling __SEGGER_init_heap if USES_ALLOC_FUNC { block heap }; // Init the heap if one is required
127initialize 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.
128
129//assert with warning "free() linked into application but there are no calls to an allocation function!" {
130// linked symbol free => USES_ALLOC_FUNC
131//};
132
133assert with error "heap is too small!" { USES_ALLOC_FUNC => size of block heap >= 48 };
134assert with error "heap size not a multiple of 8!" { USES_ALLOC_FUNC => size of block heap % 8 == 0 };
135assert with error "heap not correctly aligned!" { USES_ALLOC_FUNC => start of block heap % 8 == 0 };
136
137//
138// Explicit placement in FLASHn
139//
140place in FLASH1 { section .FLASH1, section .FLASH1.* };
141//
142// FLASH Placement
143//
144place at start of FLASH { block vectors }; // Vector table section
145place in FLASH with minimum size order { block tdata_load, // Thread-local-storage load image
146 block exidx, // ARM exception unwinding block
147 block ctors, // Constructors block
148 block dtors, // Destructors block
149 readonly, // Catch-all for readonly data (e.g. .rodata, .srodata)
150 readexec // Catch-all for (readonly) executable code (e.g. .text)
151 };
152
153//
154// Explicit placement in RAMn
155//
156place in CCM_RAM1 { section .CCM_RAM1, section .CCM_RAM1.* };
157place in RAM1 { section .RAM1, section .RAM1.* };
158place in RAM2 { section .RAM2, section .RAM2.* };
159//
160// RAM Placement
161//
162place at start of RAM { block vectors_ram };
163place in RAM { section .fast, section .fast.* }; // "ramfunc" section
164place in RAM with auto order { block tls, // Thread-local-storage block
165 readwrite, // Catch-all for initialized/uninitialized data sections (e.g. .data, .noinit)
166 zeroinit // Catch-all for zero-initialized data sections (e.g. .bss)
167 };
168place in RAM { block heap }; // Heap reserved block
169place at end of CCM_RAM1 { block stack }; // Stack reserved block at the end
Note: See TracBrowser for help on using the repository browser.