-
Notifications
You must be signed in to change notification settings - Fork 1
/
GBA_Program.gpr
100 lines (81 loc) · 2.74 KB
/
GBA_Program.gpr
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
-- Copyright (c) 2023 Devin Hill
-- zlib License -- see LICENSE for details.
abstract project GBA_Program is
for Languages use ("Ada", "Asm_Cpp", "C");
for Target use "arm-eabi";
for Runtime ("Ada") use GBA_Program'Project_Dir & "gba-rts";
package Naming is
for Casing use "mixedcase";
for Dot_Replacement use ".";
end Naming;
type Code_Linkage_Mode is
( "EWRAM" -- Link in multiboot mode, putting .text into 256k .ewram
, "ROM" -- Link in normal mode, putting .text into 32mb read-only segment
);
Code_Linkage : Code_Linkage_Mode := external ("codelinkage", "ROM");
Linker_File := "";
case Code_Linkage is
when "EWRAM" => Linker_File := GBA_Program'Project_Dir & "link_scripts/gba_mb.ld";
when "ROM" => Linker_File := GBA_Program'Project_Dir & "link_scripts/gba_cart.ld";
end case;
package Compiler is
Default_Arch := "";
Common_Options :=
( "-mcpu=arm7tdmi"
, "-mfloat-abi=soft"
, "-mthumb-interwork"
, "-nostartfiles"
, "-nodefaultlibs"
, "-nostdlib"
, "-nolibc"
, "-ffunction-sections"
, "-fdata-sections"
, "-fomit-frame-pointer"
, "-freg-struct-return"
, "-fstrict-volatile-bitfields"
, "-flto"
, "-ffat-lto-objects"
, "-fverbose-asm"
, "-save-temps"
);
Ada_Style_Options :=
( "-gnatyN"
, "-gnaty2aAbBChiklOprx"
);
Ada_Warning_Options :=
( "-gnatwA"
, "-gnatw_a.a.Bc.cDEI.i.kmO.pq.rv.wx"
, "-gnatwe"
);
Common_Ada_Options :=
Ada_Warning_Options &
Ada_Style_Options &
( "-gnatp"
, "-gnatj80"
, "-gnatX"
, "-gnatn"
, "-O2"
, "-g"
);
case Code_Linkage is
when "EWRAM" => Default_Arch := "-mthumb";
when "ROM" => Default_Arch := "-mthumb";
end case;
for Default_Switches ("C") use Common_Options & ("-O2", "-g", "-ffreestanding");
for Default_Switches ("Asm_Cpp") use Common_Options & ("-g", "-ffreestanding");
for Default_Switches ("Ada") use Common_Options & Common_Ada_Options & Default_Arch;
end Compiler;
package Linker is
Default_Switches := ( );
for Required_Switches use
( "-nostartfiles"
, "-nodefaultlibs"
, "-nolibc"
, "-static"
, "-T" & Linker_File
, "-Wl,-gc-sections,-flto"
, "-Wno-lto-type-mismatch"
, "-g3"
);
end Linker;
end GBA_Program;