diff options
| author | John "Lameguy" Wilbert Villamor <lameguy64@gmail.com> | 2021-08-31 13:23:20 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-31 13:23:20 +0800 |
| commit | ffa679d4d24b891cb59aba10946368f2ec00c391 (patch) | |
| tree | 0cf6061915ebf48acdedf6d77b0c1b76eec5b8c3 /template | |
| parent | 317dc2b91d3afcdbaddb035f38611d12af161970 (diff) | |
| parent | f2fc18f82dd7900465d6ab3ae2080726d5589d39 (diff) | |
| download | psn00bsdk-ffa679d4d24b891cb59aba10946368f2ec00c391.tar.gz | |
Merge pull request #36 from spicyjpeg/dynlink
Dynamic linker, gp-relative addressing, ldscripts and more
Diffstat (limited to 'template')
| -rw-r--r-- | template/iso.xml | 27 | ||||
| -rw-r--r-- | template/makefile | 83 | ||||
| -rw-r--r-- | template/psn00bsdk-setup.mk | 68 | ||||
| -rw-r--r-- | template/system.cnf | 4 |
4 files changed, 80 insertions, 102 deletions
diff --git a/template/iso.xml b/template/iso.xml new file mode 100644 index 0000000..ba2b29d --- /dev/null +++ b/template/iso.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<iso_project + image_name="build/template.bin" + cue_sheet="build/template.cue" +> + <track type="data"> + <identifiers + system ="PLAYSTATION" + volume ="PSN00BSDK" + volume_set ="PSN00BSDK" + publisher ="MEIDOTEK" + data_preparer ="PSN00BSDK BUILD SCRIPT" + application ="PLAYSTATION" + copyright ="README.TXT;1" + /> + + <directory_tree> + <file name="SYSTEM.CNF" type="data" source="system.cnf" /> + <file name="TEMPLATE.EXE" type="data" source="build/template.exe" /> + <file name="TEMPLATE.MAP" type="data" source="build/template.map" /> + + <dummy sectors="1024"/> + </directory_tree> + </track> + + <!--<track type="audio" source="track2.wav" />--> +</iso_project> diff --git a/template/makefile b/template/makefile index 42ff370..707a8d7 100644 --- a/template/makefile +++ b/template/makefile @@ -1,54 +1,69 @@ -include psn00bsdk-setup.mk +# PSn00bSDK makefile template +# Part of the PSn00bSDK Project +# 2019 - 2021 Lameguy64 / Meido-Tek Productions + +## Settings + +# You can edit these here or pass them as environment variables. +#PREFIX = +#GCC_VERSION = +#PSN00BSDK_TC = +#PSN00BSDK_LIBS = + +# Edit this to point to psn00bsdk-setup.mk, or copy that over to your project's +# root folder (it only depends on environment variables). +include ../psn00bsdk-setup.mk # Project target name -TARGET = template.elf +TARGET = template + +## Files # Searches for C, C++ and S (assembler) files in local directory -CFILES = $(notdir $(wildcard *.c)) -CPPFILES = $(notdir $(wildcard *.cpp)) -AFILES = $(notdir $(wildcard *.s)) +CFILES = $(notdir $(wildcard *.c)) +CPPFILES= $(notdir $(wildcard *.cpp)) +AFILES = $(notdir $(wildcard *.s)) # Create names for object files -OFILES = $(addprefix build/,$(CFILES:.c=.o)) \ - $(addprefix build/,$(CPPFILES:.cpp=.o)) \ - $(addprefix build/,$(AFILES:.s=.o)) +OFILES = $(addprefix build/,$(CFILES:.c=.o)) \ + $(addprefix build/,$(CPPFILES:.cpp=.o)) \ + $(addprefix build/,$(AFILES:.s=.o)) -# Project specific include and library directories -# (use -I for include dirs, -L for library dirs) -INCLUDE += -LIBDIRS += +# Project specific includes and libraries +# (use -I for include dirs, -L for library dirs, -l for static libraries) +INCLUDE += +LIBDIRS += +LIBS += -# Libraries to link -LIBS = -lpsxgpu -lpsxgte -lpsxspu -lpsxetc -lpsxapi -lc +## Build rules -# C compiler flags -CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections +all: iso +#all: build/$(TARGET) -# C++ compiler flags -CPPFLAGS = $(CFLAGS) -fno-exceptions +iso: build/$(TARGET) resources + $(MKPSXISO) -y -q iso.xml -# Assembler flags -AFLAGS = -g +resources: + # Add commands to build/convert your assets here + #$(LZPACK) data.xml -# Linker flags (-Ttext specifies the program text address) -LDFLAGS = -g -Ttext=0x80010000 -gc-sections \ - -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x +build/$(TARGET): $(OFILES) + @mkdir -p $(dir $@) + $(LD) $(LDFLAGS_EXE) $(LIBDIRS) $^ $(LIBS) -o $@ + $(NM) -f posix -l -n $@ >$@.map + $(ELF2X) -q $@ $@.exe -all: $(OFILES) - $(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET) - elf2x -q $(TARGET) - build/%.o: %.c @mkdir -p $(dir $@) - $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ - + $(CC) $(CFLAGS_EXE) $(INCLUDE) -c $< -o $@ + build/%.o: %.cpp @mkdir -p $(dir $@) - $(CXX) $(AFLAGS) $(INCLUDE) -c $< -o $@ - + $(CXX) $(CPPFLAGS_EXE) $(INCLUDE) -c $< -o $@ + build/%.o: %.s @mkdir -p $(dir $@) - $(CC) $(AFLAGS) $(INCLUDE) -c $< -o $@ - + $(CC) $(AFLAGS_EXE) $(INCLUDE) -c $< -o $@ + clean: - rm -rf build $(TARGET) $(TARGET:.elf=.exe) + rm -rf build diff --git a/template/psn00bsdk-setup.mk b/template/psn00bsdk-setup.mk deleted file mode 100644 index 6ba23ae..0000000 --- a/template/psn00bsdk-setup.mk +++ /dev/null @@ -1,68 +0,0 @@ -# PSn00bSDK project setup file -# Part of the PSn00bSDK Project -# 2019 - 2020 Lameguy64 / Meido-Tek Productions -# -# This file may be copied for use with your projects, see the template -# directory for a makefile template - -ifndef PREFIX - -PREFIX = mipsel-unknown-elf - -endif # PREFIX - -ifndef GCC_VERSION - -GCC_VERSION = 7.4.0 - -endif # GCC_VERSION - -# PSn00bSDK library/include path setup -ifndef PSN00BSDK_LIBS - -# Default assumes PSn00bSDK is in the same parent dir as this project - -LIBDIRS = -L../psn00bsdk/libpsn00b -INCLUDE = -I../psn00bsdk/libpsn00b/include - -else - -LIBDIRS = -L$(PSN00BSDK_LIBS) -INCLUDE = -I$(PSN00BSDK_LIBS)/include - -endif # PSN00BSDK_LIBS - -# PSn00bSDK toolchain path setup -ifndef GCC_BASE - -ifndef PSN00BSDK_TC - -# Default assumes GCC toolchain is in root of C drive or /usr/local - -ifeq "$(OS)" "Windows_NT" - -GCC_BASE = /c/mipsel-unknown-elf -GCC_BIN = - -else - -GCC_BASE = /usr/local/mipsel-unknown-elf -GCC_BIN = - -endif - -else - -GCC_BASE = $(PSN00BSDK_TC) -GCC_BIN = $(PSN00BSDK_TC)/bin/ - -endif # PSN00BSDK_TC - -endif # GCC_BASE - -CC = $(GCC_BIN)$(PREFIX)-gcc -CXX = $(GCC_BIN)$(PREFIX)-g++ -AS = $(GCC_BIN)$(PREFIX)-as -AR = $(GCC_BIN)$(PREFIX)-ar -LD = $(GCC_BIN)$(PREFIX)-ld -RANLIB = $(GCC_BIN)$(PREFIX)-ranlib
\ No newline at end of file diff --git a/template/system.cnf b/template/system.cnf new file mode 100644 index 0000000..e221726 --- /dev/null +++ b/template/system.cnf @@ -0,0 +1,4 @@ +BOOT=cdrom:\template.exe;1 +TCB=4 +EVENT=10 +STACK=801FFFF0 |
