summaryrefslogtreecommitdiff
path: root/ld_script.txt
blob: 1069264320c630513c18e39d7d4cb0a0706dcc49 (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
/* Linker Script to build Pokemon Diamond */

#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); \
    _##name##SegmentSize = SIZEOF(.name); \
    __romPos += SIZEOF(.name);

SECTIONS {
    __romPos = 0;
    BEGIN_SEG(header, 0x0)
    {
        build/asm/rom_header.o(.text);
    }
    END_SEG(header)
    
    __romPos += 0x3E00;

    BEGIN_SEG(arm9, 0x2000000)
    {
        build/asm/secure.o(.text);
        build/asm/entry.o(.text);
        build/asm/main.o(.text);
        build/src/sub_02000DF4.o(.text);
		build/asm/arm9_thumb.o(.text);
        build/asm/rom2.o(.text);
    }
    END_SEG(arm9)
    
    BEGIN_SEG(rom3, 0x2000000 + SIZEOF(arm9))
    {
        build/asm/rom3.o(.text);
    }
    END_SEG(rom3)

    BEGIN_SEG(gap1, 0x2000000 + SIZEOF(rom3) + SIZEOF(arm9))
    {
    	build/asm/gap1.o(.text);
    }
    END_SEG(gap1)

    BEGIN_SEG(arm7, 0x02380000)
    {
    	build/asm/arm7_rom.o(.text);
    }
    END_SEG(arm7)

    BEGIN_SEG(gap2, 0x02380000 + SIZEOF(arm7))
    {
    	build/asm/gap2.o(.text)
    }
    END_SEG(gap2)

	. = 0x336400;
    BEGIN_SEG(FileNameTable, 0x02400000)
    {
    	build/asm/filenametable.o(.text);
    }
    END_SEG(FileNameTable)
}