Organize folders and build system to prepare for small revamp
Goals include: * To recover emulator code into a working state (using SDL2 as I cannot use the Windows library) * To allow memory management in emulator to not mirror the intricacies of the calculator version (eg. aSystemStack, aVRAMBuffer, etc) * To recover actual printf-style error messages on the calculator * To use the standard library and avoid random reimplementations of functions * And other code cleanups that are only possible with CGDoom-specific header files, instead of the mix in platform.h and os.h
This commit is contained in:
parent
b7c16fd8a0
commit
a416d40eea
|
@ -1,5 +1,2 @@
|
|||
*.o
|
||||
CG_Doom.bin
|
||||
CG_Doom.elf
|
||||
CG_Doom.map
|
||||
doom.wad
|
||||
build-cg/
|
||||
build-sdl2/
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
CC=sh-elf-gcc
|
||||
CPP=sh-elf-g++
|
||||
OBJCOPY=sh-elf-objcopy
|
||||
MKG3A=mkg3a
|
||||
RM=rm
|
||||
CFLAGS=-m4a-nofpu -mb -fgcse-sm -fgcse-las -fgcse-after-reload -Isrc -O3 -fmerge-all-constants -mhitachi -fuse-linker-plugin -fstrict-volatile-bitfields -Wall -Wextra -Wno-sign-compare -Wno-unused-but-set-variable -Wno-unused-but-set-parameter -I../../../../include -lgcc -L../../../../lib -I./ -I../../cgdoom -D_FXCG_MINICOMPAT
|
||||
LDFLAGS=$(CFLAGS) -nostartfiles -T../../../../toolchain/prizm.x -Wl,-static -lfxcg -lgcc -Wl,-Map=$(PROJ_NAME).map
|
||||
CSOURCES=$(wildcard ../../cgdoom/*.c)
|
||||
ASMSOURCES=$(wildcard ../../cgdoom/*.s)
|
||||
OBJECTS=$(CSOURCES:.c=.o) $(ASMSOURCES:.s=.o)
|
||||
PROJ_NAME=CG_Doom
|
||||
BIN=$(PROJ_NAME).bin
|
||||
ELF=$(PROJ_NAME).elf
|
||||
ADDIN=$(PROJ_NAME).g3a
|
||||
|
||||
all: $(ADDIN)
|
||||
|
||||
|
||||
$(ADDIN): $(BIN)
|
||||
$(MKG3A) -n : -i uns:CGDOOM_UNSELECTED.png -i sel:CGDOOM_SELECTED.png $< $@
|
||||
|
||||
.s.o:
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
.cpp.o:
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
.cc.o:
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
$(ELF): $(OBJECTS)
|
||||
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
|
||||
$(BIN): $(ELF)
|
||||
$(OBJCOPY) -O binary $(PROJ_NAME).elf $(BIN)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJECTS) $(PROJ_NAME).bin $(PROJ_NAME).elf $(ADDIN)
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Binary file not shown.
|
@ -0,0 +1,101 @@
|
|||
# Makefile for the fx-CG 50 / Graph 90+E version of CGDoom.
|
||||
# Two target platforms: fx-CG and native (SDL2).
|
||||
|
||||
### Project structure.
|
||||
|
||||
NAME := CGDoom
|
||||
SRC := $(wildcard cgdoom/*.c cgdoom/*.s)
|
||||
|
||||
CFLAGS := -I cgdoom
|
||||
# Extra optimization passes just in case
|
||||
CFLAGS += -O3 -fgcse-sm -fgcse-las -fgcse-after-reload -fmerge-all-constants
|
||||
# We remove some warnings that come up a lot in Doom
|
||||
CFLAGS += -Wall -Wextra -Wno-sign-compare -Wno-unused-but-set-variable -Wno-unused-but-set-parameter
|
||||
|
||||
LDFLAGS :=
|
||||
|
||||
### fx-CG 50 build.
|
||||
|
||||
CG_CC := sh-elf-gcc
|
||||
CG_OBJCOPY := sh-elf-objcopy
|
||||
|
||||
# The libfxcg install folder (adjust to your needs)
|
||||
LIBFXCG_ROOT := ../..
|
||||
|
||||
# Platform selection
|
||||
CG_CFLAGS := $(CFLAGS) -I src-cg -m4a-nofpu -mb -mhitachi
|
||||
# Enforce strict access size in volatile bitfields, needed for PRAM mainly
|
||||
CG_CFLAGS += -fstrict-volatile-bitfields
|
||||
# We use libfxcg and libc within the libfxcg repository
|
||||
CG_CFLAGS += -I $(LIBFXCG_ROOT)/include -D_FXCG_MINICOMPAT
|
||||
|
||||
# Libraries specific to libfxcg and the cross-compiler
|
||||
CG_LDFLAGS := $(LDFLAGS) -L $(LIBFXCG_ROOT)/lib -lfxcg -lgcc
|
||||
# The build is mostly free-standing, with the libfxcg linker script
|
||||
CG_LDFLAGS += -nostartfiles -T $(LIBFXCG_ROOT)/toolchain/prizm.x
|
||||
# Generate a map of every function and global variable for debugging
|
||||
CG_LDFLAGS += -Wl,-Map=build-cg/$(NAME).map
|
||||
|
||||
CG_SRC := $(SRC) $(wildcard src-fxcg/*.c src-fxcg/*.s)
|
||||
CG_OBJ := $(CG_SRC:cgdoom/%=build-cg/%.o)
|
||||
|
||||
### Native SDL2 build.
|
||||
|
||||
CC ?= gcc
|
||||
|
||||
SDL2_CFLAGS := $(CFLAGS) -I src-sdl2 -DCG_EMULATOR $(pkg-config sdl2 --cflags)
|
||||
SDL2_LDFLAGS := $(LDFLAGS) $(pkg-config sdl2 --libs)
|
||||
|
||||
SDL2_SRC := $(SRC) $(wildcard src-sdl2/*.c)
|
||||
SDL2_OBJ := $(SDL2_SRC:cgdoom/%=build-sdl2/%.o)
|
||||
|
||||
### Build rules.
|
||||
|
||||
all: all-cg50
|
||||
|
||||
#~
|
||||
|
||||
all-cg50: $(NAME).g3a
|
||||
|
||||
$(NAME).g3a: build-cg/$(NAME).bin
|
||||
mkg3a -n : -i uns:CGDOOM_UNSELECTED.png -i sel:CGDOOM_SELECTED.png $< $@
|
||||
|
||||
build-cg/%.s.o: cgdoom/%.s | build-cg/
|
||||
$(CG_CC) $(CG_CFLAGS) -c $< -o $@
|
||||
|
||||
build-cg/%.c.o: cgdoom/%.c | build-cg/
|
||||
$(CG_CC) $(CG_CFLAGS) -c $< -o $@
|
||||
|
||||
build-cg/%.c.o: src-cg/%.c | build-cg/
|
||||
$(CG_CC) $(CG_CFLAGS) -c $< -o $@
|
||||
|
||||
build-cg/$(NAME).elf: $(CG_OBJ)
|
||||
$(CG_CC) $(CG_CFLAGS) $(CG_LDFLAGS) $^ -o $@
|
||||
|
||||
build-cg/$(NAME).bin: build-cg/$(NAME).elf
|
||||
$(CG_OBJCOPY) -O binary $< $@
|
||||
|
||||
#~
|
||||
|
||||
all-sdl2: $(NAME)
|
||||
|
||||
$(NAME): $(SDL2_OBJ)
|
||||
$(CC) $(SDL2_CFLAGS) $(SDL2_LDFLAGS) $^ -o $@
|
||||
|
||||
build-sdl2/%.c.o: cgdoom/%.c | build-sdl2/
|
||||
$(CC) $(SDL2_CFLAGS) -c $< -o $@
|
||||
|
||||
build-sdl2/%.c.o: src-sdl2/%.c | build-sdl2/
|
||||
$(CC) $(SDL2_CFLAGS) -c $< -o $@
|
||||
|
||||
#~
|
||||
|
||||
clean:
|
||||
rm -rf build-cg/ build-sdl2/
|
||||
|
||||
%/:
|
||||
@ mkdir -p $@
|
||||
|
||||
.PRECIOUS: %/ build-cg/%.d build-sdl2/%.d
|
||||
|
||||
include $(wildcard build-cg/*.d build-sdl2/*.d)
|
|
@ -97,11 +97,6 @@ enum {
|
|||
#define WIDTH 384
|
||||
#define HEIGHT 216
|
||||
|
||||
#define KEY_PRGM_OPTN 68
|
||||
#define KEY_PRGM_MENU 48
|
||||
#define KEY_PRGM_POWER 57
|
||||
#define KEY_PRGM_EXE 31
|
||||
|
||||
#define EmulHack_Sleep(x)
|
||||
#define ASSERT(x)
|
||||
#define InitFlashSimu(filename)
|
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 93 KiB |
Loading…
Reference in New Issue