FreeCalypso > hg > freecalypso-sw
annotate nuc-fw/finlink/ld-script.src @ 120:e7d4ec9c4c32
All of RVF compiles
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Thu, 31 Oct 2013 00:17:12 +0000 |
parents | f459043fae0c |
children | 2c5160a9d652 |
rev | line source |
---|---|
92
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 dnl This ld script source is fed through m4 in order to fill in |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 dnl those settings which depend on the configuration. |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 dnl Memory region sizes are set in ../include/config.m4, generated |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 dnl by the configuration mechanism based on the selected target, |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 dnl and the Makefile prepends flash.m4 or xram.m4 to select the |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 dnl type of image we are linking: either the regular flashable image, |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 dnl or a RAM-only test image (to be loaded via fc-xram) that does not |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 dnl touch the flash and pretends as if the flash doesn't even exist. |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 /* |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 * FreeCalypso ld script for the Buildmem build |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 */ |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 ENTRY(ifelse(Buildmem,XRAM,_FlashorXram_entry,0)) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 include(`../include/config.m4')dnl |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 MEMORY { |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 ifelse(Buildmem,FLASH, |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 ` FLASH_OVERLAY : ORIGIN = 0, LENGTH = 0x2000 |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 FLASH : ORIGIN = 0x2000, LENGTH = CONFIG_FWFLASH_SIZE - 0x2000') |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 IRAM : ORIGIN = 0x00800000, LENGTH = CONFIG_IRAM_SIZE |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 XRAM : ORIGIN = 0x01000000, LENGTH = CONFIG_XRAM_SIZE |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 } |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 SECTIONS { |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 /* XIP code, going into flash or XRAM emulating flash */ |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 xip.text : { |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 *(xip.text*) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 xipcode.o(.text*) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 *libplus.xip.a:(.text*) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 *libsprintf.a:(.text*) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 /* let's put the ARM->Thumb veneers in the XIP section */ |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 *(.glue_7) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 } > Buildmem |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 /* copy-to-IRAM code */ |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 iram.text 0x80001C : { |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 /* the 7 exception and interrupt vectors @ 0x80001C */ |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 *(iram.vectors) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 *(iram.text*) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 iramcode.o(.text*) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 *libplus.iram.a:(.text*) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 *libc.a:(.text*) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 *libgcc.a:(.text*) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 } > IRAM AT> Buildmem |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 __iramtext_ram_addr = ADDR(iram.text); |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 __iramtext_flash_addr = LOADADDR(iram.text); |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 __iramtext_size = SIZEOF(iram.text); |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 /* all .rodata will stay in flash */ |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 .rodata : { |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 *(.rodata*) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 } > Buildmem |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 /* |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 * All .data will go into XRAM. |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 * For the flash build we'll have a step that copies |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 * the .data section from flash to XRAM; for the RAM-only |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 * build it goes directly into XRAM and stays there. |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 */ |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 .data : { |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 *(.data*) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 } > XRAM AT> Buildmem |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 ifelse(Buildmem,FLASH, |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 ` __initdata_ram_addr = ADDR(.data); |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 __initdata_flash_addr = LOADADDR(.data); |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 __initdata_size = SIZEOF(.data); |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 ')dnl |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 /* we have two kinds of BSS: internal and external */ |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 int.bss (NOLOAD) : { |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 *(int.bss*) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 iramcode.o(.bss* COMMON) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 *libplus.iram.a:(.bss* COMMON) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 *libc.a:(.bss* COMMON) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 *libgcc.a:(.bss* COMMON) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 . = ALIGN(4); |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 } > IRAM |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 __intbss_start = ADDR(int.bss); |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 __intbss_size = SIZEOF(int.bss); |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
81 |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
82 ext.bss (NOLOAD) : { |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 *(ext.bss*) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 xipcode.o(.bss* COMMON) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 *libplus.xip.a:(.bss* COMMON) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 *libsprintf.a:(.bss* COMMON) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 . = ALIGN(4); |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 } > XRAM |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
89 __extbss_start = ADDR(ext.bss); |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
90 __extbss_size = SIZEOF(ext.bss); |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
91 |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
92 /* finally, we have "raw RAM": like BSS, but we don't zero it out */ |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
93 int.ram (NOLOAD) : { |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
94 *(int.ram*) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
95 *(system_stack) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 *(irq_stack) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 *(fiq_stack) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
98 *(timer_hisr_stack) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
99 . = ALIGN(4); |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
100 _iram_end = .; |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
101 } > IRAM |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
103 ext.ram (NOLOAD) : { |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
104 *(ext.ram*) |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
105 . = ALIGN(4); |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 _xram_end = .; |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
107 } > XRAM |
f459043fae0c
nuc-fw config: ld script generation implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
108 } |