-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathMakefile.cfg
201 lines (171 loc) · 7.36 KB
/
Makefile.cfg
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
# dcload-ip Makefile Configuration
# Use by default the Sega Dreamcast toolchain built using dc-chain (KallistiOS)
# If you are using another toolchain built outside KallistiOS, comment this out.
USING_KOS_GCC = 1
# Detect the host
ROOTDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
include $(ROOTDIR)/Makefile.hostdetect
# Host compiler and flags
HOSTCC = gcc
HOSTCFLAGS = -O2 -I/usr/local/include
HOSTLDFLAGS = -L/usr/local/lib
# For MinGW/MSYS, MinGW-w64/MSYS2 and Cygwin
ifdef WINDOWS
HOSTCFLAGS += -D_WIN32
EXECUTABLEEXTENSION = .exe
endif
# dc compiler prefix -- this is usually what you used for --prefix when
# building your compiler. Note: BINTARGETPREFIX is just binutils.
ifdef USING_KOS_GCC
# Use these for Sega Dreamcast toolchain built using dc-chain (KallistiOS)
TARGETPREFIX = /opt/toolchains/dc/sh-elf
BINTARGETPREFIX = $(TARGETPREFIX)
else
# This is for portable sh4-elf-gcc GCC 9.2.0
TARGETPREFIX = /mnt/c/DreamcastKOS/gcc-sh4
BINTARGETPREFIX = /mnt/c/DreamcastKOS/binutils-sh4
endif
# dir to install dc-tool in
TOOLINSTALLDIR = /opt/toolchains/dc/bin
# To build dc-tool, we need to use libelf or libbfd
# By default, libelf is used, except for MinGW/MSYS which uses libbfd.
# libbfd is installed using dc-chain, an utility provided with KallistiOS.
# Define this if you want to use libbfd instead of libelf (which is default)
WITH_BFD = 0
# For MinGW/MSYS, we need to use libbfd instead of libelf
ifdef MINGW
WITH_BFD = 1
endif
# You may have to change the paths for BFDLIB and BFDINCLUDE to the correct
# ones for your system. These must point to your sh-elf BFD, not the system one!
# If you built your Sega Dreamcast toolchains with dc-chain, you'll have it
# installed in the correct location.
BFDLIB = $(TARGETPREFIX)/lib
BFDINCLUDE = $(TARGETPREFIX)/include
# When using libelf instead of BFD, these must point to your
# libelf installation (leave empty or undefined if libelf is part of the system)
ELFLIB = $(TARGETPREFIX)/lib
ELFINCLUDE = $(TARGETPREFIX)/include
# For macOS, libelf is here when installed through Homebrew
ifdef MACOS
ELFINCLUDE = /opt/homebrew/include
HOSTLDFLAGS += -L/opt/homebrew/lib
endif
# sh-elf-stuff
# You don't need to change these
ifdef USING_KOS_GCC
# Use these for Sega Dreamcast toolchain built using dc-chain (KallistiOS)
TARGETCC = $(TARGETPREFIX)/bin/sh-elf-gcc
TARGETCFLAGS = -Os -ml -m4-single-only
TARGETOBJCOPY = $(BINTARGETPREFIX)/bin/sh-elf-objcopy -R .stack
TARGETLD = $(BINTARGETPREFIX)/bin/sh-elf-ld
else
# This is for portable sh4-elf-gcc GCC 9.2.0
TARGETCC = $(TARGETPREFIX)/bin/sh4-elf-gcc
TARGETCFLAGS = -O2 -ml -m4-single-only -mpretend-cmove -Wpedantic
TARGETOBJCOPY = $(BINTARGETPREFIX)/bin/sh4-elf-objcopy -R .stack
TARGETLD = $(BINTARGETPREFIX)/bin/sh4-elf-ld
endif
# set TARGETCCVER to 3 or 4, depending on your SH compiler version (gcc 3.x or gcc 4.x)
# this line tries to detect the version automatically
# This only matters for building the example sources.
# Honestly, though, when was the last time anybody even tried GCC 3 on any of this?
# GCC 4 is looking more and more like it'll need to be dropped in favor of 9 in the future, as well.
# NOTE: GCC 9 can use the GCC 4 linker file.
# if version > 4 then it's 4
TARGETCCVER = $(shell $(TARGETCC) --version | head -1 | sed "s/.* \([[:digit:]][[:digit:]]*\)\.[[:digit:]][[:digit:]]*.*/\1/")
ifeq ($(shell test $(TARGETCCVER) -gt 4; echo $$?),0)
TARGETCCVER = 4
endif
# You generally shouldn't change this unless you are making forked
# versions (or test versions)
# Version numbers must be of the form x.x.x
VERSION = 2.0.1
# Define this if you want a standalone, statically linked, no dependency binary
#STANDALONE_BINARY = 1
# This is on by default for Windows (MinGW/MSYS, MinGW-w64/MSYS2 and Cygwin)
ifdef WINDOWS
STANDALONE_BINARY = 1
endif
#
# On a laptop and dc-tool's got your fans running too high?
# Enable this. It will slow dc-tool's network console down a teeny bit, but it'll
# drastically reduce CPU usage. Not necessary if on something like an 8-core desktop.
# Set to 1 to enable, 0 to disable.
#
SAVE_MY_FANS = 0
#
# This sets the number of seconds to show the register dump on-screen if an
# exception occurs. Maximum is 60 seconds, minimum is 0 seconds (no display),
# default is 15 seconds.
#
EXCEPTION_SECONDS = 15
#
# This sets a delay between data bursts that dc-tool sends to the Dreamcast.
# dcload-ip configures the Dreamcast BBA to use a 16kB receive buffer, while the
# LAN adapter has a 28kB buffer. So after a number of packets determined by
# BBA_RX_FIFO_DELAY_COUNT or LAN_RX_FIFO_DELAY_COUNT, dc-tool gives the Dreamcast
# a chance to empty its buffer.
#
# Decreasing TIME may increase network throughput performance, as it will
# shorten the delay time. However, making it too low will cause packets to be
# dropped by the Dreamcast. If dcload-ip says "link change" during receipt of
# dc-tool-ip data, that means the number is too low and a FIFO overflow occurred.
# Either cancel dc-tool-ip (ctrl + c) and try again, or increase the number in
# this case. ...At least, the link change message is true of the BBA. The LAN
# adapter has tendency to just hang and cut out, necessitating a reset of the
# console (and an increase in this number!). Note that seeing "idle" flash after
# an overrun link change means dropped packets are being re-sent. If this happens,
# network transfer performance will be significantly slower than in the "receiving
# data" state, and cancelling and retrying the transfer is recommended.
#
# NOTE: This value has no effect on dcload -> dc-tool data, which will always run
# as fast as possible (I've gotten 10MB/s with the BBA). Only dc-tool -> dcload
# data is affected by this. It's mainly to account for PCs having gigabit ethernet
# and the internal processing paths of dcload only being able to handle about 10MB/s
# (100mbit/s maxes at 12.5MB/s).
#
# Also, dcload-ip v2.0.0 takes 30000 SH4 cycles, or 0.00015 seconds (= 150
# microseconds), to process 1 packet of 1494 (1440 + headers) bytes destined for
# an 8-byte-aligned address. That *should* be able to sustain dc-tool -> dcload
# data at ~9.5MB/s, but I haven't been able to hit that. The most I could squeeze
# between overrun errors was 6.0MB/s with COUNT = 10, TIME = 1350.
#
# Some helpful guidelines, tested with a 15.6MB program:
# BBA:
# max (ideal conditions, 5.5MB/s):
# COUNT = 10
# TIME = 1500
# safe (4.3-4.6MB/s):
# COUNT = 10
# TIME = 2000
# LAN:
# max (ideal conditions, 1.1MB/s):
# COUNT = 1
# TIME = 1200
# safe (710KB/s-1.0MB/s):
# COUNT = 1
# TIME = 1250
#
# Note that dcload-ip v2.0.0+ packets are 1494 bytes per packet, unless -l is
# used to make them 1078 bytes.
#
# COUNT - Number of packets to send before waiting for DC to empty its RX FIFO
# TIME - How long to wait for DC to empty its RX FIFO, in microseconds
#
DREAMCAST_BBA_RX_FIFO_DELAY_COUNT = 10
DREAMCAST_BBA_RX_FIFO_DELAY_TIME = 1800
DREAMCAST_LAN_RX_FIFO_DELAY_COUNT = 1
DREAMCAST_LAN_RX_FIFO_DELAY_TIME = 1250
#
# IMPORTANT IP ADDRESS INFORMATION:
#
# Any IP in the 0.0.0.0/8 range, meaning 0.x.x.x, will enable DHCP mode.
# If in doubt, just use 0.0.0.0. Some routers may not accept other IPs.
#
# The IP of your Dreamcast - set to 169.254.xxx.xxx if you want to use arp on pc
#
# Note: IPs of the form 0.0.0.0 (no leading zeroes) or 000.000.000.000 (leading
# zeroes, 3 digits per octet) are both acceptable.
#
DREAMCAST_IP = 0.0.0.0