dcload is a Sega Dreamcast (DC) serial loader written originally by Andrew Kieschnick, a.k.a. ADK/Napalm. It is currently maintained as a part of KallistiOS (KOS).
dcload is a set of programs made to send and receive data from your Sega Dreamcast system. The classic use of this tool is to send programs to the Dreamcast in order to run and debug them. To be used, you must have a way to connect your Dreamcast console to your computer, it can be one of the following:
- A Coders Cable (a serial cable, the historical way to do that). It can be
a cable with the classical
RS-232/DE-9connector or with aUSB-Serialmodule. - A Broadband Adapter, ref.
HIT-400, often shortened as BBA, a10/100MbitsEthernet network card. - A LAN Adapter, ref.
HIT-300, a10MbitsEthernet network card.
If you have a Coders Cable, you have to use dcload-serial. For the Broadband
Adapter or LAN Adapter, you have to use dcload-ip.
dcload is split in two components:
dcload, the server part, meant to be run on the Dreamcast;dc-tool, the client part, executed from your computer.
- Load
elf,srecandbin(binary transfers are compressed). - PC I/O (read, write from/to the PC).
- Exception handler.
- Debug Dreamcast programs remotely by using the GDB-over-dcload feature.
- You should have a working
KallistiOS (KOS) environment and
of course the
sh-elftoolchain installed (if you have installed KOS, you already have everything ready). - Edit the
Makefile.cfgfile for your system and then runmake.
Run make install: this will install dc-tool-ser on your computer (default in
/opt/toolchains/dc/bin).
For the Dreamcast part, you have two options.
-
Directly burn to a disc by using
cdrecord:- Navigate to
make-cd. - Edit the
Makefile. - Insert blank CD-R.
- Run
make. If the1ST_READ.BINfile hasn't been built yet, thisMakefilewill build it.
- Navigate to
-
Create a Padus DiscJuggler (
CDI) image to burn later (requires themkisofsandcdi4dctools):make -C ./host-src/misc(build the miniLZO binary)make -C ./target-src(build the1ST_READ.BIN)mkisofs -C 0,11702 -V dcload-serial -G ./make-cd/IP.BIN -joliet -rock -l -o temp.iso ./target-src/1st_read/1st_read.bincdi4dc temp.iso dcload-serial.cdi
Everything is located in the example-src directory.
dc-tool-ser -x console-test: tests some PC I/Odc-tool-ser -x exception-test: generates an exception
You have the possibility to use dcload to debug remotely Dreamcast binaries. To run a GNU debugger session over the dcload connection:
- Build/obtain an
sh-elftargetted GNU debugger (can be made withdc-chainutility from KallistiOS). - Put a
gdb_init()call somewhere in the startup area of your KOS-based program (e.g. it's a good idea to put this call in yourmain()), then add the#include <arch/gdb.h>statement in that file. - Build your program with the
-gGCC switch to include debugging info. - Launch your program using
dc-tool-ser -g -x <sh-executable>. - Launch
sh-elf-gdband connect to thedc-toolusingtarget remote :2159. - Squash bugs.
- dcload, both IP and Serial, are maintained by the KOS team. Please join the KallistiOS list for help with these tools.
- Tested systems: Debian GNU/Linux 2.2; Gentoo/Linux 2.6.7; Cygwin; Mac OSX 10.3.5 (Panther); macOS 10.15.2 (Catalina), MinGW/MSYS, DreamSDK, MinGW-w64/MSYS2.
- To attain the highest speeds with
dcload-serial, you need to select aUSB-Serialmodule that matches the baudrates that the Dreamcast's SH-4 cpu can generate. Above115200, the SH-4 cpu generates the following baudrates:223214,260416,312500,390625,520833,781250,1562500.- Silicon Labs CP2102N-based chips have a good match with the SH-4, so you're pretty much guaranteed to attain the highest speed,
1562500. - FTDI FT232*-based chips do no match the SH-4 baudrates closely enough, so
781250will work, but1.56Mwill depend on your specific chip (ie, chip luck)
- Silicon Labs CP2102N-based chips have a good match with the SH-4, so you're pretty much guaranteed to attain the highest speed,
- Examples of how to launch a program:
- Linux:
dc-tool-ser -t /dev/usb/tts/0 -b 1500000 -x <sh-executable> - Windows:
dc-tool-ser -t COM4 -b 500000 -x <sh-executable> - macOS:
dc-tool-ser -t /dev/cu.usbserial-A50285BI -b 1500000 -x <sh-executable>
- Linux:
- As of
1.0.4, little-endian byte order is enforced in the host so dc-tool now runs on big-endian systems like a Mac. - As of
1.0.3, serial speed is changed at runtime rather than compile time. 115200works fine in most cases but57600baud is the standard baud. There is an-eoption that will enable an alternate115200which may work better in some rare cases. Use this only if the regular115200is unstable.234000will probably only work with the-eoption enabled.- Patches and improvements are welcome.
- This was tested on Catalina 10.15.2 only, however it should work on pretty much any version of macOS.
- Of course some sort of USB serial adapter must be used. The standard FT232RL USB-Serial boards from China that are sold pretty much everywhere work great and are super cheap.
- Modern macOS supports the same speeds as the other platforms, currently
up to
1.56Mbaud (-b 1500000). This was tested using Catalina and an FT232RL. - Compilation on macOS requires
libelf, which can be easily installed using the Homebrew package manager:brew install libelf - The static compilation option cannot be used on macOS due to the way GCC
works on macOS. However, when building the standard dynamically linked build,
only libSystem is linked (confirmed with
otool -L) which is available on all macOS systems, so the binary should still be just as portable.
- miniLZO was written by Markus Oberhumer.
- There are some various files from
newlib-1.8.2here andvideo.swas written by Marcus Comstedt. - Win32 porting and implementation of
-tby Florian 'Proff' Schulze. - Bugfix and implementation of
-bby The Gypsy. - Fixes for Cygwin by Florian 'Proff' Schulze.
- Minor initialization fix in dcload for
gcc-3.4.xand Serial protocol endian fixes by Paul Boese a.k.a. Axlen. - Fixes for Mac OSX (and testing) by Dan Potter.
- Fixes for
libbfdsegfaults by Atani. - Tons of improvements and fixes by SiZiOUS.
- Modern macOS testing by Ben Baron a.k.a. einsteinx2.