|
From: <ap...@us...> - 2024-05-31 15:24:56
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "An ethernet program loader for the Dreamcast.".
The branch, master has been updated
via f72d699af8910f0761a916c4a61b257497400046 (commit)
via 202004c2a60c88992215af92c12a35971d412773 (commit)
via da74440abb0bc6621a6f4f29b32027e226b3ce71 (commit)
via 0a58ce95f1196326186bd4b5d98a2b6c9295d588 (commit)
via 6962ada68202f114fb13f52c48936179422f6d26 (commit)
via 11d5c8eea1395f9acfe8b1d9841a3a0d97b6b039 (commit)
via e1ab0cd1fce9142370095f977790ed2babc4e39b (commit)
from 42808da661163387f678ddb99819f27c5b11b95c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit f72d699af8910f0761a916c4a61b257497400046
Merge: 42808da 202004c
Author: Falco Girgis <gyr...@gm...>
Date: Fri May 31 10:21:49 2024 -0500
Merge pull request #5 from andressbarajas/MoopOverhaul
#4 Moop overhaul
commit 202004c2a60c88992215af92c12a35971d412773
Author: Andress Barajas <and...@gm...>
Date: Mon Jun 5 21:20:54 2023 -0700
Spacing once more
commit da74440abb0bc6621a6f4f29b32027e226b3ce71
Author: Andress Barajas <and...@gm...>
Date: Mon Jun 5 21:19:21 2023 -0700
Spacing
commit 0a58ce95f1196326186bd4b5d98a2b6c9295d588
Author: Andress Barajas <and...@gm...>
Date: Mon Jun 5 21:13:57 2023 -0700
Spacing and ignore .map files
commit 6962ada68202f114fb13f52c48936179422f6d26
Merge: 11d5c8e 42808da
Author: Andress Barajas <and...@gm...>
Date: Mon Jun 5 21:07:05 2023 -0700
Merge branch 'master' into MoopOverhaul
commit 11d5c8eea1395f9acfe8b1d9841a3a0d97b6b039
Author: Andress Barajas <and...@gm...>
Date: Mon Jun 5 20:52:27 2023 -0700
Some style changes
commit e1ab0cd1fce9142370095f977790ed2babc4e39b
Author: Andress Barajas <and...@gm...>
Date: Mon Jun 5 19:56:00 2023 -0700
Initial dump of Moop changes
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 2 +
CHANGES | 5 +-
Makefile.cfg | 73 +++-
example-src/gethostinfo.c | 3 +-
host-src/tool/Makefile | 26 +-
host-src/tool/commands.h | 4 +-
host-src/tool/dc-tool.c | 453 +++++++++++----------
host-src/tool/utils.c | 69 +++-
host-src/tool/utils.h | 3 +-
target-inc/string.h | 20 +-
target-src/1st_read/Makefile | 6 +-
target-src/1st_read/loader.s | 17 +
target-src/dcload/Makefile | 18 +-
target-src/dcload/adapter.c | 4 +-
target-src/dcload/adapter.h | 8 +-
target-src/dcload/cdfs_redir.s | 7 +
target-src/dcload/cdfs_syscalls.c | 6 +-
target-src/dcload/commands.c | 269 +++++++++++--
target-src/dcload/commands.h | 23 +-
target-src/dcload/dcload-crt0.s | 35 ++
target-src/dcload/dcload.c | 614 ++++++++++++++++++++++++++---
target-src/dcload/dcload.h | 93 ++++-
target-src/dcload/{dcload.c => dcload.old} | 2 +-
target-src/dcload/dcload.x | 41 +-
target-src/dcload/dhcp.c | 517 ++++++++++++++++++++++++
target-src/dcload/dhcp.h | 170 ++++++++
target-src/dcload/go.h | 2 +-
target-src/dcload/lan_adapter.c | 52 ++-
target-src/dcload/maple.c | 9 +-
target-src/dcload/memcmp.c | 4 +-
target-src/dcload/net.c | 424 ++++++++++----------
target-src/dcload/net.h | 23 +-
target-src/dcload/packet.c | 90 +++--
target-src/dcload/packet.h | 7 +-
target-src/dcload/perfctr.c | 244 ++++++++++++
target-src/dcload/perfctr.h | 316 +++++++++++++++
target-src/dcload/rtl8139.c | 99 +++--
target-src/dcload/rtl8139.h | 3 +-
target-src/dcload/syscalls.c | 75 ++--
39 files changed, 3127 insertions(+), 709 deletions(-)
copy target-src/dcload/{dcload.c => dcload.old} (99%)
create mode 100644 target-src/dcload/dhcp.c
create mode 100644 target-src/dcload/dhcp.h
create mode 100644 target-src/dcload/perfctr.c
create mode 100644 target-src/dcload/perfctr.h
diff --git a/.gitignore b/.gitignore
index 932cb01..a1a97ee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,8 @@
*.srec
*.exe
*.elf
+*.asm
+*.map
.DS_Store
example-src/console-test
example-src/exception-test
diff --git a/CHANGES b/CHANGES
index 0e5dd3d..cab13c6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,6 @@
WHATS NEW IN 1.0.4
-* Maintenance versions of dcload moved into the CA CVS repository on
+* Maintenance versions of dcload moved into the CA CVS repository on
SourceForge with the blessings of adk. Please send future bug reports and
patches to ba...@al.... If there is sufficient demand, we'll setup
a separate mailing list for it, but you can also join the KOS mailing
@@ -20,7 +20,7 @@ WHATS NEW IN 1.0.4
WHATS NEW IN 1.0.3
* actually seems to be working right, unlike 1.0.1 and 1.0.2, which were both
- buggy as hell under many (most?) conditions. If 1.0.1 and 1.0.2 locked up,
+ buggy as hell under many (most?) conditions. If 1.0.1 and 1.0.2 locked up,
went berzerk, or did other strange and horrible things when you used them,
try 1.0.3.
* dc-tool should now be able to recover from dropped packets in nearly all
@@ -47,4 +47,3 @@ WHATS NEW IN 1.0.1
WHATS NEW IN 1.0.0
* initial release of dcload-ip
-
diff --git a/Makefile.cfg b/Makefile.cfg
index 4402d1c..46e62d7 100644
--- a/Makefile.cfg
+++ b/Makefile.cfg
@@ -1,5 +1,8 @@
# dcload-ip Makefile Configuration
+# Uncomment this if using KOS
+USING_KOS_GCC = 1
+
# Detect the host
ROOTDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
include $(ROOTDIR)/Makefile.hostdetect
@@ -16,8 +19,17 @@ ifdef WINDOWS
endif
# dc compiler prefix -- this is usually what you used for --prefix when
-# building your compiler.
-TARGETPREFIX = /opt/toolchains/dc/sh-elf
+# building your compiler. Note: BINTARGETPREFIX is just binutils.
+
+ifdef USING_KOS_GCC
+ # Use these for GCC 4.x (for KOS)
+ 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
@@ -33,41 +45,70 @@ ifdef MINGW
WITH_BFD = 1
endif
-# You may have to change the paths for BFDLIB and BFDINCLUDE to the correct
+# 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 the dc-chain with the v0.4, you'll have it installed in the
# correct location.
-BFDLIB = $(TARGETPREFIX)/lib
-BFDINCLUDE = $(TARGETPREFIX)/include
+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
+ELFLIB = $(TARGETPREFIX)/lib
+ELFINCLUDE = $(TARGETPREFIX)/include
# For macOS, libelf is here when installed through Homebrew
ifdef MACOS
- ELFINCLUDE = /usr/local/include/libelf
+ ELFINCLUDE = /usr/local/include/libelf
endif
# sh-elf-stuff
# You don't need to change these
-TARGETCC = $(TARGETPREFIX)/bin/sh-elf-gcc
-TARGETCFLAGS = -O2 -ml -m4-single-only
-TARGETOBJCOPY = $(TARGETPREFIX)/bin/sh-elf-objcopy -R .stack
-TARGETLD = $(TARGETPREFIX)/bin/sh-elf-ld
+
+ifdef USING_KOS_GCC
+ # Use these for GCC 4.x (for KOS)
+ 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 -Wpedantic -Wno-address-of-packed-member
+ 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
-TARGETCCVER = $(shell $(TARGETCC) --version | head -1 | sed "s/.* \([[:digit:]][[:digit:]]*\)\.[[:digit:]][[:digit:]]*.*/\1/")
+#TARGETCCVER = $(shell $(TARGETCC) --version | head -1 | sed "s/.* \([[:digit:]][[:digit:]]*\)\.[[:digit:]][[:digit:]]*.*/\1/")
+TARGETCCVER = 4
# You generally shouldn't change this unless you are making forked
# versions (or test versions)
-VERSION = 1.0.5
+VERSION = 1.0.5
# Define this if you want a standalone, statically linked, no dependency binary
# This is on by default for MinGW/MSYS
#STANDALONE_BINARY = 1
-# The IP of your dreamcast - set to 000.000.000.000 if you want to use arp on pc
-DREAMCAST_IP = 000.000.000.000
+# 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
+
+#
+# IMPORTANT IP ADDRESS INFORMATION:
+#
+# Note that with the addition of DHCP, each octet here must be 3 numbers long.
+# That means use leading zeroes like this when specifying an IP address:
+# 192.168.001.058 or 010.000.076.002, etc. Prior versions of this program could
+# not handle addresses like 192.168.0.x, and the fix for that means leading
+# zeroes are now required when specifying an IP address below.
+#
+# Any IP in the 0.0.0.0/8 range, meaning 000.xxx.xxx.xxx, will enable DHCP mode.
+# If in doubt, just use 000.000.000.000. 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
+DREAMCAST_IP = 000.000.000.000
diff --git a/example-src/gethostinfo.c b/example-src/gethostinfo.c
index fd98f20..57b3847 100644
--- a/example-src/gethostinfo.c
+++ b/example-src/gethostinfo.c
@@ -2,7 +2,7 @@
void uint_to_string(unsigned int foo, unsigned char *bar)
{
- char hexdigit[16] = "0123456789abcdef";
+ char hexdigit[17] = "0123456789abcdef";
int i;
for(i=7; i>=0; i--) {
@@ -43,4 +43,3 @@ int main(void)
exit(0);
}
-
diff --git a/host-src/tool/Makefile b/host-src/tool/Makefile
index 418d4c7..befc6cd 100644
--- a/host-src/tool/Makefile
+++ b/host-src/tool/Makefile
@@ -1,26 +1,26 @@
include ../../Makefile.cfg
CC = $(HOSTCC)
-CFLAGS = $(HOSTCFLAGS) -DDCLOAD_VERSION=\"$(VERSION)\" -DDREAMCAST_IP=\"$(DREAMCAST_IP)\" -DHAVE_GETOPT
+CFLAGS = $(HOSTCFLAGS) -DDCLOAD_VERSION=\"$(VERSION)\" -DDREAMCAST_IP=\"$(DREAMCAST_IP)\" -DHAVE_GETOPT -DSAVE_MY_FANS=$(SAVE_MY_FANS)
LDFLAGS = $(HOSTLDFLAGS)
INCLUDE =
ifeq ($(WITH_BFD),1)
- CFLAGS += -DWITH_BFD
- LDFLAGS = -L$(BFDLIB) -lbfd -liberty -lintl -lz
- INCLUDE += -I$(BFDINCLUDE)
+ CFLAGS += -DWITH_BFD
+ LDFLAGS = -L$(BFDLIB) -lbfd -liberty -lintl -lz
+ INCLUDE += -I$(BFDINCLUDE)
else
- LDFLAGS = -L$(ELFLIB) -lelf
- INCLUDE += -I$(ELFINCLUDE)
+ LDFLAGS = -L$(ELFLIB) -lelf
+ INCLUDE += -I$(ELFINCLUDE)
endif
# Additional libraries for MinGW/MSYS
ifdef MINGW32
- LDFLAGS += -lws2_32 -lwsock32 -liconv
+ LDFLAGS += -lws2_32 -lwsock32 -liconv
endif
ifdef STANDALONE_BINARY
- LDFLAGS += -static
+ LDFLAGS += -static
endif
DCTOOL = dc-tool-ip$(EXECUTABLEEXTENSION)
@@ -28,7 +28,7 @@ DCTOOL = dc-tool-ip$(EXECUTABLEEXTENSION)
OBJECTS = dc-tool.o syscalls.o unlink.o utils.o
.c.o:
- $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $<
+ $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $<
all: $(DCTOOL)
@@ -36,15 +36,15 @@ $(DCTOOL): $(OBJECTS)
$(CC) -o $@ $(OBJECTS) $(LDFLAGS)
.PHONY : install
-install: $(DCTOOL) | $(TOOLINSTALLDIR)
+install: $(DCTOOL) | $(TOOLINSTALLDIR)
cp $(DCTOOL) $(TOOLINSTALLDIR)
$(TOOLINSTALLDIR):
-mkdir $(TOOLINSTALLDIR)
.PHONY : clean
clean:
- rm -f $(OBJECTS)
+ -rm -f $(OBJECTS)
.PHONY : distclean
-distclean: clean
- rm -f $(DCTOOL)
+distclean: clean
+ -rm -f $(DCTOOL)
diff --git a/host-src/tool/commands.h b/host-src/tool/commands.h
index f058252..a429558 100644
--- a/host-src/tool/commands.h
+++ b/host-src/tool/commands.h
@@ -22,7 +22,9 @@ typedef struct _command_t command_t;
#define CMD_REBOOT "RBOT" /* reboot */
+#define CMD_MAPLE "MAPL" /* Maple packet */
+#define CMD_PMCR "PMCR" /* Performance counter packet */
+
#define COMMAND_LEN 12
#endif
-
diff --git a/host-src/tool/dc-tool.c b/host-src/tool/dc-tool.c
index 198ab6d..84049f1 100644
--- a/host-src/tool/dc-tool.c
+++ b/host-src/tool/dc-tool.c
@@ -19,8 +19,8 @@
*
*/
-#include "config.h" // needed for newer BFD library
-
+#include "config.h"
+
#ifdef WITH_BFD
#include <bfd.h>
#else
@@ -127,56 +127,54 @@ char *__progname=PACKAGE;
/*
* getopt -- Parse argc/argv argument vector.
*/
-int getopt(int nargc, char * const *nargv, const char *ostr)
-{
+int getopt(int nargc, char * const *nargv, const char *ostr) {
extern char *__progname;
static char *place = EMSG; /* option letter processing */
char *oli; /* option letter list index */
int ret;
- if (optreset || !*place) { /* update scanning pointer */
+ if(optreset || !*place) { /* update scanning pointer */
optreset = 0;
- if (optind >= nargc || *(place = nargv[optind]) != '-') {
+ if(optind >= nargc || *(place = nargv[optind]) != '-') {
place = EMSG;
return (-1);
}
- if (place[1] && *++place == '-') { /* found "--" */
+ if(place[1] && *++place == '-') { /* found "--" */
++optind;
place = EMSG;
return (-1);
}
} /* option letter okay? */
- if ((optopt = (int)*place++) == (int)':' ||
+ if((optopt = (int)*place++) == (int)':' ||
!(oli = strchr(ostr, optopt))) {
/*
* if the user didn't specify '-' as an option,
* assume it means -1.
*/
- if (optopt == (int)'-')
+ if(optopt == (int)'-')
return (-1);
- if (!*place)
+ if(!*place)
++optind;
- if (opterr && *ostr != ':')
+ if(opterr && *ostr != ':')
(void)fprintf(stderr,
"%s: illegal option -- %c\n", __progname, optopt);
-
return (BADCH);
}
- if (*++oli != ':') { /* don't need argument */
+ if(*++oli != ':') { /* don't need argument */
optarg = NULL;
- if (!*place)
- ++optind;
+ if(!*place)
+ ++optind;
}
else { /* need an argument */
- if (*place) /* no white space */
+ if(*place) /* no white space */
optarg = place;
- else if (nargc <= ++optind) { /* no arg */
+ else if(nargc <= ++optind) { /* no arg */
place = EMSG;
- if (*ostr == ':')
+ if(*ostr == ':')
ret = BADARG;
else
ret = BADCH;
- if (opterr)
+ if(opterr)
(void)fprintf(stderr,
"%s: option requires an argument -- %c\n",
__progname, optopt);
@@ -209,49 +207,76 @@ void cleanup(char **fnames)
{
int counter;
- for(counter = 0; counter < 4; counter++)
- {
+ for(counter = 0; counter < 4; counter++) {
if(fnames[counter] != 0)
free(fnames[counter]);
}
+ for(; counter < 4; counter++)
+ if(fnames[counter] != 0)
+ free(fnames[counter]);
+
if(dcsocket)
#ifndef __MINGW32__
close(dcsocket);
#else
- closesocket(dcsocket);
+ closesocket(dcsocket);
+#endif
+
+ // Handle GDB
+ if(gdb_socket_started) {
+ gdb_socket_started = 0;
+
+ // Send SIGTERM to the GDB Client, telling remote DC program has ended
+ char gdb_buf[16];
+ strcpy(gdb_buf, "+$X0f#ee\0");
+
+#ifdef __MINGW32__
+ send(socket_fd, gdb_buf, strlen(gdb_buf), 0);
+ sleep(1);
+ closesocket(socket_fd);
+ closesocket(gdb_server_socket);
+#else
+ write(socket_fd, gdb_buf, strlen(gdb_buf));
+ sleep(1);
+ close(socket_fd);
+ close(gdb_server_socket);
+#endif
+ }
+
+#ifdef __MINGW32__
+ WSACleanup();
#endif
// Handle GDB
- if (gdb_socket_started) {
- gdb_socket_started = 0;
-
- // Send SIGTERM to the GDB Client, telling remote DC program has ended
- char gdb_buf[16];
- strcpy(gdb_buf, "+$X0f#ee\0");
+ if(gdb_socket_started) {
+ gdb_socket_started = 0;
+ // Send SIGTERM to the GDB Client, telling remote DC program has ended
+ char gdb_buf[16];
+ strcpy(gdb_buf, "+$X0f#ee\0");
+
#ifdef __MINGW32__
- send(socket_fd, gdb_buf, strlen(gdb_buf), 0);
- sleep(1);
- closesocket(socket_fd);
- closesocket(gdb_server_socket);
+ send(socket_fd, gdb_buf, strlen(gdb_buf), 0);
+ sleep(1);
+ closesocket(socket_fd);
+ closesocket(gdb_server_socket);
#else
- write(socket_fd, gdb_buf, strlen(gdb_buf));
- sleep(1);
- close(socket_fd);
- close(gdb_server_socket);
+ write(socket_fd, gdb_buf, strlen(gdb_buf));
+ sleep(1);
+ close(socket_fd);
+ close(gdb_server_socket);
#endif
- }
-
+ }
+
#ifdef __MINGW32__
- WSACleanup();
+ WSACleanup();
#endif
}
extern char *optarg;
-unsigned int time_in_usec()
-{
+unsigned int time_in_usec() {
struct timeval thetime;
gettimeofday(&thetime, NULL);
@@ -263,8 +288,7 @@ unsigned int time_in_usec()
#define PACKET_TIMEOUT 250000
/* receive total bytes from dc and store in data */
-int recv_data(void *data, unsigned int dcaddr, unsigned int total, unsigned int quiet)
-{
+int recv_data(void *data, unsigned int dcaddr, unsigned int total, unsigned int quiet) {
unsigned char buffer[2048];
unsigned char *i;
int c;
@@ -275,24 +299,26 @@ int recv_data(void *data, unsigned int dcaddr, unsigned int total, unsigned int
memset(map, 0, (total+1023)/1024);
- if (!quiet) {
- send_cmd(CMD_SENDBIN, dcaddr, total, NULL, 0);
+ if(!quiet) {
+ send_cmd(CMD_SENDBIN, dcaddr, total, NULL, 0);
}
else {
- send_cmd(CMD_SENDBINQ, dcaddr, total, NULL, 0);
+ send_cmd(CMD_SENDBINQ, dcaddr, total, NULL, 0);
...<truncated>...
hooks/post-receive
--
An ethernet program loader for the Dreamcast.
|