Finished refactoring Makefile and directories #6

This commit is contained in:
Robin Jones 2016-09-10 00:13:21 +01:00
parent 0929602e65
commit 945331f92c
14 changed files with 41 additions and 37 deletions

View File

@ -2,42 +2,45 @@ ROOTDIR = $(N64_INST)
GCCN64PREFIX = $(ROOTDIR)/bin/mips64-elf- GCCN64PREFIX = $(ROOTDIR)/bin/mips64-elf-
CHKSUM64PATH = $(ROOTDIR)/bin/chksum64 CHKSUM64PATH = $(ROOTDIR)/bin/chksum64
MKDFSPATH = $(ROOTDIR)/bin/mkdfs MKDFSPATH = $(ROOTDIR)/bin/mkdfs
HEADERPATH = $(ROOTDIR)/lib
N64TOOL = $(ROOTDIR)/bin/n64tool N64TOOL = $(ROOTDIR)/bin/n64tool
HEADERNAME = header
HEADERNAME = header.ed64
HEADERTITLE = "EverDrive OS"
SRCDIR = ./src SRCDIR = ./src
RESDIR = ./res RESDIR = ./res
OBJDIR = ./obj OBJDIR = ./obj
BINDIR = ./bin BINDIR = ./bin
TOOLSDIR = ./tools
LINK_FLAGS = -O1 -L$(ROOTDIR)/lib -L$(ROOTDIR)/mips64-elf/lib -ldragon -lmikmod -lmad -lyaml -lc -lm -ldragonsys -lnosys $(LIBS) -Tn64ld.x LINK_FLAGS = -O1 -L$(ROOTDIR)/lib -L$(ROOTDIR)/mips64-elf/lib -ldragon -lmikmod -lmad -lyaml -lc -lm -ldragonsys -lnosys $(LIBS) -Tn64ld.x
PROG_NAME = OS64 PROG_NAME = OS64
CFLAGS = -std=gnu99 -march=vr4300 -mtune=vr4300 -O1 -I./inc -I$(SRCDIR) -I$(ROOTDIR)/include -I$(ROOTDIR)/mips64-elf/include -lpthread -lrt -D_REENTRANT -DUSE_TRUETYPE $(SET_DEBUG) CFLAGS = -std=gnu99 -march=vr4300 -mtune=vr4300 -O1 -I./inc -I$(ROOTDIR)/include -I$(ROOTDIR)/mips64-elf/include -lpthread -lrt -D_REENTRANT -DUSE_TRUETYPE $(SET_DEBUG)
ASFLAGS = -mtune=vr4300 -march=vr4300 ASFLAGS = -mtune=vr4300 -march=vr4300
CC = $(GCCN64PREFIX)gcc CC = $(GCCN64PREFIX)gcc
AS = $(GCCN64PREFIX)as AS = $(GCCN64PREFIX)as
LD = $(GCCN64PREFIX)ld LD = $(GCCN64PREFIX)ld
OBJCOPY = $(GCCN64PREFIX)objcopy OBJCOPY = $(GCCN64PREFIX)objcopy
#SOURCES := menu.c everdrive.c fat.c disk.c mem.c sys.c ini.c strlib.c utils.c sram.c stb_image.c chksum64.c mp3.c
#SOURCES := $(wildcard $(SRCDIR)/*.c) SOURCES := $(wildcard $(SRCDIR)/*.c)
#OBJECTS = $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o) OBJECTS = $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
OBJECTS = menu.o everdrive.o fat.o disk.o mem.o sys.o ini.o strlib.o utils.o sram.o chksum64.o mp3.o
$(PROG_NAME).v64: $(PROG_NAME).elf $(PROG_NAME).dfs $(PROG_NAME).v64: $ $(PROG_NAME).elf $(PROG_NAME).dfs
$(OBJCOPY) $(BINDIR)/$(PROG_NAME).elf $(BINDIR)/$(PROG_NAME).bin -O binary $(OBJCOPY) $(BINDIR)/$(PROG_NAME).elf $(BINDIR)/$(PROG_NAME).bin -O binary
rm -f $(BINDIR)/$(PROG_NAME).v64 rm -f $(BINDIR)/$(PROG_NAME).v64
$(N64TOOL) -l 4M -t "EverDrive OS" -h $(RESDIR)/header.ed64 -o $(BINDIR)/$(PROG_NAME).v64 $(BINDIR)/$(PROG_NAME).bin -s 1M $(BINDIR)/$(PROG_NAME).dfs $(N64TOOL) -l 4M -t $(HEADERTITLE) -h $(RESDIR)/$(HEADERNAME) -o $(BINDIR)/$(PROG_NAME).v64 $(BINDIR)/$(PROG_NAME).bin -s 1M $(BINDIR)/$(PROG_NAME).dfs
$(CHKSUM64PATH) $(BINDIR)/$(PROG_NAME).v64 $(CHKSUM64PATH) $(BINDIR)/$(PROG_NAME).v64
$(PROG_NAME).elf : $(OBJECTS) $(PROG_NAME).elf : $(OBJECTS)
@mkdir -p $(BINDIR)
$(LD) -o $(BINDIR)/$(PROG_NAME).elf $(OBJECTS) $(LINK_FLAGS) $(LD) -o $(BINDIR)/$(PROG_NAME).elf $(OBJECTS) $(LINK_FLAGS)
#$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.c $(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.c
#@$(CC) $(CFLAGS) -c $< -o $@ @mkdir -p $(OBJDIR)
$(CC) $(CFLAGS) -c $< -o $@
copy: $(PROG_NAME).v64 copy: $(PROG_NAME).v64
sh ./tools/upload.sh sh $(TOOLSDIR)/upload.sh
$(PROG_NAME).dfs: $(PROG_NAME).dfs:
$(MKDFSPATH) $(BINDIR)/$(PROG_NAME).dfs $(RESDIR)/filesystem/ $(MKDFSPATH) $(BINDIR)/$(PROG_NAME).dfs $(RESDIR)/filesystem/
@ -49,4 +52,4 @@ debug: $(PROG_NAME).v64
debug: SET_DEBUG=-DDEBUG debug: SET_DEBUG=-DDEBUG
clean: clean:
rm -f $(BINDIR)/*.v64 $(BINDIR)/*.elf *.o $(OBJDIR)/*.o $(BINDIR)/*.bin $(BINDIR)/*.dfs rm -f $(BINDIR)/*.v64 $(BINDIR)/*.elf $(OBJDIR)/*.o $(BINDIR)/*.bin $(BINDIR)/*.dfs

View File

View File

View File

View File

View File

View File

View File

View File

View File

@ -1,49 +1,49 @@
#include "everdrive.h" //#include "everdrive.h"
#include "sys.h" //#include "sys.h"
#include "types.h" //#include "types.h"
#include <libdragon.h> //#include <libdragon.h>
#include "rom.h" //#include "rom.h"
u8 cmdTest(); //u8 cmdTest();
u8 cmdFill(); //u8 cmdFill();
u8 cmdReadRom(); //u8 cmdReadRom();
u8 cmdWriteRom(); //u8 cmdWriteRom();
u64 usb_buff[128]; //u64 usb_buff[128];
u8 *usb_buff8; // = (u8 *) usb_buff; //u8 *usb_buff8; // = (u8 *) usb_buff;
#define PI_BSD_DOM1_LAT_REG (PI_BASE_REG+0x14) //#define PI_BSD_DOM1_LAT_REG (PI_BASE_REG+0x14)
/* PI dom1 pulse width (R/W): [7:0] domain 1 device R/W strobe pulse width */ /* PI dom1 pulse width (R/W): [7:0] domain 1 device R/W strobe pulse width */
#define PI_BSD_DOM1_PWD_REG (PI_BASE_REG+0x18) //#define PI_BSD_DOM1_PWD_REG (PI_BASE_REG+0x18)
/* PI dom1 page size (R/W): [3:0] domain 1 device page size */ /* PI dom1 page size (R/W): [3:0] domain 1 device page size */
#define PI_BSD_DOM1_PGS_REG (PI_BASE_REG+0x1C) /* page size */ //#define PI_BSD_DOM1_PGS_REG (PI_BASE_REG+0x1C) /* page size */
/* PI dom1 release (R/W): [1:0] domain 1 device R/W release duration */ /* PI dom1 release (R/W): [1:0] domain 1 device R/W release duration */
#define PI_BSD_DOM1_RLS_REG (PI_BASE_REG+0x20) //#define PI_BSD_DOM1_RLS_REG (PI_BASE_REG+0x20)
/* PI dom2 latency (R/W): [7:0] domain 2 device latency */ /* PI dom2 latency (R/W): [7:0] domain 2 device latency */
#define PI_BSD_DOM2_LAT_REG (PI_BASE_REG+0x24) /* Domain 2 latency */ //#define PI_BSD_DOM2_LAT_REG (PI_BASE_REG+0x24) /* Domain 2 latency */
/* PI dom2 pulse width (R/W): [7:0] domain 2 device R/W strobe pulse width */ /* PI dom2 pulse width (R/W): [7:0] domain 2 device R/W strobe pulse width */
#define PI_BSD_DOM2_PWD_REG (PI_BASE_REG+0x28) /* pulse width */ //#define PI_BSD_DOM2_PWD_REG (PI_BASE_REG+0x28) /* pulse width */
/* PI dom2 page size (R/W): [3:0] domain 2 device page size */ /* PI dom2 page size (R/W): [3:0] domain 2 device page size */
#define PI_BSD_DOM2_PGS_REG (PI_BASE_REG+0x2C) /* page size */ //#define PI_BSD_DOM2_PGS_REG (PI_BASE_REG+0x2C) /* page size */
/* PI dom2 release (R/W): [1:0] domain 2 device R/W release duration */ /* PI dom2 release (R/W): [1:0] domain 2 device R/W release duration */
#define PI_BSD_DOM2_RLS_REG (PI_BASE_REG+0x30) /* release duration */ //#define PI_BSD_DOM2_RLS_REG (PI_BASE_REG+0x30) /* release duration */
#define PHYS_TO_K1(x) ((u32)(x)|0xA0000000) /* physical to kseg1 */ //#define PHYS_TO_K1(x) ((u32)(x)|0xA0000000) /* physical to kseg1 */
#define IO_WRITE(addr,data) (*(volatile u32*)PHYS_TO_K1(addr)=(u32)(data)) //#define IO_WRITE(addr,data) (*(volatile u32*)PHYS_TO_K1(addr)=(u32)(data))
#define PI_BASE_REG 0x04600000 //#define PI_BASE_REG 0x04600000
extern u8 system_cic; //extern u8 system_cic;
u8 usbListener() { /*u8 usbListener() {
volatile u16 resp; volatile u16 resp;
volatile u8 cmd; volatile u8 cmd;
@ -178,3 +178,4 @@ u8 cmdWriteRom() {
return 0; return 0;
} }
*/