Skip to content

Commit

Permalink
Normalize spacing, restructure GUI project, fixup cross-plat ROM sele…
Browse files Browse the repository at this point in the history
…ction (#7)
  • Loading branch information
jonko0493 authored Feb 1, 2023
1 parent 662204b commit 4914b77
Show file tree
Hide file tree
Showing 16 changed files with 320 additions and 297 deletions.
48 changes: 24 additions & 24 deletions SerialLoops.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SerialLoops.Lib", "src\SerialLoops.Lib\SerialLoops.Lib.csproj", "{CC729174-57CD-499A-B6E7-1FA6F9CE255F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E049F009-138F-401A-9D5A-1977CB8DAF49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E049F009-138F-401A-9D5A-1977CB8DAF49}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E049F009-138F-401A-9D5A-1977CB8DAF49}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E049F009-138F-401A-9D5A-1977CB8DAF49}.Release|Any CPU.Build.0 = Release|Any CPU
{0B5D20CC-9E91-4BC0-8A6E-0342ADCAC48D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0B5D20CC-9E91-4BC0-8A6E-0342ADCAC48D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0B5D20CC-9E91-4BC0-8A6E-0342ADCAC48D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0B5D20CC-9E91-4BC0-8A6E-0342ADCAC48D}.Release|Any CPU.Build.0 = Release|Any CPU
{CC729174-57CD-499A-B6E7-1FA6F9CE255F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CC729174-57CD-499A-B6E7-1FA6F9CE255F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC729174-57CD-499A-B6E7-1FA6F9CE255F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC729174-57CD-499A-B6E7-1FA6F9CE255F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A7259B55-BEEA-4ECC-AC0A-85CC8FA1BD53}
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E049F009-138F-401A-9D5A-1977CB8DAF49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E049F009-138F-401A-9D5A-1977CB8DAF49}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E049F009-138F-401A-9D5A-1977CB8DAF49}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E049F009-138F-401A-9D5A-1977CB8DAF49}.Release|Any CPU.Build.0 = Release|Any CPU
{0B5D20CC-9E91-4BC0-8A6E-0342ADCAC48D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0B5D20CC-9E91-4BC0-8A6E-0342ADCAC48D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0B5D20CC-9E91-4BC0-8A6E-0342ADCAC48D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0B5D20CC-9E91-4BC0-8A6E-0342ADCAC48D}.Release|Any CPU.Build.0 = Release|Any CPU
{CC729174-57CD-499A-B6E7-1FA6F9CE255F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CC729174-57CD-499A-B6E7-1FA6F9CE255F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC729174-57CD-499A-B6E7-1FA6F9CE255F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC729174-57CD-499A-B6E7-1FA6F9CE255F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A7259B55-BEEA-4ECC-AC0A-85CC8FA1BD53}
EndGlobalSection
EndGlobal
148 changes: 74 additions & 74 deletions src/SerialLoops.Lib/Sources/Makefile_main
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,32 @@ endif
# canned command sequence for binary data
#---------------------------------------------------------------------------------
define bin2o
bin2s $< | $(AS) -o $(@)
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(<F) | tr . _)`.h
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(<F) | tr . _)`.h
echo "extern const u32" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(<F) | tr . _)`.h
bin2s $< | $(AS) -o $(@)
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(<F) | tr . _)`.h
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(<F) | tr . _)`.h
echo "extern const u32" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(<F) | tr . _)`.h
endef


#---------------------------------------------------------------------------------
# path to tools
#---------------------------------------------------------------------------------
export PORTLIBS := $(DEVKITPRO)/portlibs/arm
export PATH := $(DEVKITARM)/bin:$(PORTLIBS)/bin:$(PATH)
LIBNDS := $(DEVKITPRO)/libnds
export PORTLIBS := $(DEVKITPRO)/portlibs/arm
export PATH := $(DEVKITARM)/bin:$(PORTLIBS)/bin:$(PATH)
LIBNDS := $(DEVKITPRO)/libnds

#---------------------------------------------------------------------------------
# the prefix on the compiler executables
#---------------------------------------------------------------------------------
PREFIX := arm-none-eabi-
PREFIX := arm-none-eabi-

export CC := $(PREFIX)gcc
export CXX := $(PREFIX)g++
export AS := $(PREFIX)as
export AR := $(PREFIX)ar
export OBJCOPY := $(PREFIX)objcopy
export OBJDUMP := $(PREFIX)objdump
export LD := $(PREFIX)ld
export CC := $(PREFIX)gcc
export CXX := $(PREFIX)g++
export AS := $(PREFIX)as
export AR := $(PREFIX)ar
export OBJCOPY := $(PREFIX)objcopy
export OBJDUMP := $(PREFIX)objdump
export LD := $(PREFIX)ld


#---------------------------------------------------------------------------------
Expand All @@ -46,35 +46,35 @@ export LD := $(PREFIX)ld
# DATA is a list of directories containing binary files embedded using bin2o
# GRAPHICS is a list of directories containing image files to be converted with grit
#---------------------------------------------------------------------------------
TARGET ?= newcode
BUILD ?= build
SOURCES ?= source
INCLUDES := include
DATA := data
GRAPHICS := gfx
TARGET ?= newcode
BUILD ?= build
SOURCES ?= source
INCLUDES := include
DATA := data
GRAPHICS := gfx

