Skip to content

Commit c3146c4

Browse files
author
Nicolas Pitre
committed
ARM: linker script: factor out TCM bits
This is a plain move with identical results, and therefore still broken in the XIP case. Signed-off-by: Nicolas Pitre <[email protected]> Tested-by: Chris Brandt <[email protected]>
1 parent 9147095 commit c3146c4

File tree

3 files changed

+62
-108
lines changed

3 files changed

+62
-108
lines changed

arch/arm/kernel/vmlinux-xip.lds.S

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -144,60 +144,7 @@ SECTIONS
144144
__init_end = .;
145145

146146
#ifdef CONFIG_HAVE_TCM
147-
/*
148-
* We align everything to a page boundary so we can
149-
* free it after init has commenced and TCM contents have
150-
* been copied to its destination.
151-
*/
152-
.tcm_start : {
153-
. = ALIGN(PAGE_SIZE);
154-
__tcm_start = .;
155-
__itcm_start = .;
156-
}
157-
158-
/*
159-
* Link these to the ITCM RAM
160-
* Put VMA to the TCM address and LMA to the common RAM
161-
* and we'll upload the contents from RAM to TCM and free
162-
* the used RAM after that.
163-
*/
164-
.text_itcm ITCM_OFFSET : AT(__itcm_start)
165-
{
166-
__sitcm_text = .;
167-
*(.tcm.text)
168-
*(.tcm.rodata)
169-
. = ALIGN(4);
170-
__eitcm_text = .;
171-
}
172-
173-
/*
174-
* Reset the dot pointer, this is needed to create the
175-
* relative __dtcm_start below (to be used as extern in code).
176-
*/
177-
. = ADDR(.tcm_start) + SIZEOF(.tcm_start) + SIZEOF(.text_itcm);
178-
179-
.dtcm_start : {
180-
__dtcm_start = .;
181-
}
182-
183-
/* TODO: add remainder of ITCM as well, that can be used for data! */
184-
.data_dtcm DTCM_OFFSET : AT(__dtcm_start)
185-
{
186-
. = ALIGN(4);
187-
__sdtcm_data = .;
188-
*(.tcm.data)
189-
. = ALIGN(4);
190-
__edtcm_data = .;
191-
}
192-
193-
/* Reset the dot pointer or the linker gets confused */
194-
. = ADDR(.dtcm_start) + SIZEOF(.data_dtcm);
195-
196-
/* End marker for freeing TCM copy in linked object */
197-
.tcm_end : AT(ADDR(.dtcm_start) + SIZEOF(.data_dtcm)){
198-
. = ALIGN(PAGE_SIZE);
199-
__tcm_end = .;
200-
}
147+
ARM_TCM
201148
#endif
202149

203150
BSS_SECTION(0, 0, 8)

arch/arm/kernel/vmlinux.lds.S

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -139,60 +139,7 @@ SECTIONS
139139
_edata = .;
140140

141141
#ifdef CONFIG_HAVE_TCM
142-
/*
143-
* We align everything to a page boundary so we can
144-
* free it after init has commenced and TCM contents have
145-
* been copied to its destination.
146-
*/
147-
.tcm_start : {
148-
. = ALIGN(PAGE_SIZE);
149-
__tcm_start = .;
150-
__itcm_start = .;
151-
}
152-
153-
/*
154-
* Link these to the ITCM RAM
155-
* Put VMA to the TCM address and LMA to the common RAM
156-
* and we'll upload the contents from RAM to TCM and free
157-
* the used RAM after that.
158-
*/
159-
.text_itcm ITCM_OFFSET : AT(__itcm_start)
160-
{
161-
__sitcm_text = .;
162-
*(.tcm.text)
163-
*(.tcm.rodata)
164-
. = ALIGN(4);
165-
__eitcm_text = .;
166-
}
167-
168-
/*
169-
* Reset the dot pointer, this is needed to create the
170-
* relative __dtcm_start below (to be used as extern in code).
171-
*/
172-
. = ADDR(.tcm_start) + SIZEOF(.tcm_start) + SIZEOF(.text_itcm);
173-
174-
.dtcm_start : {
175-
__dtcm_start = .;
176-
}
177-
178-
/* TODO: add remainder of ITCM as well, that can be used for data! */
179-
.data_dtcm DTCM_OFFSET : AT(__dtcm_start)
180-
{
181-
. = ALIGN(4);
182-
__sdtcm_data = .;
183-
*(.tcm.data)
184-
. = ALIGN(4);
185-
__edtcm_data = .;
186-
}
187-
188-
/* Reset the dot pointer or the linker gets confused */
189-
. = ADDR(.dtcm_start) + SIZEOF(.data_dtcm);
190-
191-
/* End marker for freeing TCM copy in linked object */
192-
.tcm_end : AT(ADDR(.dtcm_start) + SIZEOF(.data_dtcm)){
193-
. = ALIGN(PAGE_SIZE);
194-
__tcm_end = .;
195-
}
142+
ARM_TCM
196143
#endif
197144

198145
BSS_SECTION(0, 0, 0)

arch/arm/kernel/vmlinux.lds.h

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,63 @@
113113
__stubs_end = .; \
114114
\
115115
PROVIDE(vector_fiq_offset = vector_fiq - ADDR(.vectors));
116+
117+
#define ARM_TCM \
118+
/* \
119+
* We align everything to a page boundary so we can \
120+
* free it after init has commenced and TCM contents have \
121+
* been copied to its destination. \
122+
*/ \
123+
.tcm_start : { \
124+
. = ALIGN(PAGE_SIZE); \
125+
__tcm_start = .; \
126+
__itcm_start = .; \
127+
} \
128+
\
129+
/* \
130+
* Link these to the ITCM RAM \
131+
* \
132+
* Put VMA to the TCM address and LMA to the common RAM \
133+
* and we'll upload the contents from RAM to TCM and free \
134+
* the used RAM after that. \
135+
*/ \
136+
.text_itcm ITCM_OFFSET : AT(__itcm_start) \
137+
{ \
138+
__sitcm_text = .; \
139+
*(.tcm.text) \
140+
*(.tcm.rodata) \
141+
. = ALIGN(4); \
142+
__eitcm_text = .; \
143+
} \
144+
\
145+
/* \
146+
* Reset the dot pointer, this is needed to create the \
147+
* relative __dtcm_start below (to be used as extern in code). \
148+
*/ \
149+
. = ADDR(.tcm_start) + SIZEOF(.tcm_start) + SIZEOF(.text_itcm); \
150+
\
151+
.dtcm_start : { \
152+
__dtcm_start = .; \
153+
} \
154+
\
155+
/* \
156+
* TODO: add remainder of ITCM as well, \
157+
* that can be used for data! \
158+
*/ \
159+
.data_dtcm DTCM_OFFSET : AT(__dtcm_start) \
160+
{ \
161+
. = ALIGN(4); \
162+
__sdtcm_data = .; \
163+
*(.tcm.data) \
164+
. = ALIGN(4); \
165+
__edtcm_data = .; \
166+
} \
167+
\
168+
/* Reset the dot pointer or the linker gets confused */ \
169+
. = ADDR(.dtcm_start) + SIZEOF(.data_dtcm); \
170+
\
171+
/* End marker for freeing TCM copy in linked object */ \
172+
.tcm_end : AT(ADDR(.dtcm_start) + SIZEOF(.data_dtcm)){ \
173+
. = ALIGN(PAGE_SIZE); \
174+
__tcm_end = .; \
175+
}

0 commit comments

Comments
 (0)