afdf8a5522285b17970bcdd35897ed423430a89e
[coreboot.git] / src / config / coreboot_ram.ld
1 /*
2  *      Memory map:
3  *
4  *      CONFIG_RAMBASE          
5  *                              : data segment
6  *                              : bss segment
7  *                              : heap
8  *                              : stack
9  */
10 /*
11  * Bootstrap code for the STPC Consumer
12  * Copyright (c) 1999 by Net Insight AB. All Rights Reserved.
13  */
14
15 /*
16  *      Written by Johan Rydberg, based on work by Daniel Kahlin.
17  *      Rewritten by Eric Biederman
18  *  2005.12 yhlu add coreboot_ram cross the vga font buffer handling
19  */
20 /*
21  *      We use ELF as output format. So that we can
22  *      debug the code in some form. 
23  */
24 INCLUDE ldoptions
25
26 ENTRY(_start)
27
28 SECTIONS
29 {
30         . = CONFIG_RAMBASE;
31         /*
32          * First we place the code and read only data (typically const declared).
33          * This get placed in rom.
34          */
35         .text : {
36                 _text = .;
37                 *(.text);
38                 *(.text.*);
39                 . = ALIGN(16);
40                 _etext = .;
41         }
42         .rodata : {
43                 _rodata = .;
44                 . = ALIGN(4);
45                 console_drivers = .;
46                 *(.rodata.console_drivers)
47                 econsole_drivers = . ;
48                 . = ALIGN(4);
49                 pci_drivers = . ;
50                 *(.rodata.pci_driver)
51                 epci_drivers = . ;
52                 cpu_drivers = . ;
53                 *(.rodata.cpu_driver)
54                 ecpu_drivers = . ;
55                 *(.rodata)
56                 *(.rodata.*)
57                 /*
58                  * kevinh/Ispiri - Added an align, because the objcopy tool
59                  * incorrectly converts sections that are not long word aligned.
60                  * This breaks the coreboot.rom target.
61                  */
62                  . = ALIGN(4);
63
64                 _erodata = .;
65         }       
66         /*
67          * After the code we place initialized data (typically initialized
68          * global variables). This gets copied into ram by startup code.
69          * __data_start and __data_end shows where in ram this should be placed,
70          * whereas __data_loadstart and __data_loadend shows where in rom to
71          * copy from.
72          */
73         .data : {
74                 _data = .;
75                 *(.data)
76                 _edata = .;
77         }
78
79         .sdata : {
80                 _SDA_BASE_ = .;
81                 *(.sdata)
82         }
83
84         .sdata2 : {
85                 _SDA2_BASE_ = .;
86                 *(.sdata2)
87         }
88
89         /*
90          * bss does not contain data, it is just a space that should be zero
91          * initialized on startup. (typically uninitialized global variables)
92          * crt0.S fills between _bss and _ebss with zeroes.
93          */
94         _bss = .;
95         .bss . : {
96                 *(.bss)
97                 *(.sbss)
98                 *(COMMON)
99         }
100         _ebss = .;
101         _end = .;
102         . = ALIGN(CONFIG_STACK_SIZE);
103         _stack = .;
104         .stack . : {
105                 /* Reserve a stack for each possible cpu */
106                 /* the stack for ap will be put after pgtbl in 1M to CONFIG_RAMTOP range when VGA and ROM_RUN and CONFIG_RAMTOP>1M*/
107                 . = ((CONFIG_CONSOLE_VGA || CONFIG_PCI_ROM_RUN)&&(CONFIG_RAMBASE<0x100000)&&(CONFIG_RAMTOP>0x100000) ) ? CONFIG_STACK_SIZE : (CONFIG_MAX_CPUS*CONFIG_STACK_SIZE);
108         }
109         _estack = .;
110         _heap = .;
111         .heap . : {
112                 /* Reserve CONFIG_HEAP_SIZE bytes for the heap */
113                 . = CONFIG_HEAP_SIZE ;
114                 . = ALIGN(4);
115         }
116         _eheap = .;
117         /* The ram segment
118          * This is all address of the memory resident copy of coreboot.
119          */
120         _ram_seg = _text; 
121         _eram_seg = _eheap;
122
123         _bogus = ASSERT( ( _eram_seg < (CONFIG_RAMTOP)) , "please increase CONFIG_RAMTOP");
124
125         _bogus = ASSERT( !((CONFIG_CONSOLE_VGA || CONFIG_PCI_ROM_RUN) && ((_ram_seg<0xa0000) && (_eram_seg>0xa0000))) , "please increase CONFIG_RAMTOP and if still fail, try to set CONFIG_RAMBASE more than 1M");
126
127         /DISCARD/ : {
128                 *(.comment)
129                 *(.note)
130                 *(.note.*)
131         }
132 }