-
Notifications
You must be signed in to change notification settings - Fork 1
/
hirtos_compiler_flags.gpr
134 lines (120 loc) · 6.12 KB
/
hirtos_compiler_flags.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
--
-- Copyright (c) 2022-2023, German Rivera
--
--
-- SPDX-License-Identifier: Apache-2.0
--
abstract project Hirtos_Compiler_Flags is
type CPU_Core_Type is ("arm_cortex_m0plus", "arm_cortex_m4", "arm_cortex_r5", "arm_cortex_r52", "riscv32");
CPU_Core : CPU_Core_Type := External ("CPU_Core", "arm_cortex_r52");
CPU_Arch := "";
Target_Compiler_Selector := "";
CPU_Core_Switches := ();
Build_Profile_Switches := ();
case CPU_Core is
when "arm_cortex_m0plus" =>
CPU_Arch := "arm_cortex_m";
Target_Compiler_Selector := "arm-abi";
CPU_Core_Switches := ("-mcpu=cortex-m0plus",
"-mthumb",
--"-march=armv6-m",
"-mlittle-endian",
"-fno-omit-frame-pointer");
when "arm_cortex_m4" =>
CPU_Arch := "arm_cortex_m";
Target_Compiler_Selector := "arm-eabi";
CPU_Core_Switches := ("-mcpu=cortex-m4",
"-mthumb",
--"-march=armv7e-m",
"-mlittle-endian",
--"-mfloat-abi=softfp",
"-mhard-float",
"-mfpu=fpv4-sp-d16",
"-fno-omit-frame-pointer");
when "arm_cortex_r5" =>
CPU_Arch := "armv7r";
Target_Compiler_Selector := "arm-eabi";
CPU_Core_Switches := ("-mcpu=cortex-r5",
"-mlittle-endian",
"-mfloat-abi=softfp",
"-mfpu=vfpv3xd",
--"-mfpu=fpv5-sp-d16",
"-fno-omit-frame-pointer",
"-funwind-tables");
when "arm_cortex_r52" =>
CPU_Arch := "armv8r_aarch32";
Target_Compiler_Selector := "arm-eabi";
CPU_Core_Switches := ("-mcpu=cortex-r52",
--"-march=armv8-r",
"-mlittle-endian",
--"-mfloat-abi=softfp",
"-mhard-float",
"-mfpu=fp-armv8",
"-fno-omit-frame-pointer");
when "riscv32" =>
CPU_Arch := "riscv32";
Target_Compiler_Selector := "riscv64-elf";
-- ‘g’ will expand to ‘i’, ‘m’, ‘a’, ‘f’, ‘d’, ‘zicsr’ and ‘zifencei’.
-- 'zbb' Basic bit manipulation extension.
CPU_Core_Switches := ("-march=rv32imc_zicsr_zifencei", -- rv32gc_zbb
"-mabi=ilp32",
"-mcmodel=medany");
when others =>
null;
end case;
package Compiler is
-- COMMON_FLAGS here is common flags (used for C and Ada).
COMMON_FLAGS := CPU_Core_Switches &
("-fcallgraph-info=su,da",
"-ffunction-sections",
"-fdata-sections",
--"-fverbose-asm",
"-fstack-usage",
--"-fstack-check", -- Generate stack checking code
"-Wall");
ADAFLAGS := COMMON_FLAGS &
("-gnatwa" -- Enable all warnings
,"-gnatw.X" -- Disable warnings for No_Exception_Propagation
,"-gnatVa" -- All validity checks
,"-gnaty3" -- Specify indentation level of 3
,"-gnatya" -- Check attribute casing
,"-gnatyA" -- Use of array index numbers in array attributes
,"-gnatyB" -- Check Boolean operators
,"-gnatyb" -- Blanks not allowed at statement end
,"-gnatyc" -- Check comments
,"-gnaty-d" -- Disable check no DOS line terminators present
,"-gnatye" -- Check end/exit labels
,"-gnatyf" -- No form feeds or vertical tabs
,"-gnatyh" -- No horizontal tabs
,"-gnatyi" -- Check if-then layout
,"-gnatyI" -- check mode IN keywords
,"-gnatyk" -- Check keyword casing
,"-gnatyl" -- Check layout
,"-gnatyn" -- Check casing of entities in Standard
,"-gnatyO" -- Check that overriding subprograms are explicitly marked as such
,"-gnatyp" -- Check pragma casing
,"-gnatyr" -- Check identifier references casing
,"-gnatyS" -- Check no statements after THEN/ELSE
,"-gnatyt" -- Check token spacing
,"-gnatyu" -- Check unnecessary blank lines
,"-gnatyx" -- Check extra parentheses
--,"-gnatQ" -- Don't quit. Generate ALI and tree files even if illegalities
,"-gnato13" -- Overflow checking (part of Ada)
,"-gnatf" -- Full, verbose error messages
,"-gnatyM120" -- Check maximum line length
,"-gnatef" -- Print full path in error messages
,"-gnata" -- Enable assertions and contracts
,"-gnatwe" -- Warnings as errors
,"-gnat2022" -- Use Ada 2022
,"-nostdinc" -- Inhibit the search of the default location for the GNAT Run Time Library (RTL) source files.
,"-nostdlib" -- Inhibit the search of the default location for the GNAT Run Time Library (RTL) ALI files.
,"-gdwarf-4" -- To generate correct source-line info
);
Development_Only_Flags := ("-Og", -- No optimization
"-g"); -- Debug info
Release_Only_Flags := ("-O3", -- Optimize for performance
"-gnatn", -- Enable inlining
"-gnatp"); -- Suppress all runtime checks
for Local_Configuration_Pragmas use "gnat_pragmas.adc";
end Compiler;
end Hirtos_Compiler_Flags;