aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJohn Wilbert M. Villamor <lameguy64@gmail.com>2021-02-18 13:31:17 +0800
committerJohn Wilbert M. Villamor <lameguy64@gmail.com>2021-02-18 13:31:17 +0800
commit63419d9cc07c56234d0f61a80f32105b192aec8e (patch)
tree827cf4d134cf3b4618d0167cc912f3efd47c3aac /examples
parent1625072293c40ba3cb819f8f48aeb4b64e93b133 (diff)
downloadpsn00bsdk-63419d9cc07c56234d0f61a80f32105b192aec8e.tar.gz
Lots of makefile corrections, improved build and toolchain instructions, added elf2cpe converter, fixed typo in plasma_tbl.h of n00bdemo example
Diffstat (limited to 'examples')
-rw-r--r--examples/beginner/cppdemo/makefile2
-rw-r--r--examples/beginner/hello/makefile2
-rw-r--r--examples/cdrom/cdbrowse/makefile4
-rw-r--r--examples/cdrom/cdxa/makefile4
-rw-r--r--examples/demos/n00bdemo/makefile2
-rw-r--r--examples/demos/n00bdemo/plasma_tbl.h2
-rw-r--r--examples/examples-setup.mk14
-rw-r--r--examples/graphics/balls/makefile2
-rw-r--r--examples/graphics/billboard/makefile3
-rw-r--r--examples/graphics/fpscam/makefile3
-rw-r--r--examples/graphics/gte/makefile3
-rw-r--r--examples/graphics/hdtv/makefile3
-rw-r--r--examples/graphics/render2tex/makefile3
-rw-r--r--examples/graphics/rgb24/makefile3
-rw-r--r--examples/lowlevel/cartrom/rom.s3
-rw-r--r--examples/makefile10
-rw-r--r--examples/system/childexec/makefile3
-rw-r--r--examples/system/console/makefile2
-rw-r--r--examples/system/timer/makefile3
-rw-r--r--examples/system/tty/makefile2
20 files changed, 41 insertions, 32 deletions
diff --git a/examples/beginner/cppdemo/makefile b/examples/beginner/cppdemo/makefile
index 6a29033..3e122ab 100644
--- a/examples/beginner/cppdemo/makefile
+++ b/examples/beginner/cppdemo/makefile
@@ -32,7 +32,7 @@ AFLAGS = -g -msoft-float
# Linker flags
LDFLAGS = -g -Ttext=0x80010000 -gc-sections \
- -T $(GCC_BASE)/mipsel-unknown-elf/lib/ldscripts/elf32elmip.x
+ -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
all: $(OFILES)
$(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
diff --git a/examples/beginner/hello/makefile b/examples/beginner/hello/makefile
index f80d2aa..3fce1ae 100644
--- a/examples/beginner/hello/makefile
+++ b/examples/beginner/hello/makefile
@@ -32,7 +32,7 @@ AFLAGS = -g -msoft-float
# Linker flags
LDFLAGS = -g -Ttext=0x80010000 -gc-sections \
- -T $(GCC_BASE)/mipsel-unknown-elf/lib/ldscripts/elf32elmip.x
+ -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
all: $(OFILES)
$(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
diff --git a/examples/cdrom/cdbrowse/makefile b/examples/cdrom/cdbrowse/makefile
index 61e54ab..ee925d2 100644
--- a/examples/cdrom/cdbrowse/makefile
+++ b/examples/cdrom/cdbrowse/makefile
@@ -8,8 +8,6 @@ AFILES = $(notdir $(wildcard *.s))
OFILES = $(addprefix build/,$(CFILES:.c=.o) $(CPPFILES:.cpp=.o) $(AFILES:.s=.o))
-PREFIX = mipsel-unknown-elf-
-
LIBS = -lpsxcd -lpsxgpu -lpsxgte -lpsxspu -lpsxsio -lpsxetc -lpsxapi -lc
CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
@@ -22,7 +20,7 @@ CPPFLAGS = $(CFLAGS) \
AFLAGS = -g -msoft-float
LDFLAGS = -g -Ttext=0x80010000 -gc-sections \
- -T $(GCC_BASE)/mipsel-unknown-elf/lib/ldscripts/elf32elmip.x
+ -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
all: $(OFILES)
$(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
diff --git a/examples/cdrom/cdxa/makefile b/examples/cdrom/cdxa/makefile
index 8d6d215..b95efa7 100644
--- a/examples/cdrom/cdxa/makefile
+++ b/examples/cdrom/cdxa/makefile
@@ -8,8 +8,6 @@ AFILES = $(notdir $(wildcard *.s))
OFILES = $(addprefix build/,$(CFILES:.c=.o) $(CPPFILES:.cpp=.o) $(AFILES:.s=.o))
-PREFIX = mipsel-unknown-elf-
-
LIBS = -lpsxcd -lpsxgpu -lpsxgte -lpsxspu -lpsxsio -lpsxetc -lpsxapi -lc
CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
@@ -22,7 +20,7 @@ CPPFLAGS = $(CFLAGS) \
AFLAGS = -g -msoft-float
LDFLAGS = -g -Ttext=0x80010000 -gc-sections \
- -T $(GCC_BASE)/mipsel-unknown-elf/lib/ldscripts/elf32elmip.x
+ -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
all: $(OFILES)
$(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
diff --git a/examples/demos/n00bdemo/makefile b/examples/demos/n00bdemo/makefile
index 27d0f1e..7e3bd8e 100644
--- a/examples/demos/n00bdemo/makefile
+++ b/examples/demos/n00bdemo/makefile
@@ -14,7 +14,7 @@ LIBS = -llzp -lpsxgpu -lpsxgte -lpsxspu -lpsxetc -lpsxapi -lc
CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
CPPFLAGS = $(CFLAGS) -fno-exceptions
AFLAGS = -g -msoft-float
-LDFLAGS = -g -Ttext=0x80010000 -gc-sections -T $(GCC_BASE)/mipsel-unknown-elf/lib/ldscripts/elf32elmip.x
+LDFLAGS = -g -Ttext=0x80010000 -gc-sections -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
all: resources $(OFILES)
$(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
diff --git a/examples/demos/n00bdemo/plasma_tbl.h b/examples/demos/n00bdemo/plasma_tbl.h
index dd322e6..9f54f98 100644
--- a/examples/demos/n00bdemo/plasma_tbl.h
+++ b/examples/demos/n00bdemo/plasma_tbl.h
@@ -1,7 +1,7 @@
#ifndef _PLASMA_TBL_H
#define _PLASMA_TBL_H
-unsigned int plasma_colors[256];
+extern unsigned int plasma_colors[];
extern short plasma_sin1[];
extern short plasma_sin2[];
extern short plasma_sin3[];
diff --git a/examples/examples-setup.mk b/examples/examples-setup.mk
index 0692d89..1fadd84 100644
--- a/examples/examples-setup.mk
+++ b/examples/examples-setup.mk
@@ -5,7 +5,7 @@
# This is only for the PSn00bSDK example programs, not recommended
# for use with user projects
-PREFIX = mipsel-unknown-elf-
+PREFIX = mipsel-unknown-elf
ifndef GCC_VERSION
@@ -56,9 +56,9 @@ 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
+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/examples/graphics/balls/makefile b/examples/graphics/balls/makefile
index f697fab..70f41bf 100644
--- a/examples/graphics/balls/makefile
+++ b/examples/graphics/balls/makefile
@@ -32,7 +32,7 @@ AFLAGS = -g -msoft-float
# Linker flags
LDFLAGS = -g -Ttext=0x80010000 -gc-sections \
- -T $(GCC_BASE)/mipsel-unknown-elf/lib/ldscripts/elf32elmip.x
+ -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
all: $(OFILES)
$(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
diff --git a/examples/graphics/billboard/makefile b/examples/graphics/billboard/makefile
index 5131d88..4f0fcf4 100644
--- a/examples/graphics/billboard/makefile
+++ b/examples/graphics/billboard/makefile
@@ -16,7 +16,8 @@ LIBS = -lpsxgpu -lpsxgte -lpsxspu -lpsxetc -lpsxapi -lc
CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
CPPFLAGS = $(CFLAGS) -fno-exceptions
AFLAGS = -g -msoft-float
-LDFLAGS = -g -Ttext=0x80010000 -gc-sections -T $(GCC_BASE)/mipsel-unknown-elf/lib/ldscripts/elf32elmip.x
+LDFLAGS = -g -Ttext=0x80010000 -gc-sections \
+ -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
all: $(OFILES)
$(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
diff --git a/examples/graphics/fpscam/makefile b/examples/graphics/fpscam/makefile
index dd2b13e..dac1d43 100644
--- a/examples/graphics/fpscam/makefile
+++ b/examples/graphics/fpscam/makefile
@@ -16,7 +16,8 @@ LIBS = -lpsxgpu -lpsxgte -lpsxspu -lpsxetc -lpsxapi -lc
CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
CPPFLAGS = $(CFLAGS) -fno-exceptions
AFLAGS = -g -msoft-float
-LDFLAGS = -g -Ttext=0x80010000 -gc-sections -T $(GCC_BASE)/mipsel-unknown-elf/lib/ldscripts/elf32elmip.x
+LDFLAGS = -g -Ttext=0x80010000 -gc-sections \
+ -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
all: $(OFILES)
$(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
diff --git a/examples/graphics/gte/makefile b/examples/graphics/gte/makefile
index bfcaff1..43b7c5b 100644
--- a/examples/graphics/gte/makefile
+++ b/examples/graphics/gte/makefile
@@ -16,7 +16,8 @@ LIBS = -lpsxgpu -lpsxgte -lpsxspu -lpsxetc -lpsxapi -lc
CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
CPPFLAGS = $(CFLAGS) -fno-exceptions
AFLAGS = -g -msoft-float
-LDFLAGS = -g -Ttext=0x80010000 -gc-sections -T $(GCC_BASE)/mipsel-unknown-elf/lib/ldscripts/elf32elmip.x
+LDFLAGS = -g -Ttext=0x80010000 -gc-sections \
+ -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
all: $(OFILES)
$(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
diff --git a/examples/graphics/hdtv/makefile b/examples/graphics/hdtv/makefile
index d9321bf..2c7cb71 100644
--- a/examples/graphics/hdtv/makefile
+++ b/examples/graphics/hdtv/makefile
@@ -17,7 +17,8 @@ LIBS = -lpsxgpu -lpsxgte -lpsxspu -lpsxetc -lpsxapi -lc
CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
CPPFLAGS = $(CFLAGS) -fno-exceptions
AFLAGS = -g -msoft-float
-LDFLAGS = -g -Ttext=0x80010000 -gc-sections -T $(GCC_BASE)/mipsel-unknown-elf/lib/ldscripts/elf32elmip.x
+LDFLAGS = -g -Ttext=0x80010000 -gc-sections \
+ -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
all: $(OFILES)
$(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
diff --git a/examples/graphics/render2tex/makefile b/examples/graphics/render2tex/makefile
index c69d37f..52d650b 100644
--- a/examples/graphics/render2tex/makefile
+++ b/examples/graphics/render2tex/makefile
@@ -16,7 +16,8 @@ LIBS = -lpsxgpu -lpsxgte -lpsxspu -lpsxetc -lpsxapi -lc
CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
CPPFLAGS = $(CFLAGS) -fno-exceptions
AFLAGS = -g -msoft-float
-LDFLAGS = -g -Ttext=0x80010000 -gc-sections -T $(GCC_BASE)/mipsel-unknown-elf/lib/ldscripts/elf32elmip.x
+LDFLAGS = -g -Ttext=0x80010000 -gc-sections \
+ -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
all: $(OFILES)
$(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
diff --git a/examples/graphics/rgb24/makefile b/examples/graphics/rgb24/makefile
index 5c08f87..3ec9cfe 100644
--- a/examples/graphics/rgb24/makefile
+++ b/examples/graphics/rgb24/makefile
@@ -16,7 +16,8 @@ LIBS = -lpsxgpu -lpsxetc -lpsxapi -lc
CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
CPPFLAGS = $(CFLAGS) -fno-exceptions
AFLAGS = -g -msoft-float
-LDFLAGS = -g -Ttext=0x80010000 -gc-sections -T $(GCC_BASE)/mipsel-unknown-elf/lib/ldscripts/elf32elmip.x
+LDFLAGS = -g -Ttext=0x80010000 -gc-sections \
+ -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
all: $(OFILES)
$(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
diff --git a/examples/lowlevel/cartrom/rom.s b/examples/lowlevel/cartrom/rom.s
index 14c1167..587ba6f 100644
--- a/examples/lowlevel/cartrom/rom.s
+++ b/examples/lowlevel/cartrom/rom.s
@@ -3,6 +3,9 @@
#
# TurboBoot Example by Lameguy64
#
+# Note: This example is being obsoleted as GAS is not ideal for making
+# ROM firmwares. Use ARMIPS instead, but it cannot build this example
+# as it is not GAS syntax compatible.
# Uncomment either PAR or XPLORER depending on the cartridge
diff --git a/examples/makefile b/examples/makefile
index 84ca0a4..e02f7ba 100644
--- a/examples/makefile
+++ b/examples/makefile
@@ -8,14 +8,16 @@ TOPTARGETS = all clean
DIRS = beginner/hello beginner/cppdemo
# Graphics examples
-DIRS += graphics/balls graphics/billboard graphics/fpscam graphics/gte \
- graphics/hdtv graphics/render2tex graphics/rgb24
+DIRS += graphics/balls graphics/billboard graphics/fpscam \
+ graphics/gte graphics/hdtv graphics/render2tex \
+ graphics/rgb24
# System related examples
-DIRS += system/childexec system/console system/timer system/tty
+DIRS += system/childexec system/console system/timer \
+ system/tty
# Low-level examples
-DIRS += lowlevel/cartrom
+DIRS +=
# CD-ROM examples
DIRS += cdrom/cdbrowse cdrom/cdxa
diff --git a/examples/system/childexec/makefile b/examples/system/childexec/makefile
index b1952fc..30229ae 100644
--- a/examples/system/childexec/makefile
+++ b/examples/system/childexec/makefile
@@ -8,7 +8,8 @@ LIBS = -lpsxgpu -lpsxgte -lpsxspu -lpsxetc -lpsxapi -lc
CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
CPPFLAGS = $(CFLAGS) -fno-exceptions
AFLAGS = -g -msoft-float
-LDFLAGS = -g -gc-sections -T $(GCC_BASE)/mipsel-unknown-elf/lib/ldscripts/elf32elmip.x
+LDFLAGS = -g -gc-sections \
+ -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
LDFLAGS_P = $(LDFLAGS) -Ttext=0x80010000
LDFLAGS_C = $(LDFLAGS) -Ttext=0x80030000
diff --git a/examples/system/console/makefile b/examples/system/console/makefile
index 4e0456e..1ee638f 100644
--- a/examples/system/console/makefile
+++ b/examples/system/console/makefile
@@ -32,7 +32,7 @@ AFLAGS = -g -msoft-float
# Linker flags
LDFLAGS = -g -Ttext=0x80010000 -gc-sections \
- -T $(GCC_BASE)/mipsel-unknown-elf/lib/ldscripts/elf32elmip.x
+ -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
all: $(OFILES)
$(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
diff --git a/examples/system/timer/makefile b/examples/system/timer/makefile
index 4b4c1a6..a8defe7 100644
--- a/examples/system/timer/makefile
+++ b/examples/system/timer/makefile
@@ -16,7 +16,8 @@ LIBS = -lpsxgpu -lpsxgte -lpsxspu -lpsxetc -lpsxapi -lc
CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
CPPFLAGS = $(CFLAGS) -fno-exceptions
AFLAGS = -g -msoft-float
-LDFLAGS = -g -Ttext=0x80010000 -gc-sections -T $(GCC_BASE)/mipsel-unknown-elf/lib/ldscripts/elf32elmip.x
+LDFLAGS = -g -Ttext=0x80010000 -gc-sections \
+ -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
all: $(OFILES)
$(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
diff --git a/examples/system/tty/makefile b/examples/system/tty/makefile
index 5514916..43893d5 100644
--- a/examples/system/tty/makefile
+++ b/examples/system/tty/makefile
@@ -32,7 +32,7 @@ AFLAGS = -g -msoft-float
# Linker flags
LDFLAGS = -g -Ttext=0x80010000 -gc-sections \
- -T $(GCC_BASE)/mipsel-unknown-elf/lib/ldscripts/elf32elmip.x
+ -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
all: $(OFILES)
$(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)