continued integrating simulator
This commit is contained in:
parent
bef788a946
commit
b66067f50e
41
Makefile
41
Makefile
|
@ -1,4 +1,5 @@
|
||||||
TARGET := image
|
TARGET := image
|
||||||
|
TARGET_SIM := borgsim
|
||||||
TOPDIR = .
|
TOPDIR = .
|
||||||
|
|
||||||
SRC = \
|
SRC = \
|
||||||
|
@ -13,16 +14,6 @@ SERIAL = /dev/ttyUSB0
|
||||||
|
|
||||||
export TOPDIR
|
export TOPDIR
|
||||||
##############################################################################
|
##############################################################################
|
||||||
all: compile-$(TARGET)
|
|
||||||
@echo "==============================="
|
|
||||||
@echo "$(TARGET) compiled for: $(MCU)"
|
|
||||||
@echo "size is: "
|
|
||||||
@${TOPDIR}/scripts/size $(TARGET)
|
|
||||||
@echo "==============================="
|
|
||||||
|
|
||||||
simulator: autoconf.h .config .subdirs
|
|
||||||
$(MAKE) -f Makefile.simulator
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# generic fluff
|
# generic fluff
|
||||||
include defaults.mk
|
include defaults.mk
|
||||||
|
@ -57,13 +48,20 @@ endif # MAKECMDGOALS!=clean
|
||||||
endif # no_deps!=t
|
endif # no_deps!=t
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
all: compile-$(TARGET)
|
||||||
|
@echo "==============================="
|
||||||
|
@echo "$(TARGET) compiled for: $(MCU)"
|
||||||
|
@echo "size is: "
|
||||||
|
@${TOPDIR}/scripts/size $(TARGET)
|
||||||
|
@echo "==============================="
|
||||||
|
|
||||||
.PHONY: compile-subdirs
|
|
||||||
compile-subdirs:
|
.PHONY: compile-subdirs_avr
|
||||||
|
compile-subdirs_avr:
|
||||||
@ for dir in $(SUBDIRS); do make -C $$dir objects_avr || exit 5; done
|
@ for dir in $(SUBDIRS); do make -C $$dir objects_avr || exit 5; done
|
||||||
|
|
||||||
.PHONY: compile-$(TARGET)
|
.PHONY: compile-$(TARGET)
|
||||||
compile-$(TARGET): compile-subdirs $(TARGET).hex $(TARGET).bin $(TARGET).lst
|
compile-$(TARGET): compile-subdirs_avr $(TARGET).hex $(TARGET).bin $(TARGET).lst
|
||||||
|
|
||||||
OBJECTS += $(patsubst %.c,./obj_avr/%.o,${SRC})
|
OBJECTS += $(patsubst %.c,./obj_avr/%.o,${SRC})
|
||||||
SUBDIROBJECTS = $(foreach subdir,$(SUBDIRS),$(foreach object,$(shell cat $(subdir)/obj_avr/.objects),$(subdir)/$(object)))
|
SUBDIROBJECTS = $(foreach subdir,$(SUBDIRS),$(foreach object,$(shell cat $(subdir)/obj_avr/.objects),$(subdir)/$(object)))
|
||||||
|
@ -73,7 +71,7 @@ $(TARGET): $(OBJECTS) $(SUBDIROBJECTS)
|
||||||
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
#generic rules for AVR-Build
|
||||||
./obj_avr/%.o: %.c
|
./obj_avr/%.o: %.c
|
||||||
@ if [ ! -d obj_avr ]; then mkdir obj_avr ; fi
|
@ if [ ! -d obj_avr ]; then mkdir obj_avr ; fi
|
||||||
@ echo "compiling $<"
|
@ echo "compiling $<"
|
||||||
|
@ -94,6 +92,21 @@ $(TARGET): $(OBJECTS) $(SUBDIROBJECTS)
|
||||||
%-size: %.hex
|
%-size: %.hex
|
||||||
$(SIZE) $<
|
$(SIZE) $<
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#Rules for simulator build
|
||||||
|
|
||||||
|
.PHONY: compile-subdirs_sim
|
||||||
|
compile-subdirs_sim:
|
||||||
|
@ for dir in $(SUBDIRS); do make -C $$dir objects_sim || exit 5; done
|
||||||
|
@ make -C ./simulator/ objects_sim || exit 5;
|
||||||
|
|
||||||
|
simulator: autoconf.h .config .subdirs compile-subdirs_sim $(TARGET_SIM)
|
||||||
|
|
||||||
|
SUBDIROBJECTS_SIM = $(foreach subdir,$(SUBDIRS),$(foreach object,$(shell cat $(subdir)/obj_sim/.objects),$(subdir)/$(object)))
|
||||||
|
|
||||||
|
$(TARGET_SIM): $(SUBDIROBJECTS_SIM)
|
||||||
|
$(HOSTCC) $(LDFLAGS_SIM) $(LIBS_SIM) -o $@ $(SUBDIROBJECTS_SIM)
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
|
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
|
||||||
else if [ -x /bin/bash ]; then echo /bin/bash; \
|
else if [ -x /bin/bash ]; then echo /bin/bash; \
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
TARGET = libborg_hw.a
|
TARGET = libborg_hw.a
|
||||||
TOPDIR = ..
|
TOPDIR = ..
|
||||||
|
|
||||||
|
SRC_SIM :=
|
||||||
|
|
||||||
include $(TOPDIR)/defaults.mk
|
include $(TOPDIR)/defaults.mk
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,13 @@ CFLAGS += -g -Os -std=gnu99 -fgnu89-inline
|
||||||
LDFLAGS += -mmcu=$(MCU)
|
LDFLAGS += -mmcu=$(MCU)
|
||||||
|
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
#Settings for Simulator build
|
||||||
|
CFLAGS_SIM = -g -Wall -pedantic -std=c99 -O2
|
||||||
|
LDFLAGS_SIM = -Wl
|
||||||
|
LIBS_SIM = LIBS = -lglut -lpthread -lGL -lGLU
|
||||||
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# the default target
|
# the default target
|
||||||
$(TARGET):
|
$(TARGET):
|
||||||
|
|
39
rules.mk
39
rules.mk
|
@ -1,11 +1,11 @@
|
||||||
|
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# rules for buildung AVR objects
|
||||||
|
|
||||||
OBJECTS += $(patsubst %.c,obj_avr/%.o,${SRC})
|
OBJECTS += $(patsubst %.c,obj_avr/%.o,${SRC})
|
||||||
OBJECTS += $(patsubst %.S,obj_avr/%.o,${ASRC})
|
OBJECTS += $(patsubst %.S,obj_avr/%.o,${ASRC})
|
||||||
|
|
||||||
#./obj_avr/%.a: $(OBJECTS)
|
|
||||||
# $(AR) qcv $@ $^
|
|
||||||
# $(STRIP) --strip-unneeded $@
|
|
||||||
|
|
||||||
./obj_avr/%.o: %.S
|
./obj_avr/%.o: %.S
|
||||||
@ if [ ! -d obj_avr ]; then mkdir obj_avr ; fi
|
@ if [ ! -d obj_avr ]; then mkdir obj_avr ; fi
|
||||||
@ echo "assembling $<"
|
@ echo "assembling $<"
|
||||||
|
@ -16,18 +16,41 @@ OBJECTS += $(patsubst %.S,obj_avr/%.o,${ASRC})
|
||||||
@ echo "compiling $<"
|
@ echo "compiling $<"
|
||||||
@ $(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -c $<
|
@ $(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -c $<
|
||||||
|
|
||||||
|
objects_avr: $(OBJECTS)
|
||||||
|
@ echo "writing object ineventory"
|
||||||
|
@ echo $(OBJECTS) > obj_avr/.objects
|
||||||
|
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# rules for buildung simulator objects
|
||||||
|
|
||||||
|
SRC_SIM = $(SRC)
|
||||||
|
OBJECTS_SIM += $(patsubst %.c,obj_sim/%.o,${SRC_SIM})
|
||||||
|
|
||||||
|
./obj_sim/%.o: %.c
|
||||||
|
@ if [ ! -d obj_sim ]; then mkdir obj_sim ; fi
|
||||||
|
@ echo "compiling $<"
|
||||||
|
@ $(HOSTCC) -o $@ $(CFLAGS_SIM) -c $<
|
||||||
|
|
||||||
|
objects_sim: $(OBJECTS_SIM)
|
||||||
|
@ echo "writing object ineventory"
|
||||||
|
@ echo $(OBJECTS) > obj_sim/.objects
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
clean-common:
|
clean-common:
|
||||||
$(RM) $(TARGET) *.[odasE] *.d.new *~
|
$(RM) $(TARGET) *.[odasE] *.d.new *~
|
||||||
$(RM) -r ./obj_avr
|
$(RM) -r ./obj_avr
|
||||||
|
$(RM) -r ./obj_sim
|
||||||
|
|
||||||
clean: clean-common
|
clean: clean-common
|
||||||
|
|
||||||
all:
|
all:
|
||||||
make -C $(TOPDIR) all
|
make -C $(TOPDIR) all
|
||||||
|
|
||||||
objects_avr: $(OBJECTS)
|
|
||||||
@ echo "writing object ineventory"
|
|
||||||
@ echo $(OBJECTS) > obj_avr/.objects
|
|
||||||
|
|
||||||
|
|
||||||
include $(TOPDIR)/depend.mk
|
include $(TOPDIR)/depend.mk
|
||||||
|
|
Loading…
Reference in New Issue