#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH :=
ARCH :=

CFLAGS := -g -Wall -O2\
-march=armv5te -mtune=arm946e-s -fomit-frame-pointer\
-ffast-math -fshort-wchar \
$(ARCH)
CFLAGS := -g -Wall -O2\
-march=armv5te -mtune=arm946e-s -fomit-frame-pointer\
-ffast-math -fshort-wchar \
$(ARCH)

CFLAGS += $(INCLUDE) -DARM9 -nodefaultlibs -I. -fno-builtin -c
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
CFLAGS += $(INCLUDE) -DARM9 -nodefaultlibs -I. -fno-builtin -c
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions

ASFLAGS := -g $(ARCH)
ASFLAGS := -g $(ARCH)
ifdef NEWSYM
SYMBOLST := -T $(shell dirname $(CURDIR))/$(shell dirname $(shell dirname $(SOURCES)))/symbols.x
NEWSYMT := -T $(shell dirname $(CURDIR))/$(NEWSYM)
else
SYMBOLST := -T $(shell dirname $(CURDIR))/$(shell dirname $(SOURCES))/symbols.x
NEWSYMT :=
endif
LDFLAGS = $(SYMBOLST) -T $(shell dirname $(CURDIR))/linker.x $(NEWSYMT) -g $(ARCH) -Map newcode.map
LDFLAGS = $(SYMBOLST) -T $(shell dirname $(CURDIR))/linker.x $(NEWSYMT) -g $(ARCH) -Map newcode.map

ifdef CODEADDR
LDFLAGS += -Ttext $(CODEADDR)
Expand All @@ -83,55 +83,55 @@ endif
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project (order is important)
#---------------------------------------------------------------------------------
LIBS := -lnds9 -lc -lgcc
LIBS := -lnds9 -lc -lgcc


#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS) $(DEVKITARM) $(DEVKITARM)/arm-none-eabi
LIBDIRS := $(LIBNDS) $(DEVKITARM) $(DEVKITARM)/arm-none-eabi

#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------

export OUTPUT := $(CURDIR)/$(TARGET)
export OUTPUT := $(CURDIR)/$(TARGET)

export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))

export DEPSDIR := $(CURDIR)/$(BUILD)
export DEPSDIR := $(CURDIR)/$(BUILD)

CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))

export OFILES := $(addsuffix .o,$(BINFILES)) \
$(PNGFILES:.png=.o) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(addsuffix .o,$(BINFILES)) \
$(PNGFILES:.png=.o) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)

export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)

export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) -L$(DEVKITARM)/lib/gcc/arm-none-eabi/12.2.0
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) -L$(DEVKITARM)/lib/gcc/arm-none-eabi/12.2.0


.PHONY: $(BUILD) clean

#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
@[ -d $@ ] || mkdir -p $@
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds

#---------------------------------------------------------------------------------
else
Expand All @@ -143,38 +143,38 @@ else
all: $(OUTPUT).bin $(OUTPUT).sym

$(OUTPUT).bin : $(OUTPUT).elf
$(OBJCOPY) -O binary $< $@
@echo built ... $(notdir $@)
$(OBJCOPY) -O binary $< $@
@echo built ... $(notdir $@)

$(OUTPUT).sym : $(OUTPUT).elf
$(OBJDUMP) -t $< > $@
@echo written the symbol table ... $(notdir $@)
$(OBJDUMP) -t $< > $@
@echo written the symbol table ... $(notdir $@)
#---------------------------------------------------------------------------------
%.elf: $(OFILES)
@echo linking $(notdir $@)
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
@echo linking $(notdir $@)
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@

#---------------------------------------------------------------------------------
%.bin.o : %.bin
%.bin.o : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
$(bin2o)
@echo $(notdir $<)
$(bin2o)
#---------------------------------------------------------------------------------
%.o: %.cpp
@echo $(notdir $<)
$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) -c $< -o $@ $(ERROR_FILTER)
@echo $(notdir $<)
$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) -c $< -o $@ $(ERROR_FILTER)
#---------------------------------------------------------------------------------
%.o: %.c
@echo $(notdir $<)
$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) -c $< -o $@ $(ERROR_FILTER)
@echo $(notdir $<)
$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) -c $< -o $@ $(ERROR_FILTER)
#---------------------------------------------------------------------------------
%.o: %.s
@echo $(notdir $<)
$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER)
@echo $(notdir $<)
$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER)

#---------------------------------------------------------------------------------
# This rule creates assembly source files using grit
Expand All @@ -184,11 +184,11 @@ $(OUTPUT).sym : $(OUTPUT).elf
#---------------------------------------------------------------------------------
%.s %.h : %.png %.grit
#---------------------------------------------------------------------------------
grit $< -fts -o$*
grit $< -fts -o$*

-include $(DEPSDIR)/*.d

#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
Loading

0 comments on commit 4914b77

Please sign in to comment.