-
Notifications
You must be signed in to change notification settings - Fork 1
/
gba_cart.ld
75 lines (61 loc) · 1.31 KB
/
gba_cart.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* Gameboy Advanced ROM Linker Script
* https://github.com/ryankurte/rust-gba
*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
OUTPUT_ARCH(arm)
MEMORY
{
ROM : ORIGIN = 0x08000000, LENGTH = 32M
EWRAM : ORIGIN = 0x02000000, LENGTH = 256K
IWRAM : ORIGIN = 0x03000000, LENGTH = 32K
}
__text_start = ORIGIN(ROM);
__app_start = __text_start + 0xe0;
__eheap_end. = ORIGIN(EWRAM) + LENGTH(EWRAM);
__iwram_start = ORIGIN(IWRAM);
__iwram_top = ORIGIN(IWRAM) + LENGTH(IWRAM);
__sp_irq = __iwram_top - 0x060;
__sp_usr = __sp_irq - 0x0a0;
__irq_flags = 0x03007ff8;
SECTIONS
{
. = __text_start;
/* static data stored in cart ROM */
.header :
{
KEEP(*(.header.header));
} > ROM
.text : {
KEEP(*(.text.boot));
KEEP(*(.text.reset_handler));
KEEP(*(.text.isr));
*(.text .text.*);
. = ALIGN(4);
} > ROM
.rodata : {
*(.rodata .rodata.*);
. = ALIGN(4);
} > ROM
/* dynamic data placed in IWRAM */
.data : {
_sidata = LOADADDR(.data);
. = ALIGN(4);
_sdata = .;
*(.data);
. = ALIGN(4);
_edata = .;
} > IWRAM AT > ROM
.bss : {
. = ALIGN(4);
_sbss = .;
*(.bss);
. = ALIGN(4);
_ebss = .;
} > IWRAM
/* discard arm symbols */
/DISCARD/ :
{
*(.ARM.exidx .ARM.exidx.*);
}
}