Skip to content

Commit 4df8ba3

Browse files
rgundinashif
authored andcommitted
linker: intel_s1000: Remove limits on code and data sections
All text, data and bss sections are all mapped to the same physical memory (SRAM). This patch removes the individual section limits and defines a common limit for the sum of text, data and bss sections. This would make it more flexible for application developers. Fixes #11268. Signed-off-by: Rajavardhan Gundi <[email protected]>
1 parent 1b48a7a commit 4df8ba3

File tree

2 files changed

+25
-31
lines changed

2 files changed

+25
-31
lines changed

soc/xtensa/intel_s1000/linker.ld

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ OUTPUT_ARCH(xtensa)
2323
#include <linker/linker-defs.h>
2424
#include <linker/linker-tool.h>
2525

26-
#define RAMABLE_REGION data :data_phdr
27-
#define ROMABLE_REGION text :text_phdr
26+
#define RAMABLE_REGION ram :ram_phdr
27+
#define ROMABLE_REGION ram :ram_phdr
2828

2929
MEMORY
3030
{
@@ -97,20 +97,14 @@ MEMORY
9797
vector_double_text :
9898
org = XCHAL_DOUBLEEXC_VECTOR_PADDR_SRAM,
9999
len = MEM_VECT_TEXT_SIZE
100-
text :
101-
org = TEXT_BASE,
102-
len = TEXT_SIZE,
100+
ram :
101+
org = RAM_BASE,
102+
len = RAM_SIZE
103103
#ifdef CONFIG_GEN_ISR_TABLES
104104
IDT_LIST :
105-
org = TEXT_BASE + TEXT_SIZE,
106-
len = IDT_SIZE,
105+
org = IDT_BASE,
106+
len = IDT_SIZE
107107
#endif
108-
data :
109-
org = TEXT_BASE + TEXT_SIZE + IDT_SIZE,
110-
len = DATA_SIZE
111-
bss_data :
112-
org = TEXT_BASE + TEXT_SIZE + IDT_SIZE + DATA_SIZE,
113-
len = BSS_DATA_SIZE
114108
}
115109

116110
PHDRS
@@ -138,9 +132,7 @@ PHDRS
138132
vector_user_text_phdr PT_LOAD;
139133
vector_double_lit_phdr PT_LOAD;
140134
vector_double_text_phdr PT_LOAD;
141-
text_phdr PT_LOAD;
142-
data_phdr PT_LOAD;
143-
bss_data_phdr PT_LOAD;
135+
ram_phdr PT_LOAD;
144136
}
145137
_rom_store_table = 0;
146138
PROVIDE(_memmap_vecbase_reset = XCHAL_VECBASE_RESET_PADDR_SRAM);
@@ -324,14 +316,14 @@ SECTIONS
324316
*(.gnu.version)
325317
_text_end = ABSOLUTE(.);
326318
_etext = .;
327-
} >text :text_phdr
319+
} >ram :ram_phdr
328320
#include <linker/common-rom.ld>
329321

330322
.noinit : ALIGN(4)
331323
{
332324
*(.noinit)
333325
*(.noinit.*)
334-
} >data :data_phdr
326+
} >ram :ram_phdr
335327
.rodata : ALIGN(4)
336328
{
337329
_rodata_start = ABSOLUTE(.);
@@ -366,7 +358,7 @@ SECTIONS
366358
LONG(_bss_end)
367359
_bss_table_end = ABSOLUTE(.);
368360
_rodata_end = ABSOLUTE(.);
369-
} >data :data_phdr
361+
} >ram :ram_phdr
370362
.data : ALIGN(4)
371363
{
372364
_data_start = ABSOLUTE(.);
@@ -385,15 +377,15 @@ SECTIONS
385377
. = ALIGN(4096);
386378
*(.gna_model)
387379
_data_end = ABSOLUTE(.);
388-
} >data :data_phdr
380+
} >ram :ram_phdr
389381
.lit4 : ALIGN(4)
390382
{
391383
_lit4_start = ABSOLUTE(.);
392384
*(*.lit4)
393385
*(.lit4.*)
394386
*(.gnu.linkonce.lit4.*)
395387
_lit4_end = ABSOLUTE(.);
396-
} >data :data_phdr
388+
} >ram :ram_phdr
397389
#include <linker/common-ram.ld>
398390

399391
.bss (NOLOAD) : ALIGN(8)
@@ -415,7 +407,7 @@ SECTIONS
415407
*(COMMON)
416408
. = ALIGN (8);
417409
_bss_end = ABSOLUTE(.);
418-
} >bss_data :bss_data_phdr
410+
} >ram :ram_phdr
419411

420412
/* stack */
421413
_end = ALIGN(8);

soc/xtensa/intel_s1000/memory.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,19 @@
4343
#define MEM_ERROR_TEXT_SIZE 0x180
4444
#define MEM_ERROR_LIT_SIZE 0x8
4545

46-
/* text and data share the same L2 HP SRAM on Intel S1000 */
47-
#define TEXT_BASE (DT_L2_SRAM_BASE + L2_VECTOR_SIZE)
48-
#define TEXT_SIZE 0x16000
46+
/* text and data share the same L2 HP SRAM on Intel S1000.
47+
* So, they lie next to each other.
48+
*/
49+
#define RAM_BASE (DT_L2_SRAM_BASE + L2_VECTOR_SIZE)
50+
#define RAM_SIZE (DT_L2_SRAM_SIZE - L2_VECTOR_SIZE)
51+
52+
/* Location for the intList section which is later used to construct the
53+
* Interrupt Descriptor Table (IDT). This is a bogus address as this
54+
* section will be stripped off in the final image.
55+
*/
56+
#define IDT_BASE 0xFFFFF7FF
4957

5058
/* size of the Interrupt Descriptor Table (IDT) */
5159
#define IDT_SIZE 0x2000
5260

53-
/* initialized data */
54-
#define DATA_SIZE 0x10000
55-
56-
/* bss data */
57-
#define BSS_DATA_SIZE 0x8000
58-
5961
#endif /* __INC_MEMORY_H */

0 commit comments

Comments
 (0)