Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0b35e58
Add initial makefile changes
networkfusion Mar 11, 2021
e17661b
Correct ff lib location
networkfusion Mar 11, 2021
6202607
Improve ffconf.h settings
networkfusion Mar 11, 2021
c13c80c
Move USB and FileIO to Src
networkfusion Mar 11, 2021
242a400
Rename game to ROM
networkfusion Mar 11, 2021
c4935b1
Futher rename of Game to ROM
networkfusion Mar 11, 2021
480778a
Improve naming of sd disk functions
networkfusion Mar 11, 2021
851ec5a
Add get_fattime even though it is not used (yet)
networkfusion Mar 11, 2021
febe8c5
Add Cpp macros to headers
networkfusion Mar 11, 2021
e473040
Header comment updates
networkfusion Mar 11, 2021
166334c
Source file header comments
networkfusion Mar 11, 2021
bec2026
Improve USB function naming
networkfusion Mar 11, 2021
f21ace3
Improve a number of comments
networkfusion Mar 11, 2021
641f7a7
Improve main menu text
networkfusion Mar 11, 2021
7065d76
Improve menu strings
networkfusion Mar 11, 2021
1f8796e
Menu text improvements
networkfusion Mar 11, 2021
1f0e174
Continue to improve menu strings
networkfusion Mar 11, 2021
c293ad9
Futher menu text improvements
networkfusion Mar 11, 2021
a4b1790
Further improvements
networkfusion Mar 11, 2021
87c4a85
Further improve menu display
networkfusion Mar 11, 2021
4000857
Improve graphics function names
networkfusion Mar 11, 2021
d0d4bfd
Consistant file slashes
networkfusion Mar 11, 2021
bd91bab
finializing major changes to menu text
networkfusion Mar 11, 2021
8b11b0b
Remove duplicate macro
networkfusion Mar 11, 2021
21e67be
Header formatting
networkfusion Mar 11, 2021
54c7ddb
Further comment improvements
networkfusion Mar 11, 2021
a6da533
Improve function names and documentation comments (#12)
networkfusion Mar 19, 2021
cfb68d9
Merge branch 'krikzz:master' into develop-xio-new
networkfusion Nov 22, 2021
76afcf4
Update build-ed64-example-rom.yml
networkfusion Nov 22, 2021
8885f77
Update build-ed64-example-rom.yml
networkfusion Nov 22, 2021
d7c4d1c
Update build-ed64-example-rom.yml
networkfusion Nov 22, 2021
46a0ed3
Fix XIO ROM build
networkfusion Jul 18, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions .github/workflows/build-ed64-example-rom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,33 @@ on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
releasetype: [ 'debug', 'release' ]
steps:
- uses: actions/checkout@v2
name: Checkout Code

- name: Install Libdragon container
run: |
sudo npm install -g libdragon
# TODO: the sample needs updating. This is the last known compatible version!
# Remove the @1.3.15 to run at latest.
# And, this would also involve having a git subtree of the libdragon version.
# which would make it easier to show "custom" changes to source.
sudo npm install -g libdragon@1.3.15
libdragon download

- name: Setup Build environment
run: |
cd ${{ github.workspace }}/ED64-XIO/
mkdir bin && mkdir obj
mkdir bin && mkdir bin/release && mkdir bin/debug && mkdir obj
libdragon start

- name: Build ROM
run: cd ${{ github.workspace }}/ED64-XIO/ && libdragon make
run: cd ${{ github.workspace }}/ED64-XIO/ && libdragon make ${{ matrix.releasetype }}

- name: Upload Artifact
uses: actions/upload-artifact@v1.0.0
with:
name: ED64-XIO-SAMPLE_N64_ROM
path: ${{ github.workspace }}/ED64-XIO/bin/ED64-XIO-SAMPLE.v64
name: ED64-XIO-SAMPLE_N64_ROM-${{ matrix.releasetype }}
path: ${{ github.workspace }}/ED64-XIO/bin/${{ matrix.releasetype }}/ED64-XIO-SAMPLE.v64
88 changes: 55 additions & 33 deletions ED64-XIO/Makefile
Original file line number Diff line number Diff line change
@@ -1,65 +1,87 @@
RM = rm -rf
PROG_NAME = ED64-XIO-SAMPLE
ROMSIZE = 256K


ifdef SystemRoot
FIXPATH = $(subst /,\,$1)
RM = DEL /Q
else
FIXPATH = $1
RM = rm -f
endif

ROOTDIR = $(N64_INST)
GCCN64PREFIX = $(ROOTDIR)/bin/mips64-elf-
CHKSUM64PATH = $(ROOTDIR)/bin/chksum64
MKDFSPATH = $(ROOTDIR)/bin/mkdfs
N64TOOL = $(ROOTDIR)/bin/n64tool

FFDIR := ff
SRCDIR := src
INCDIR := inc
RESDIR := res
CC = $(GCCN64PREFIX)gcc
AS = $(GCCN64PREFIX)as
LD = $(GCCN64PREFIX)ld
OBJCOPY = $(GCCN64PREFIX)objcopy

SRCDIR = src
SRCDIR_EDLIB = $(SRCDIR)/edlib
SRCDIR_FFLIB = ff
LIBDIR = lib
INCDIR = inc
INCDIR_EDLIB = inc/edlib
RESDIR = res
OBJDIR = obj
BINDIR = bin

PROG_NAME = ED64-XIO-SAMPLE

HDDIR :=$(ROOTDIR)/mips64-elf/lib
HEADERDIR :=$(ROOTDIR)/mips64-elf/lib
HEADERNAME = header
HEADERTITLE = $(PROG_NAME)

CC = $(GCCN64PREFIX)gcc
AS = $(GCCN64PREFIX)as
LD = $(GCCN64PREFIX)ld
OBJCOPY = $(GCCN64PREFIX)objcopy

LINK_FLAGS = -L$(ROOTDIR)/lib -L$(ROOTDIR)/mips64-elf/lib -ldragon -lc -lm -ldragonsys -Tn64.ld

FLAGS = -std=gnu99 -march=vr4300 -mtune=vr4300 -O2 -Wall -Wno-pointer-sign -I$(ROOTDIR)/mips64-elf/include -Iedlib -I$(FFDIR) -I$(INCDIR) -G0
ASFLAGS = -mtune=vr4300 -march=vr4300
ASFLAGS := -mtune=vr4300 -march=vr4300
CCFLAGS := -std=gnu99 $(ASFLAGS) $(OPTIMIZE_FLAG) -Wall -Wno-pointer-sign -I$(ROOTDIR)/mips64-elf/include -I$(SRCDIR_FFLIB) -I$(INCDIR) -I$(INCDIR_EDLIB)

SOURCES_FF := $(wildcard $(FFDIR)/*.c)
SOURCES_S := $(wildcard $(SRCDIR)/*.s)
SOURCES_ASM := $(wildcard $(SRCDIR)/*.s)
SOURCES := $(wildcard $(SRCDIR)/*.c)
SOURCES_EDLIB := $(wildcard $(SRCDIR_EDLIB)/*.c)
SOURCES_FFLIB := $(wildcard $(SRCDIR_FFLIB)/*.c)

OBJECTS_FF := $(SOURCES_FF:$(FFDIR)/%.c=$(OBJDIR)/%.o)
OBJECTS_S := $(SOURCES_S:$(SRCDIR)/%.s=$(OBJDIR)/%.o)
OBJECTS_ASM := $(SOURCES_ASM:$(SRCDIR)/%.s=$(OBJDIR)/%.o)
OBJECTS := $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
OBJECTS_EDLIB := $(SOURCES_EDLIB:$(SRCDIR_EDLIB)/%.c=$(OBJDIR)/%.o)
OBJECTS_FFLIB := $(SOURCES_FFLIB:$(SRCDIR_FFLIB)/%.c=$(OBJDIR)/%.o)


$(PROG_NAME).v64: $ $(PROG_NAME).elf
$(OBJCOPY) $(BINDIR)/$(PROG_NAME).elf $(BINDIR)/$(PROG_NAME).bin -O binary
$(N64TOOL) -l 256K -t $(HEADERTITLE) -h $(HDDIR)/$(HEADERNAME) -o $(BINDIR)/$(PROG_NAME).v64 $(BINDIR)/$(PROG_NAME).bin
$(N64TOOL) -l $(ROMSIZE) -t $(HEADERTITLE) -h $(HEADERDIR)/$(HEADERNAME) -o $(BINDIR)/$(PROG_NAME).v64 $(BINDIR)/$(PROG_NAME).bin
$(CHKSUM64PATH) $(BINDIR)/$(PROG_NAME).v64

$(PROG_NAME).elf : $(OBJECTS_FF) $(OBJECTS_S) $(OBJECTS)
$(LD) -o $(BINDIR)/$(PROG_NAME).elf $(OBJECTS_FF) $(OBJECTS_S) $(OBJECTS) $(LINK_FLAGS)
$(PROG_NAME).elf : $(OBJECTS_ASM) $(OBJECTS) $(OBJECTS_EDLIB) $(OBJECTS_FFLIB)
$(LD) -o $(BINDIR)/$(PROG_NAME).elf $(OBJECTS_ASM) $(OBJECTS) $(OBJECTS_EDLIB) $(OBJECTS_FFLIB) $(LINK_FLAGS)

$(OBJECTS_FF): $(OBJDIR)/%.o : $(FFDIR)/%.c
$(CC) $(FLAGS) -c $< -o $@

$(OBJECTS_S): $(OBJDIR)/%.o : $(SRCDIR)/%.s
$(OBJECTS_ASM): $(OBJDIR)/%.o : $(SRCDIR)/%.s
$(CC) $(ASFLAGS) -c $< -o $@

$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.c
$(CC) $(FLAGS) -c $< -o $@
$(CC) $(CCFLAGS) -c $< -o $@

$(OBJECTS_EDLIB): $(OBJDIR)/%.o : $(SRCDIR_EDLIB)/%.c
$(CC) $(CCFLAGS) -c $< -o $@

$(OBJECTS_FFLIB): $(OBJDIR)/%.o : $(SRCDIR_FFLIB)/%.c
$(CC) $(CCFLAGS) -c $< -o $@

release: BINDIR := bin/release
release: OPTIMIZE_FLAG = -O2 -g0
release: $(PROG_NAME).v64

debug: BINDIR := bin/debug
debug: OPTIMIZE_FLAG = -O0 -DDEBUG -g
debug: $(PROG_NAME).v64

all: $(PROG_NAME).v64
all: $(release)

clean:
$(RM) $(BINDIR)/*.v64
$(RM) $(BINDIR)/*.elf
$(RM) $(OBJDIR)/*.o
$(RM) $(BINDIR)/*.bin
$(RM) $(BINDIR)/*.dfs
$(info "Cleaning $(PROG_NAME) build folders...")
@$(RM) $(call FIXPATH,$(BINDIR)/**/*)
@$(RM) $(call FIXPATH,$(OBJDIR)/*.o)
2 changes: 1 addition & 1 deletion ED64-XIO/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FPGA firmware included in ED64 Menu OS version 3.04 or newer required to use thi
[Table of Contents](/../../docs/table_of_contents.md)

## Features:
* Simple file manager and game loading from disk
* Simple file manager and ROM loading from SD card
* Use files with FatFs lib
* USB communications
* ED64 hardware version identification
Expand Down
21 changes: 14 additions & 7 deletions ED64-XIO/ff/diskio.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@


/* Definitions of physical drive number for each drive */
#define DEV_RAM 0 /* Example: Map Ramdisk to physical drive 0 */
#define DEV_MMC 1 /* Example: Map MMC/SD card to physical drive 1 */
#define DEV_SD 0 /* Example: Map SD card to physical drive 0 */
#define DEV_RAM 1 /* Example: Map Ramdisk to physical drive 1 */
#define DEV_USB 2 /* Example: Map USB MSD to physical drive 2 */

//extern SD_HandleTypeDef hsd;
Expand All @@ -33,15 +33,15 @@ DSTATUS disk_status(
}

/*-----------------------------------------------------------------------*/
/* Inidialize a Drive */
/* Initialize a Drive */

/*-----------------------------------------------------------------------*/

DSTATUS disk_initialize(
BYTE pdrv /* Physical drive nmuber to identify the drive */
) {

dresp = diskInit();
dresp = sd_disk_init();
dstat = 0;
if (dresp)dstat = STA_NOINIT;

Expand All @@ -62,7 +62,7 @@ DRESULT disk_read(
UINT count /* Number of sectors to read */
) {

dresp = diskRead(buff, sector, count);
dresp = sd_disk_read(buff, sector, count);
if (dresp)return RES_ERROR;
return RES_OK;
}
Expand All @@ -83,7 +83,7 @@ DRESULT disk_write(
) {


dresp = diskWrite((BYTE *) buff, sector, count);
dresp = sd_disk_write((BYTE *) buff, sector, count);
if (dresp)return RES_ERROR;
return RES_OK;
}
Expand All @@ -105,7 +105,7 @@ DRESULT disk_ioctl(

switch (cmd) {
case CTRL_SYNC:
res = diskCloseRW();
res = sd_disk_close_rw();
dresp = res;
res = res == 0 ? RES_OK : RES_ERROR;
break;
Expand All @@ -129,3 +129,10 @@ DRESULT disk_ioctl(
return res;
}

DWORD get_fattime (void)
{
//TODO: add ability to use the X7 or V3 RTC.
return ((DWORD)(FF_NORTC_YEAR - 1980) << 25 |
(DWORD)FF_NORTC_MON << 21 |
(DWORD)FF_NORTC_MDAY << 16);
}
1 change: 1 addition & 0 deletions ED64-XIO/ff/diskio.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ DSTATUS disk_status (BYTE pdrv);
DRESULT disk_read (BYTE pdrv, BYTE* buff, LBA_t sector, UINT count);
DRESULT disk_write (BYTE pdrv, const BYTE* buff, LBA_t sector, UINT count);
DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
DWORD get_fattime (void);


/* Disk Status Bits (DSTATUS) */
Expand Down
12 changes: 6 additions & 6 deletions ED64-XIO/ff/ffconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
/ Locale and Namespace Configurations
/---------------------------------------------------------------------------*/

#define FF_CODE_PAGE 932
#define FF_CODE_PAGE 437
/* This option specifies the OEM code page to be used on the target system.
/ Incorrect code page setting can cause a file open failure.
/
Expand Down Expand Up @@ -168,7 +168,7 @@


#define FF_STR_VOLUME_ID 0
#define FF_VOLUME_STRS "RAM","NAND","CF","SD","SD2","USB","USB2","USB3"
#define FF_VOLUME_STRS "SD"//,"RAM","USB","NAND","CF","SD2","USB2","USB3"
/* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings.
/ When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive
/ number in the path name. FF_VOLUME_STRS defines the volume ID strings for each
Expand Down Expand Up @@ -228,16 +228,16 @@
/ buffer in the filesystem object (FATFS) is used for the file data transfer. */


#define FF_FS_EXFAT 1
#define FF_FS_EXFAT 0
/* This option switches support for exFAT filesystem. (0:Disable or 1:Enable)
/ To enable exFAT, also LFN needs to be enabled. (FF_USE_LFN >= 1)
/ Note that enabling exFAT discards ANSI C (C89) compatibility. */


#define FF_FS_NORTC 1
#define FF_NORTC_MON 8
#define FF_NORTC_MDAY 23
#define FF_NORTC_YEAR 2019
#define FF_NORTC_MON 3
#define FF_NORTC_MDAY 11
#define FF_NORTC_YEAR 2021
/* The option FF_FS_NORTC switches timestamp functiton. If the system does not have
/ any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable
/ the timestamp function. Every object modified by FatFs will have a fixed timestamp
Expand Down
97 changes: 0 additions & 97 deletions ED64-XIO/ff/fileio.c

This file was deleted.

Loading