aboutsummaryrefslogtreecommitdiffstats
path: root/src/arch/arm/romstage.ld
blob: 65b133ad2c80b8072ee1acf3095881433e3cbba3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
 *	Memory map:
 *
 *	CONFIG_ROMSTAGE_BASE	: text segment
 *				: rodata segment
 *				: data segment
 *				: bss segment
 *				: stack
 *				: heap
 */
/*
 * Bootstrap code for the STPC Consumer
 * Copyright (c) 1999 by Net Insight AB. All Rights Reserved.
 */

/*
 *	Written by Johan Rydberg, based on work by Daniel Kahlin.
 *      Rewritten by Eric Biederman
 *  2005.12 yhlu add ramstage cross the vga font buffer handling
 */

/* We use ELF as output format. So that we can debug the code in some form. */

/* We use ELF as output format. So that we can debug the code in some form. */
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
INCLUDE ldoptions

ENTRY(stage_entry)

PHDRS
{
	to_load PT_LOAD;
}

SECTIONS
{
	/* TODO make this a configurable option (per chipset). */
	. = CONFIG_ROMSTAGE_BASE;

	.romtext . : {
		_rom = .;
		_start = .;
		*(.text.stage_entry.arm);
		*(.text.startup);
		*(.text);
	} : to_load

	.romdata . : {
		*(.rodata);
		*(.machine_param);
		*(.data);
		. = ALIGN(16);
		_car_migrate_start = .;
		*(.car.migrate);
		_car_migrate_end = .;
		. = ALIGN(16);
		_erom = .;
	}

	/* bss does not contain data, it is just a space that should be zero
	 * initialized on startup. (typically uninitialized global variables)
	 * crt0.S fills between _bss and _ebss with zeroes.
	 */
	.bss . : {
		. = ALIGN(8);
		_bss = .;
		*(.bss)
		*(.sbss)
		*(COMMON)
	}

	_ebss = .;

	.car.data . : {
		. = ALIGN(8);
		_car_data_start = .;
		*(.car.global_data);
		. = ALIGN(8);
		/* The cbmem_console section comes last to take advantage of
		 * a zero-sized array to hold the memconsole contents that
		 * grows to a bound of CONFIG_CONSOLE_CAR_BUFFER_SIZE. However,
		 * collisions within the cache-as-ram region cannot be
		 * statically checked because the cache-as-ram region usage is
		 * cpu/chipset dependent. */
		*(.car.cbmem_console);
		_car_data_end = .;
	}

	_end = .;

	/* TODO: check if we are running out of SRAM. Below check is not good
	 * enough though because SRAM has different size on different CPUs
	 * and not all SRAM is available to the romstage. On Exynos, some is
	 * used for BL1, the bootblock and the stack.
	 *
	 * _bogus = ASSERT((_end - _start + EXPECTED_CBMEM_CONSOLE_SIZE <= \
	 * 				0x54000), "SRAM area is too full");
	 */

	/* Discard the sections we don't need/want */
	/DISCARD/ : {
		*(.comment)
		*(.note)
		*(.comment.*)
		*(.note.*)
		*(.eh_frame);
	}
}