Repository navigation
Expand file tree
/
Copy pathenviron.sh.sample
More file actions
252 lines (226 loc) · 8.72 KB
/
Copy pathenviron.sh.sample
File metadata and controls
252 lines (226 loc) · 8.72 KB
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# KallistiOS Environment Settings
#
# This is a sample script for configuring and customizing your
# KOS build environment. Modify it to suit your setup. Several
# settings may be enabled optionally or are provided with
# alternative values.
#
# This script is typically sourced in your current shell environment
# (probably by .bashrc, .bash_profile, or something similar), so that
# the KOS environment is set up automatically for each shell session.
#
# Compiler Toolchain
#
# Set this to the name of the toolchain to use for building KOS and
# KOS projects.
#
# Valid values:
# "gcc" - Use GCC (default)
# "clang" - Use LLVM clang.
#
export KOS_TOOLCHAIN="gcc"
# Build Architecture
#
# Set the major architecture you'll be building for.
# The only option here is "dreamcast" as of KOS 2.0.0.
#
export KOS_ARCH="dreamcast"
# Build Sub-Architecture
#
# Defines the sub architecture your configuration
# is targeting or uses an existing value that
# can be set externally via your IDE.
#
# Only needs to be set if not using default.
#
# Valid values:
# "pristine" - Dreamcast console or HKT-0120 devkit (default)
# "naomi" - NAOMI or NAOMI 2 arcade board
#
#export KOS_SUBARCH="naomi"
# KOS Root Path
#
# Specifies the path to the KOS root directory
#
export KOS_BASE="/opt/toolchains/dc/kos"
# KOS-Ports Path
#
# Specifies the path to the KOS-ports directory
#
export KOS_PORTS="${KOS_BASE}/../kos-ports"
# SH Compiler Prefixes
#
# Specifies the path to and prefix for the main SH
# GCC toolchain used to target the Dreamcast's SH4 CPU.
#
export KOS_CC_BASE="/opt/toolchains/dc/sh-elf"
export KOS_CC_PREFIX="sh-elf"
# ARM Compiler Prefixes
#
# Specifies the path to and prefix for the additional ARM
# GCC toolchain used to target the Dreamcast's AICA SPU.
#
export DC_ARM_BASE="/opt/toolchains/dc/arm-eabi"
export DC_ARM_PREFIX="arm-eabi"
# External Dreamcast Tools Path
#
# Specifies the path where Dreamcast tools that are not part of KOS are to be
# installed. This includes, for example, dc-tool-ip, dc-tool-serial, and the
# mrbc bytecode compiler. This directory, along with SH and ARM compiler
# toolchains, will be added to your PATH environment variable.
#
export DC_TOOLS_BASE="/opt/toolchains/dc/bin"
# CMake Toolchain Path
#
# Specifies the path to the toolchain file used to target
# KOS with the "cmake" build utility.
#
export KOS_CMAKE_TOOLCHAIN="${KOS_BASE}/utils/cmake/kallistios.toolchain.cmake"
# Genromfs Utility Path
#
# Specifies the path to the utility which is used by KOS
# to create romdisk filesystem images.
#
export KOS_GENROMFS="${KOS_BASE}/utils/genromfs/genromfs"
# Make Utility
#
# Configures the tool to be used as the main "make" utility
# for building GNU Makefiles. On a platform such as BSD,
# the default can be changed to "gmake," for the GNU
# implementation.
#
export KOS_MAKE="make"
#export KOS_MAKE="gmake"
# Loader Utility
#
# Specifies the loader to be used with the "make run" targets
# in the KOS examples. Defaults to using a preconfigured version
# of dc-tool. Use one of the other options for a manual dc-tool-ip
# or dc-tool-serial configuration, remembering to change the values
# for the Dreamcast's IP address or the serial port interface.
#
export KOS_LOADER="dc-tool -x"
#export KOS_LOADER="dc-tool-ip -t 192.168.1.100 -x"
#export KOS_LOADER="dc-tool-ser -t /dev/ttyS0 -x"
# GDB utility
#
# The kos-gdb helper will attempt to auto-detect the proper GDB program
# to use. You can force it by specifying the path here.
#export KOS_GDB="sh-elf-gdb"
# Default Compiler Flags
#
# Resets build flags. You can also initialize them to some preset
# default values here if you wish.
#
export KOS_INC_PATHS=""
export KOS_CFLAGS=""
export KOS_CPPFLAGS=""
export KOS_LDFLAGS=""
export KOS_AFLAGS=""
export DC_ARM_LDFLAGS=""
# Debug Options
#
# NDEBUG controls whether to disable `assert` per C standard, and
# DBGLOG_DISABLED controls whether other debug output will be provided
# (see ./kos/dbglog.h). Enable these if you want to remove assert checks
# and disable logging output, as is desirable for release builds.
#
#export KOS_CFLAGS="${KOS_CFLAGS} -DNDEBUG -DDBGLOG_DISABLED"
# Optimization Level
#
# Controls the baseline optimization level to use when building.
# Typically this is -Og (debugging), -O0, -O1, -O2, or -O3.
# NOTE: For our target, -O4 is a valid optimization level that has
# been seen to have some performance impact as well.
#
export KOS_CFLAGS="${KOS_CFLAGS} -O2"
# Link-Time Optimization
#
# Uncomment this to enable LTO, which can substantially improve performance
# of the generated code by enabling the linker to perform inlining, at the
# cost of longer build times and fatter object files.
# NOTE: Certain ports and examples require fat LTO objects to work with LTO,
# and LTO itself is known to cause issues in code with undefined behavior.
#
#export KOS_CFLAGS="${KOS_CFLAGS} -flto=auto -ffat-lto-objects"
# Additional Optimizations
#
# Uncomment these to enable what have been found empirically to be a decent
# set of additional flags for optimal release build performance with the
# current stable toolchain.
#
#export KOS_CFLAGS="${KOS_CFLAGS} -freorder-blocks-algorithm=simple"
#export KOS_CFLAGS="${KOS_CFLAGS} -fipa-pta"
# Position-Independent Code
#
# Comment this line out to enable position-independent code. Codegen is slightly
# slower, and you lose a register, but it's required when building dynamically
# linked libraries or code whose symbols aren't resolved until runtime.
#
export KOS_CFLAGS="${KOS_CFLAGS} -fno-PIC -fno-PIE"
# Frame Pointers
#
# Frame pointers are always disabled — they use an extra register and do not
# work reliably on SH4. Stack tracing uses heuristic SP scanning instead.
#
export KOS_CFLAGS="${KOS_CFLAGS} -fomit-frame-pointer"
# Stack Protector
#
# Controls whether GCC emits extra code to check for buffer overflows or stack
# smashing, which can be very useful for debugging. -fstack-protector only
# covers vulnerable objects, while -fstack-protector-strong provides medium
# coverage, and -fstack-protector-all provides full coverage. You may also
# override the default stack excepton handler by providing your own
# implementation of "void __stack_chk_fail(void)."
#
#export KOS_CFLAGS="${KOS_CFLAGS} -fstack-protector-all"
# GCC Builtin Functions
#
# Uncomment this line to prevent GCC from using its own builtin implementations of
# certain standard library functions. Under certain conditions, using builtins
# allows for compiler-optimized routines to replace function calls to the C standard
# library which are backed by Newlib or KOS.
#
#export KOS_CFLAGS="${KOS_CFLAGS} -fno-builtin"
# Fast Math Instructions
#
# Uncomment this line to enable the optimized fast-math instructions (FSSRA,
# FSCA, and FSQRT) for calculating sin/cos, inverse square root, and square roots.
# These can result in substantial performance gains for these kinds of operations;
# however, they do so at the price of accuracy and are not IEEE compliant.
# NOTE: If these cause issues when enabled globally, it's advised to try to enable
# them on individual files in the critical path to still gain performance.
#
#export KOS_CFLAGS="${KOS_CFLAGS} -fbuiltin -ffast-math -ffp-contract=fast"
# SH4 Floating-Point Arithmetic Precision
#
# KallistiOS supports both the single-precision-default ABI (m4-single) and the
# single-precision-only ABI (m4-single-only). When using m4-single, the SH4 will
# be in single-precision mode upon function entry but will switch to double-
# precision mode if 64-bit doubles are used. When using m4-single-only, the SH4
# will always be in single-precision mode and 64-bit doubles will be truncated to
# 32-bit floats. Historically, m4-single-only was used in both official and
# homebrew Dreamcast software, but m4-single is the default as of KOS 2.2.0 to
# increase compatibility with newer libraries which require 64-bit doubles.
#
# WARNING: When adjusting this setting, make sure all software, including
# kos-ports and linked external libraries, are rebuilt using the same
# floating-point precision ABI setting!
#
export KOS_SH4_PRECISION="-m4-single"
# Use LRA (Local Register Allocator) Pass
#
# Uncomment this line to use the modern Local Register Allocator pass during
# code generation instead of the default older reload pass. This option is
# known to be unstable or less performant for SH at this time, but will likely
# become mandatory in future versions of GCC, so feel free to help us test.
# Only enable this setting if you understand what you are doing!
#
#export KOS_CFLAGS="${KOS_CFLAGS} -mlra"
# Shared Compiler Configuration
#
# Include sub architecture-independent configuration file for shared
# environment settings. If you want to configure additional compiler
# options or see where other build flags are set, look at this file.
#
. ${KOS_BASE}/env/environ_base.sh