-
Notifications
You must be signed in to change notification settings - Fork 0
/
ucode.ld
63 lines (48 loc) · 1.43 KB
/
ucode.ld
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
OUTPUT_ARCH (mips)
#define BEGIN_SEG(name, addr) \
_##name##SegmentStart = ADDR(.name); \
_##name##SegmentRomStart = __romPos; \
.name addr : AT(__romPos)
#define END_SEG(name) \
_##name##SegmentEnd = ADDR(.name) + SIZEOF(.name); \
_##name##SegmentRomEnd = __romPos + SIZEOF(.name); \
__romPos += SIZEOF(.name);
#define BEGIN_UCODE_TEXT(name, addr) \
name##TextStart = ADDR(.name); \
name##TextRomStart = __romPos; \
.name addr : AT(__romPos)
#define END_UCODE_TEXT(name) \
name##TextEnd = ADDR(.name) + SIZEOF(.name); \
name##TextRomEnd = __romPos + SIZEOF(.name); \
__romPos += SIZEOF(.name);
#define BEGIN_UCODE_DATA(name, addr) \
name##DataStart = ADDR(.name##_data); \
name##DataRomStart = __romPos; \
.name##_data addr : AT(__romPos)
#define END_UCODE_DATA(name) \
name##DataEnd = ADDR(.name##_data) + SIZEOF(.name##_data); \
name##DataRomEnd = __romPos + SIZEOF(.name##_data); \
__romPos += SIZEOF(.name##_data);
#define BEGIN_NOLOAD(name) \
_##name##SegNoloadStart = ADDR(.name.noload); \
.name.noload (NOLOAD) :
#define END_NOLOAD(name) \
_##name##SegNoloadEnd = ADDR(.name.noload) + SIZEOF(.name.noload);
SECTIONS
{
__romPos = 0x0;
/* header and boot */
BEGIN_SEG(boot, 0x04001000) {
#ifdef TEXT
*(.text);
#endif
#ifdef DATA
*(.data);
#endif
}
END_SEG(boot)
/DISCARD/ :
{
*(*);
}
}