Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ ALLTARGETS = $(filter-out common,$(notdir $(wildcard target/tx/*/*)))
TXS ?= devo6 devo7e devo7e-256 devo8 devo10 devo12e devo12 devof7 devof7-XMS devof4 devof4-XMS devof12e devof12e-XMS at9 at10 t8sg t8sg_v2 t8sg_v2_plus ir8m

#Filter non-existant emus
EMUS = $(foreach dir,$(TXS:%=emu_%),$(if $(wildcard target/$(dir)),$(dir),))
ALLEMUS = $(foreach dir,$(ALLTXS:%=emu_%),$(if $(wildcard target/$(dir)),$(dir),))
EMUS = $(addprefix emu_, $(TXS))
ALLEMUS = $(addprefix emu_, $(ALLTXS))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work if not every target has an emu?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to filter out some targets. but since we put target under family, it is a challenge to do so.

default:
@echo specify the target to build. target can be one of
Expand Down
22 changes: 12 additions & 10 deletions src/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ SRCS := $(SRC_C) $(SRC_CXX) $(SRC_S)
#This section intermediate build files #
############################################
ODIR = $(SDIR)objs/$(TARGET)$(ODIREXT)/
OBJS := $(patsubst %.c,$(ODIR)%.o,$(notdir $(SRCS)))
OBJS := $(patsubst %.c,$(ODIR)%.o,$(notdir $(SRC_C))) $(patsubst %.cpp,$(ODIR)%.o,$(notdir $(SRC_CXX)))

$(warning $(OBJS))

ifdef MODULAR
PROTO_OBJS := $(addprefix $(ODIR), $(notdir $(PROTO_SRC_C:.c=.o)))
Expand Down Expand Up @@ -213,31 +215,30 @@ $(MODELDIR):
#The main executable #
######################
$(SDIR)$(TARGET).$(EXEEXT): $(LINKFILE) $(OBJS) $(LIBOPENCM3)
@echo " + Building '$@' '$(SRC_CXX)'"
@echo " + Building '$(notdir $@)'"
ifdef LINKFILE #Create an empty 'obj/$(TARGET)/optimize.ld' just in case the linker script needs it
echo "" > $(ODIR)optimize.ld
endif
ifeq ("$(SRC_CXX)", "")
$(CC) -o $@ $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)
$(CC) -o $@ $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(LFLAGS2) $(CFLAGS) $(EXTRA_CFLAGS)
else
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we name his better? I have no idea what the difference is between LFLAGS and LFLAGS2 (Yes I know you didn't create it, but now is a good time to fix it)

$(CXX) -o $@ $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)
$(CXX) -o $@ $(OBJS) $(LIBOPENCM3) $(LFLAGS) $(LFLAGS2) $(CFLAGS) $(EXTRA_CFLAGS)
endif


##############################
#Build rules for all .o files#
##############################
$(ODIR)%.o: %.c
@echo " + Compiling '$<'"
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(basename $(notdir $<))) -c -o $@ $<
@echo " + Compiling '$(notdir $<)'"
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(basename $(notdir $<))) -MT $@ -MD -MP -MF $(@:.o=.d) -c -o $@ $<

$(ODIR)%.o: %.cpp
@echo " + Compiling '$<'"
$(CXX) $(CXXFLAGS) $(EXTRA_CFLAGS) $(CXXFLAGS_$(basename $(notdir $<))) -c -o $@ $<
@echo " + Compiling '$(notdir $<)'"
$(CXX) $(CXXFLAGS) $(EXTRA_CFLAGS) $(CXXFLAGS_$(basename $(notdir $<))) -MD -MP -MF $(@:.o=.d) -c -o $@ $<

#For module building
$(ODIR)%.o_: %.c
@echo " + Compiling '$<' as module"
@echo " + Compiling '$(notdir $<)' as module"
$(CC) $(CFLAGS) $(MODULE_CFLAGS) $(CFLAGS_$(basename $(notdir $<))) -c -o $@ $<

##############################
Expand All @@ -250,3 +251,4 @@ $(ODIR)hgstamp:
echo $(HGVERSION) > $(ODIR)hgstamp

include $(SDIR)fs/Makefile.inc
-include $(OBJS:.o=.d)
6 changes: 3 additions & 3 deletions src/target/drivers/mcu/emu/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ endif
ifdef USE_INTERNAL_FS
SRC_C += $(wildcard $(SDIR)target/drivers/filesystems/devofs/*.c) \
$(wildcard $(SDIR)target/drivers/filesystems/petit_fat/*.c)
CFLAGS = -DEMULATOR=USE_INTERNAL_FS
CFLAGS += -DEMULATOR=USE_INTERNAL_FS
else
CFLAGS = -DEMULATOR=USE_NATIVE_FS
CFLAGS += -DEMULATOR=USE_NATIVE_FS
endif

CFLAGS += -I$(SDIR)target/drivers/mcu/emu -I$(SDIR)target/drivers/filesystems
Expand All @@ -45,7 +45,7 @@ ifdef WINDOWS
EXEEXT = exe
ODIREXT = -w32
else
EXEEXT =
EXEEXT = elf
CFLAGS := $(CFLAGS) $(shell fltk-config --cflags)
LFLAGS := $(LFLAGS) $(shell fltk-config --ldflags)
ifndef SOUND
Expand Down
5 changes: 0 additions & 5 deletions src/target/tx/devo/common/Makefile.devofs.inc
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@

ifndef BUILD_TARGET
ALL += $(ODIR)/devo.fs

else

ifdef MODULAR
DEFAULT_PROTOCOLS = devo.mod dsm2.mod

Expand All @@ -18,5 +15,3 @@ ifneq "$(REQUIRED_PROTOCOLS)" ""
cp -pf $(REQUIRED_PROTOCOLS) $(ODIR)/tmpfs/protocol/
endif
target/drivers/filesystems/devofs/buildfs.py -c -f $@ -d $(ODIR)/tmpfs

endif
10 changes: 6 additions & 4 deletions src/target/tx/devo/common/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ HAS_4IN1_FLASH ?= 0
HAS_FLASH_DETECT ?= 0
USE_JTAG ?= 0

ODIR = $(SDIR)objs/$(TARGET)

FAMILY=devo
CROSS = arm-none-eabi-
EXTRA_MAKEFILES := $(EXTRA_MAKEFILES) $(SDIR)target/tx/devo/common/Makefile.inc
Expand All @@ -10,7 +12,7 @@ PROTO_LINKFILE = $(SDIR)target/tx/devo/$(TARGET)/protocol.ld

LIBOPENCM3 = $(SDIR)libopencm3/lib/libopencm3_stm32f1.a

SRC_C = $(wildcard $(SDIR)target/tx/devo/$(TARGET)/*.c) \
SRC_C += $(wildcard $(SDIR)target/tx/devo/$(TARGET)/*.c) \
$(wildcard $(SDIR)target/drivers/mcu/stm32/*.c) \
$(wildcard $(SDIR)target/drivers/storage/*.c) \
$(wildcard $(SDIR)target/drivers/indicators/*.c) \
Expand All @@ -31,7 +33,7 @@ SRC_C = $(wildcard $(SDIR)target/tx/devo/$(TARGET)/*.c) \
$(SDIR)target/drivers/input/analog/analog.c

ifdef MODULAR
PROTO_EXTRA_C = $(wildcard $(SDIR)target/tx/devo/common/protocol/*.c) \
PROTO_EXTRA_C += $(wildcard $(SDIR)target/tx/devo/common/protocol/*.c) \
$(SDIR)target/drivers/usb/devo_hid.c \
$(wildcard $(SDIR)protocol/spi/*.c) \
$(SDIR)target/tx/devo/common/module_signature.c \
Expand All @@ -40,7 +42,7 @@ else
SRC_C += $(wildcard $(SDIR)target/tx/devo/common/protocol/*.c)
endif

CFLAGS = -D"assert_param(x)=" -DSTM32F10X_HD -DSTM32F1 -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -fdata-sections -I$(SDIR)target/tx/devo/common -I$(SDIR)libopencm3/include -I$(SDIR)target/drivers/filesystems -fno-builtin-printf -Os --specs=nano.specs
CFLAGS += -D"assert_param(x)=" -DSTM32F10X_HD -DSTM32F1 -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -fdata-sections -I$(SDIR)target/tx/devo/common -I$(SDIR)libopencm3/include -I$(SDIR)target/drivers/filesystems -fno-builtin-printf -Os --specs=nano.specs
ifeq "$(HAS_4IN1_FLASH)" "1"
CFLAGS += -D"HAS_4IN1_FLASH=1"
endif
Expand All @@ -53,7 +55,7 @@ endif
MODULE_CFLAGS := -fno-builtin

#LFLAGS = -nostartfiles -Wl,-gc-sections -Wl,-Map=$(TARGET).map,--cref -nostdlib
LFLAGS = -nostartfiles -Wl,-gc-sections -Wl,-Map=$(SDIR)$(TARGET).map,--cref -lc -lnosys -L$(SDIR) -L$(SDIR)protocol -L$(SDIR)objs/$(TARGET) -Wl,-warn-common
LFLAGS = -nostartfiles -Wl,-gc-sections -Wl,-Map=$(SDIR)$(TARGET).map,--cref -lc -lnosys -L$(SDIR) -L$(SDIR)protocol -L$(ODIR) -Wl,-warn-common

LINKFILE = $(SDIR)target/tx/devo/$(TARGET)/$(TARGET).ld
LFLAGS2 = -Wl,-T$(LINKFILE)
Expand Down
3 changes: 3 additions & 0 deletions src/target/tx/devo/devo10/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ LANGUAGE := devo10

OPTIMIZE_DFU := 1

TARGET=devo10

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do I need this in every Makefile? Isn't it inferrable by the directory I'm in? The less things I need to define the better.
On the other hand, hiding away definitions makes things harder to read...I'm torn

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I struggled as well.
I can pass TARGET from Makefile, maybe I should do that.

include $(SDIR)/target/tx/devo/common/Makefile.inc
include $(SDIR)/Makefile.inc
8 changes: 4 additions & 4 deletions src/target/tx/devo/devo12/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ LANGUAGE := devo8,devo12

OPTIMIZE_DFU := 1

TARGET=devo12

include $(SDIR)/target/tx/devo/common/Makefile.inc
include $(SDIR)/Makefile.inc

ifndef BUILD_TARGET
ALL += $(TARGET)-lib.dfu
MEDIA_FILES =
else

$(TARGET)-lib.dfu: $(LAST_MODEL) $(TARGET).dfu $(PRE_FS)
/bin/rm -rf $(ODIR)/filesystem 2> /dev/null; true
/bin/mkdir $(ODIR)/filesystem
Expand Down Expand Up @@ -41,5 +43,3 @@ endif
zip -u deviation-$(HGVERSION).zip debug-$(HGVERSION).zip
rm -f debug-$(HGVERSION).zip
rm -f deviation-$(HGVERSION).dfu

endif #BUILD_TARGET
6 changes: 3 additions & 3 deletions src/target/tx/devo/devo12e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FONTS = filesystem/$(FILESYSTEM)/media/12normal.fon \
filesystem/$(FILESYSTEM)/media/04b03.fon
LANGUAGE := devo10

include $(SDIR)/target/tx/devo/common/Makefile.inc
TARGET=devo12e

ifndef BUILD_TARGET
endif
include $(SDIR)/target/tx/devo/common/Makefile.inc
include $(SDIR)/Makefile.inc
6 changes: 3 additions & 3 deletions src/target/tx/devo/devo6/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FONTS = filesystem/$(FILESYSTEM)/media/15normal.fon \
filesystem/$(FILESYSTEM)/media/23bold.fon
LANGUAGE := devo8

include $(SDIR)/target/tx/devo/common/Makefile.inc
TARGET=devo6

ifndef BUILD_TARGET
endif
include $(SDIR)/target/tx/devo/common/Makefile.inc
include $(SDIR)/Makefile.inc
11 changes: 5 additions & 6 deletions src/target/tx/devo/devo7e-256/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ LANGUAGE := devo10

OPTIMIZE_DFU := 1

include $(SDIR)/target/tx/devo/common/Makefile.inc

ifndef BUILD_TARGET

TARGET=devo7e-256
SRC_C += $(SDIR)/target/tx/devo/devo7e/crc.c

else
include $(SDIR)/target/tx/devo/common/Makefile.inc
include $(SDIR)/Makefile.inc


$(TARGET).fs_wrapper: $(LAST_MODEL)
perl -p -i -e 's/; has_pa-cyrf6936 = 1/ has_pa-cyrf6936 = 0/' filesystem/$(FILESYSTEM)/hardware.ini
perl -p -i -e 's/;switch_types: 3x2, 3x1, 2x2/;switch_types: 3x4, 3x3, 3x2, 3x1, 2x8, 2x7, 2x6, 2x5, 2x4, 2x3, 2x2, 2x1, potx2, potx1\n;May occur more than once if necessary.\n;Add nostock if stock FMOD and HOLD switches have been removed./' filesystem/$(FILESYSTEM)/hardware.ini
perl -p -i -e 's/;extra-switches=/; extra-switches = nostock\n; extra-switches = 3x4\n; extra-switches = 2x2\n; extra-switches = potx2/' filesystem/$(FILESYSTEM)/hardware.ini

endif

6 changes: 3 additions & 3 deletions src/target/tx/devo/devo7e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ MODULAR := 0x20004000
DFU_ARGS := -c 7 -b 0x08003000
ENABLE_LTO := 1

TARGET=devo7e

include $(SDIR)/target/tx/devo/common/Makefile.inc
include $(SDIR)/Makefile.inc

ifdef BUILD_TARGET
$(TARGET).fs_wrapper: $(LAST_MODEL)
perl -p -i -e 's/; has_pa-cyrf6936 = 1/ has_pa-cyrf6936 = 0/' filesystem/$(FILESYSTEM)/hardware.ini

endif
3 changes: 2 additions & 1 deletion src/target/tx/devo/devo8/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
TARGET=devo8
FILESYSTEMS := common base_fonts 320x240x16
SCREENSIZE := 320x240x16
DISPLAY_DRIVER := 8080/320x240x16.c
Expand All @@ -9,5 +8,7 @@ LANGUAGE := devo8

OPTIMIZE_DFU := 1

TARGET=devo8

include $(SDIR)/target/tx/devo/common/Makefile.inc
include $(SDIR)/Makefile.inc
16 changes: 7 additions & 9 deletions src/target/tx/devo/devof12e-XMS/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@ FONTS = filesystem/$(FILESYSTEM)/media/f12e.fon

OPTIMIZE_DFU := 1

include $(SDIR)/target/tx/devo/common/Makefile.inc
SRC_C += $(SDIR)target/tx/devo/devof12e/channels.c \
$(SDIR)target/tx/devo/devof12e/crc.c \
$(SDIR)target/tx/devo/devof12e/lcd.c \
$(SDIR)target/tx/devo/devof12e/mapped_gfx.c

ifndef BUILD_TARGET
TARGET=devof12e-XMS

SRC_C += $(SDIR)/target/tx/devo/devof12e/channels.c \
$(SDIR)/target/tx/devo/devof12e/crc.c \
$(SDIR)/target/tx/devo/devof12e/lcd.c \
$(SDIR)/target/tx/devo/devof12e/mapped_gfx.c

else
include $(SDIR)target/tx/devo/common/Makefile.inc
include $(SDIR)Makefile.inc

$(TARGET).fs_wrapper: $(LAST_MODEL)
perl -p -i -e 's/=12normal/=f12e/' filesystem/$(FILESYSTEM)/media/config.ini

endif
9 changes: 4 additions & 5 deletions src/target/tx/devo/devof4-XMS/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ OPTIMIZE_DFU := 1
MODULAR := 0x20004000
DFU_ARGS := -c 4 -b 0x08003000

include target/tx/devo/common/Makefile.inc

ifndef BUILD_TARGET

SRC_C += $(SDIR)/target/tx/devo/devof7/crc.c

endif
TARGET=devof4-XMS

include $(SDIR)target/tx/devo/common/Makefile.inc
include $(SDIR)Makefile.inc
12 changes: 5 additions & 7 deletions src/target/tx/devo/devof4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ PRE_FS = $(ODIR)/.pre_fs

INCLUDE_FS := 0

include target/tx/devo/common/Makefile.inc
include target/tx/devo/common/Makefile.devofs.inc

ifndef BUILD_TARGET

MEDIA_FILES =
NUM_MODELS ?= 10

SRC_C += $(SDIR)/target/tx/devo/devof7/crc.c

else
TARGET=devof4

include $(SDIR)target/tx/devo/common/Makefile.inc
include $(SDIR)target/tx/devo/common/Makefile.devofs.inc
include $(SDIR)Makefile.inc

#$(TARGET)-lib.dfu: $(wildcard filesystem/devof7/media/*.*) $(TARGET).dfu $(PRE_FS) $(TARGET).fs_wrapper
# target/common/devo/devofs/buildfs.pl -invert filesystem/devof7 > $(ODIR)/$(TARGET)-lib.bin
Expand All @@ -31,4 +30,3 @@ else

$(TARGET).fs_wrapper: $(LAST_MODEL)
rm filesystem/$(FILESYSTEM)/datalog.bin
endif
9 changes: 4 additions & 5 deletions src/target/tx/devo/devof7-XMS/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ OPTIMIZE_DFU := 1
MODULAR := 0x20004000
DFU_ARGS := -c 7 -b 0x08003000

include target/tx/devo/common/Makefile.inc

ifndef BUILD_TARGET

SRC_C += $(SDIR)/target/tx/devo/devof7/channels.c \
$(SDIR)/target/tx/devo/devof7/crc.c

endif
TARGET=devof7-XMS

include $(SDIR)/target/tx/devo/common/Makefile.inc
include $(SDIR)/Makefile.inc
16 changes: 7 additions & 9 deletions src/target/tx/devo/devof7/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@ DFU_ARGS := -c 7 -b 0x08003000

PRE_FS = $(ODIR)/.pre_fs

INCLUDE_FS := 0

include target/tx/devo/common/Makefile.inc
include target/tx/devo/common/Makefile.devofs.inc

ifndef BUILD_TARGET

MEDIA_FILES =
NUM_MODELS ?= 10

else
INCLUDE_FS := 0

TARGET=devof7

include $(SDIR)target/tx/devo/common/Makefile.inc
include $(SDIR)target/tx/devo/common/Makefile.devofs.inc
include $(SDIR)Makefile.inc

#$(TARGET)-lib.dfu: $(wildcard filesystem/devof7/media/*.*) $(TARGET).dfu $(PRE_FS) $(TARGET).fs_wrapper
# target/tx/devo/common/devofs/buildfs.pl -invert filesystem/devof7 > $(ODIR)/$(TARGET)-lib.bin
Expand All @@ -29,4 +28,3 @@ else

$(TARGET).fs_wrapper: $(LAST_MODEL)
rm filesystem/$(FILESYSTEM)/datalog.bin
endif
6 changes: 5 additions & 1 deletion src/target/tx/devo/emu_devo10/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ FONTS = filesystem/$(FILESYSTEM)/media/12normal.fon \
filesystem/$(FILESYSTEM)/media/04b03.fon
LANGUAGE := devo10

include target/drivers/mcu/emu/Makefile.inc
TARGET = emu_devo10
FAMILY = devo

include $(SDIR)/target/drivers/mcu/emu/Makefile.inc
include $(SDIR)/Makefile.inc
6 changes: 5 additions & 1 deletion src/target/tx/devo/emu_devo12/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ FONTS = filesystem/$(FILESYSTEM)/media/15normal.fon \
filesystem/$(FILESYSTEM)/media/23bold.fon
LANGUAGE := devo8,devo12

include target/drivers/mcu/emu/Makefile.inc
TARGET = emu_devo12
FAMILY = devo

include $(SDIR)/target/drivers/mcu/emu/Makefile.inc
include $(SDIR)/Makefile.inc
Loading