libopencm3/tests/rules.mk

179 lines
5.4 KiB
Makefile
Raw Normal View History

tests: usb: gadget0 compatible interface (stm32f4) This introduces the first firmware setup specifically for automated testing. Based heavily on the linux kernel project's "USB Gadget Zero" idea, and in theory, this should be testable with <kernelsrc>/tools/usb/testusb.c but... not yet. It's tricky to set that up and poorly documented, so we've got our own tests instead. Instead, we include a set of python unit tests using pyusb. These currently only test a basic core subset of functionality, but have already been very helpful in finding latent bugs. In this first stage, we support only the stm32f4 disco board, (MB997) and FullSpeed USB devices. A generic "rules.mk" is introduced to support multi platform builds. (See below) Some basic performance tests are included, but as they take some time to run, you must manually enable them. See the README for more information NOTE! Only the source/sink functional interface is supported, loopback will require some comparision with a real gadget zero to check exactly how it's working. FOOTNOTES 1: This introduces a rules.mk file that is arguably substantially simpler[1] for re-use, and then uses this rules.mk file to support multiple target outputs from the same shared source tree. Less path requirements are imposed, and less variables need to be defined in each project's makefile. A separate bin directory is created for each project. All useful settings and configurations imported from the original library rules file. cxx support untested, but lifted from the original library rules file. [1] Than the file in the libopencm3-examples repo it is loosely based on.
2015-08-20 00:44:43 +00:00
##
## This file is part of the libopencm3 project.
##
## This library is free software: you can redistribute it and/or modify
## it under the terms of the GNU Lesser General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This library is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public License
## along with this library. If not, see <http://www.gnu.org/licenses/>.
##
# This version of rules.mk expects the following to be defined before
# inclusion..
### REQUIRED ###
# OPENCM3_DIR - duh
# OPENCM3_LIB - the basename, eg: opencm3_stm32f4
# OPENCM3_DEFS - the target define eg: -DSTM32F4
# ARCH_FLAGS - eg, -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16
# (ie, the full set of cpu arch flags, _none_ are defined in this file)
# PROJECT - will be the basename of the output elf, eg usb-gadget0-stm32f4disco
# CFILES - basenames only, eg main.c blah.c
# LDSCRIPT - full path, eg ../../examples/stm32/f4/stm32f4-discovery/stm32f4-discovery.ld
#
### OPTIONAL ###
# INCLUDES - fully formed -I paths, if you want extra, eg -I../shared
# BUILD_DIR - defaults to bin, should set this if you are building multiarch
# OPT - full -O flag, defaults to -Os
# CSTD - defaults -std=c99
# CXXSTD - no default.
# OOCD_INTERFACE - eg stlink-v2
# OOCD_TARGET - eg stm32f4x
# both only used if you use the "make flash" target.
# OOCD_FILE - eg my.openocd.cfg
# This overrides interface/target above, and is used as just -f FILE
### TODO/FIXME/notes ###
# No support for stylecheck.
# No support for BMP/texane/random flash methods, no plans either
# No support for magically finding the library.
# C++ hasn't been actually tested with this..... sorry bout that. ;)
# Second expansion/secondary not set, add this if you need them.
BUILD_DIR ?= bin
OPT ?= -Os
CSTD ?= -std=c99
# Be silent per default, but 'make V=1' will show all compiler calls.
# If you're insane, V=99 will print out all sorts of things.
V?=0
ifeq ($(V),0)
Q := @
NULL := 2>/dev/null
endif
# Tool paths.
PREFIX ?= arm-none-eabi-
CC = $(PREFIX)gcc
LD = $(PREFIX)gcc
OBJCOPY = $(PREFIX)objcopy
OBJDUMP = $(PREFIX)objdump
OOCD ?= openocd
OPENCM3_INC = $(OPENCM3_DIR)/include
# Inclusion of library header files
INCLUDES += $(patsubst %,-I%, . $(OPENCM3_INC) )
OBJS = $(CFILES:%.c=$(BUILD_DIR)/%.o)
GENERATED_BINS = $(PROJECT).elf $(PROJECT).bin $(PROJECT).map $(PROJECT).list $(PROJECT).lss
tests: usb: gadget0 compatible interface (stm32f4) This introduces the first firmware setup specifically for automated testing. Based heavily on the linux kernel project's "USB Gadget Zero" idea, and in theory, this should be testable with <kernelsrc>/tools/usb/testusb.c but... not yet. It's tricky to set that up and poorly documented, so we've got our own tests instead. Instead, we include a set of python unit tests using pyusb. These currently only test a basic core subset of functionality, but have already been very helpful in finding latent bugs. In this first stage, we support only the stm32f4 disco board, (MB997) and FullSpeed USB devices. A generic "rules.mk" is introduced to support multi platform builds. (See below) Some basic performance tests are included, but as they take some time to run, you must manually enable them. See the README for more information NOTE! Only the source/sink functional interface is supported, loopback will require some comparision with a real gadget zero to check exactly how it's working. FOOTNOTES 1: This introduces a rules.mk file that is arguably substantially simpler[1] for re-use, and then uses this rules.mk file to support multiple target outputs from the same shared source tree. Less path requirements are imposed, and less variables need to be defined in each project's makefile. A separate bin directory is created for each project. All useful settings and configurations imported from the original library rules file. cxx support untested, but lifted from the original library rules file. [1] Than the file in the libopencm3-examples repo it is loosely based on.
2015-08-20 00:44:43 +00:00
TGT_CPPFLAGS += -MD
TGT_CPPFLAGS += -Wall -Wundef $(INCLUDES)
TGT_CPPFLAGS += $(INCLUDES) $(OPENCM3_DEFS)
TGT_CFLAGS += $(OPT) $(CSTD) -ggdb3
TGT_CFLAGS += $(ARCH_FLAGS)
TGT_CFLAGS += -fno-common
TGT_CFLAGS += -ffunction-sections -fdata-sections
TGT_CFLAGS += -Wextra -Wshadow -Wno-unused-variable -Wimplicit-function-declaration
TGT_CFLAGS += -Wredundant-decls -Wstrict-prototypes -Wmissing-prototypes
TGT_CXXFLAGS += $(OPT) $(CXXSTD) -ggdb3
TGT_CXXFLAGS += $(ARCH_FLAGS)
TGT_CXXFLAGS += -fno-common
TGT_CXXFLAGS += -ffunction-sections -fdata-sections
TGT_CXXFLAGS += -Wextra -Wshadow -Wredundant-decls -Weffc++
TGT_LDFLAGS += -T$(LDSCRIPT) -L$(OPENCM3_DIR)/lib -nostartfiles
TGT_LDFLAGS += $(ARCH_FLAGS)
TGT_LDFLAGS += -specs=nano.specs
TGT_LDFLAGS += -Wl,--gc-sections
tests: usb: gadget0 compatible interface (stm32f4) This introduces the first firmware setup specifically for automated testing. Based heavily on the linux kernel project's "USB Gadget Zero" idea, and in theory, this should be testable with <kernelsrc>/tools/usb/testusb.c but... not yet. It's tricky to set that up and poorly documented, so we've got our own tests instead. Instead, we include a set of python unit tests using pyusb. These currently only test a basic core subset of functionality, but have already been very helpful in finding latent bugs. In this first stage, we support only the stm32f4 disco board, (MB997) and FullSpeed USB devices. A generic "rules.mk" is introduced to support multi platform builds. (See below) Some basic performance tests are included, but as they take some time to run, you must manually enable them. See the README for more information NOTE! Only the source/sink functional interface is supported, loopback will require some comparision with a real gadget zero to check exactly how it's working. FOOTNOTES 1: This introduces a rules.mk file that is arguably substantially simpler[1] for re-use, and then uses this rules.mk file to support multiple target outputs from the same shared source tree. Less path requirements are imposed, and less variables need to be defined in each project's makefile. A separate bin directory is created for each project. All useful settings and configurations imported from the original library rules file. cxx support untested, but lifted from the original library rules file. [1] Than the file in the libopencm3-examples repo it is loosely based on.
2015-08-20 00:44:43 +00:00
# OPTIONAL
#TGT_LDFLAGS += -Wl,-Map=$(PROJECT).map
tests: usb: gadget0 compatible interface (stm32f4) This introduces the first firmware setup specifically for automated testing. Based heavily on the linux kernel project's "USB Gadget Zero" idea, and in theory, this should be testable with <kernelsrc>/tools/usb/testusb.c but... not yet. It's tricky to set that up and poorly documented, so we've got our own tests instead. Instead, we include a set of python unit tests using pyusb. These currently only test a basic core subset of functionality, but have already been very helpful in finding latent bugs. In this first stage, we support only the stm32f4 disco board, (MB997) and FullSpeed USB devices. A generic "rules.mk" is introduced to support multi platform builds. (See below) Some basic performance tests are included, but as they take some time to run, you must manually enable them. See the README for more information NOTE! Only the source/sink functional interface is supported, loopback will require some comparision with a real gadget zero to check exactly how it's working. FOOTNOTES 1: This introduces a rules.mk file that is arguably substantially simpler[1] for re-use, and then uses this rules.mk file to support multiple target outputs from the same shared source tree. Less path requirements are imposed, and less variables need to be defined in each project's makefile. A separate bin directory is created for each project. All useful settings and configurations imported from the original library rules file. cxx support untested, but lifted from the original library rules file. [1] Than the file in the libopencm3-examples repo it is loosely based on.
2015-08-20 00:44:43 +00:00
ifeq ($(V),99)
TGT_LDFLAGS += -Wl,--print-gc-sections
tests: usb: gadget0 compatible interface (stm32f4) This introduces the first firmware setup specifically for automated testing. Based heavily on the linux kernel project's "USB Gadget Zero" idea, and in theory, this should be testable with <kernelsrc>/tools/usb/testusb.c but... not yet. It's tricky to set that up and poorly documented, so we've got our own tests instead. Instead, we include a set of python unit tests using pyusb. These currently only test a basic core subset of functionality, but have already been very helpful in finding latent bugs. In this first stage, we support only the stm32f4 disco board, (MB997) and FullSpeed USB devices. A generic "rules.mk" is introduced to support multi platform builds. (See below) Some basic performance tests are included, but as they take some time to run, you must manually enable them. See the README for more information NOTE! Only the source/sink functional interface is supported, loopback will require some comparision with a real gadget zero to check exactly how it's working. FOOTNOTES 1: This introduces a rules.mk file that is arguably substantially simpler[1] for re-use, and then uses this rules.mk file to support multiple target outputs from the same shared source tree. Less path requirements are imposed, and less variables need to be defined in each project's makefile. A separate bin directory is created for each project. All useful settings and configurations imported from the original library rules file. cxx support untested, but lifted from the original library rules file. [1] Than the file in the libopencm3-examples repo it is loosely based on.
2015-08-20 00:44:43 +00:00
endif
# Linker script generator fills this in for us.
ifeq (,$(DEVICE))
tests: usb: gadget0 compatible interface (stm32f4) This introduces the first firmware setup specifically for automated testing. Based heavily on the linux kernel project's "USB Gadget Zero" idea, and in theory, this should be testable with <kernelsrc>/tools/usb/testusb.c but... not yet. It's tricky to set that up and poorly documented, so we've got our own tests instead. Instead, we include a set of python unit tests using pyusb. These currently only test a basic core subset of functionality, but have already been very helpful in finding latent bugs. In this first stage, we support only the stm32f4 disco board, (MB997) and FullSpeed USB devices. A generic "rules.mk" is introduced to support multi platform builds. (See below) Some basic performance tests are included, but as they take some time to run, you must manually enable them. See the README for more information NOTE! Only the source/sink functional interface is supported, loopback will require some comparision with a real gadget zero to check exactly how it's working. FOOTNOTES 1: This introduces a rules.mk file that is arguably substantially simpler[1] for re-use, and then uses this rules.mk file to support multiple target outputs from the same shared source tree. Less path requirements are imposed, and less variables need to be defined in each project's makefile. A separate bin directory is created for each project. All useful settings and configurations imported from the original library rules file. cxx support untested, but lifted from the original library rules file. [1] Than the file in the libopencm3-examples repo it is loosely based on.
2015-08-20 00:44:43 +00:00
LDLIBS += -l$(OPENCM3_LIB)
endif
tests: usb: gadget0 compatible interface (stm32f4) This introduces the first firmware setup specifically for automated testing. Based heavily on the linux kernel project's "USB Gadget Zero" idea, and in theory, this should be testable with <kernelsrc>/tools/usb/testusb.c but... not yet. It's tricky to set that up and poorly documented, so we've got our own tests instead. Instead, we include a set of python unit tests using pyusb. These currently only test a basic core subset of functionality, but have already been very helpful in finding latent bugs. In this first stage, we support only the stm32f4 disco board, (MB997) and FullSpeed USB devices. A generic "rules.mk" is introduced to support multi platform builds. (See below) Some basic performance tests are included, but as they take some time to run, you must manually enable them. See the README for more information NOTE! Only the source/sink functional interface is supported, loopback will require some comparision with a real gadget zero to check exactly how it's working. FOOTNOTES 1: This introduces a rules.mk file that is arguably substantially simpler[1] for re-use, and then uses this rules.mk file to support multiple target outputs from the same shared source tree. Less path requirements are imposed, and less variables need to be defined in each project's makefile. A separate bin directory is created for each project. All useful settings and configurations imported from the original library rules file. cxx support untested, but lifted from the original library rules file. [1] Than the file in the libopencm3-examples repo it is loosely based on.
2015-08-20 00:44:43 +00:00
# nosys is only in newer gcc-arm-embedded...
#LDLIBS += -specs=nosys.specs
LDLIBS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group
# Burn in legacy hell fortran modula pascal yacc idontevenwat
.SUFFIXES:
.SUFFIXES: .c .h .o .cxx .elf .bin .list .lss
# Bad make, never *ever* try to get a file out of source control by yourself.
%: %,v
%: RCS/%,v
%: RCS/%
%: s.%
%: SCCS/s.%
tests: usb: gadget0 compatible interface (stm32f4) This introduces the first firmware setup specifically for automated testing. Based heavily on the linux kernel project's "USB Gadget Zero" idea, and in theory, this should be testable with <kernelsrc>/tools/usb/testusb.c but... not yet. It's tricky to set that up and poorly documented, so we've got our own tests instead. Instead, we include a set of python unit tests using pyusb. These currently only test a basic core subset of functionality, but have already been very helpful in finding latent bugs. In this first stage, we support only the stm32f4 disco board, (MB997) and FullSpeed USB devices. A generic "rules.mk" is introduced to support multi platform builds. (See below) Some basic performance tests are included, but as they take some time to run, you must manually enable them. See the README for more information NOTE! Only the source/sink functional interface is supported, loopback will require some comparision with a real gadget zero to check exactly how it's working. FOOTNOTES 1: This introduces a rules.mk file that is arguably substantially simpler[1] for re-use, and then uses this rules.mk file to support multiple target outputs from the same shared source tree. Less path requirements are imposed, and less variables need to be defined in each project's makefile. A separate bin directory is created for each project. All useful settings and configurations imported from the original library rules file. cxx support untested, but lifted from the original library rules file. [1] Than the file in the libopencm3-examples repo it is loosely based on.
2015-08-20 00:44:43 +00:00
all: $(PROJECT).elf $(PROJECT).bin
flash: $(PROJECT).flash
# error if not using linker script generator
ifeq (,$(DEVICE))
tests: usb: gadget0 compatible interface (stm32f4) This introduces the first firmware setup specifically for automated testing. Based heavily on the linux kernel project's "USB Gadget Zero" idea, and in theory, this should be testable with <kernelsrc>/tools/usb/testusb.c but... not yet. It's tricky to set that up and poorly documented, so we've got our own tests instead. Instead, we include a set of python unit tests using pyusb. These currently only test a basic core subset of functionality, but have already been very helpful in finding latent bugs. In this first stage, we support only the stm32f4 disco board, (MB997) and FullSpeed USB devices. A generic "rules.mk" is introduced to support multi platform builds. (See below) Some basic performance tests are included, but as they take some time to run, you must manually enable them. See the README for more information NOTE! Only the source/sink functional interface is supported, loopback will require some comparision with a real gadget zero to check exactly how it's working. FOOTNOTES 1: This introduces a rules.mk file that is arguably substantially simpler[1] for re-use, and then uses this rules.mk file to support multiple target outputs from the same shared source tree. Less path requirements are imposed, and less variables need to be defined in each project's makefile. A separate bin directory is created for each project. All useful settings and configurations imported from the original library rules file. cxx support untested, but lifted from the original library rules file. [1] Than the file in the libopencm3-examples repo it is loosely based on.
2015-08-20 00:44:43 +00:00
$(LDSCRIPT):
ifeq (,$(wildcard $(LDSCRIPT)))
$(error Unable to find specified linker script: $(LDSCRIPT))
endif
endif
tests: usb: gadget0 compatible interface (stm32f4) This introduces the first firmware setup specifically for automated testing. Based heavily on the linux kernel project's "USB Gadget Zero" idea, and in theory, this should be testable with <kernelsrc>/tools/usb/testusb.c but... not yet. It's tricky to set that up and poorly documented, so we've got our own tests instead. Instead, we include a set of python unit tests using pyusb. These currently only test a basic core subset of functionality, but have already been very helpful in finding latent bugs. In this first stage, we support only the stm32f4 disco board, (MB997) and FullSpeed USB devices. A generic "rules.mk" is introduced to support multi platform builds. (See below) Some basic performance tests are included, but as they take some time to run, you must manually enable them. See the README for more information NOTE! Only the source/sink functional interface is supported, loopback will require some comparision with a real gadget zero to check exactly how it's working. FOOTNOTES 1: This introduces a rules.mk file that is arguably substantially simpler[1] for re-use, and then uses this rules.mk file to support multiple target outputs from the same shared source tree. Less path requirements are imposed, and less variables need to be defined in each project's makefile. A separate bin directory is created for each project. All useful settings and configurations imported from the original library rules file. cxx support untested, but lifted from the original library rules file. [1] Than the file in the libopencm3-examples repo it is loosely based on.
2015-08-20 00:44:43 +00:00
# Need a special rule to have a bin dir
$(BUILD_DIR)/%.o: %.c
@printf " CC\t$<\n"
@mkdir -p $(dir $@)
$(Q)$(CC) $(TGT_CFLAGS) $(CFLAGS) $(TGT_CPPFLAGS) $(CPPFLAGS) -o $@ -c $<
tests: usb: gadget0 compatible interface (stm32f4) This introduces the first firmware setup specifically for automated testing. Based heavily on the linux kernel project's "USB Gadget Zero" idea, and in theory, this should be testable with <kernelsrc>/tools/usb/testusb.c but... not yet. It's tricky to set that up and poorly documented, so we've got our own tests instead. Instead, we include a set of python unit tests using pyusb. These currently only test a basic core subset of functionality, but have already been very helpful in finding latent bugs. In this first stage, we support only the stm32f4 disco board, (MB997) and FullSpeed USB devices. A generic "rules.mk" is introduced to support multi platform builds. (See below) Some basic performance tests are included, but as they take some time to run, you must manually enable them. See the README for more information NOTE! Only the source/sink functional interface is supported, loopback will require some comparision with a real gadget zero to check exactly how it's working. FOOTNOTES 1: This introduces a rules.mk file that is arguably substantially simpler[1] for re-use, and then uses this rules.mk file to support multiple target outputs from the same shared source tree. Less path requirements are imposed, and less variables need to be defined in each project's makefile. A separate bin directory is created for each project. All useful settings and configurations imported from the original library rules file. cxx support untested, but lifted from the original library rules file. [1] Than the file in the libopencm3-examples repo it is loosely based on.
2015-08-20 00:44:43 +00:00
$(BUILD_DIR)/%.o: %.cxx
@printf " CXX\t$<\n"
@mkdir -p $(dir $@)
$(Q)$(CC) $(TGT_CXXFLAGS) $(CXXFLAGS) $(TGT_CPPFLAGS) $(CPPFLAGS) -o $@ -c $<
tests: usb: gadget0 compatible interface (stm32f4) This introduces the first firmware setup specifically for automated testing. Based heavily on the linux kernel project's "USB Gadget Zero" idea, and in theory, this should be testable with <kernelsrc>/tools/usb/testusb.c but... not yet. It's tricky to set that up and poorly documented, so we've got our own tests instead. Instead, we include a set of python unit tests using pyusb. These currently only test a basic core subset of functionality, but have already been very helpful in finding latent bugs. In this first stage, we support only the stm32f4 disco board, (MB997) and FullSpeed USB devices. A generic "rules.mk" is introduced to support multi platform builds. (See below) Some basic performance tests are included, but as they take some time to run, you must manually enable them. See the README for more information NOTE! Only the source/sink functional interface is supported, loopback will require some comparision with a real gadget zero to check exactly how it's working. FOOTNOTES 1: This introduces a rules.mk file that is arguably substantially simpler[1] for re-use, and then uses this rules.mk file to support multiple target outputs from the same shared source tree. Less path requirements are imposed, and less variables need to be defined in each project's makefile. A separate bin directory is created for each project. All useful settings and configurations imported from the original library rules file. cxx support untested, but lifted from the original library rules file. [1] Than the file in the libopencm3-examples repo it is loosely based on.
2015-08-20 00:44:43 +00:00
$(PROJECT).elf: $(OBJS) $(LDSCRIPT) $(LIBDEPS)
tests: usb: gadget0 compatible interface (stm32f4) This introduces the first firmware setup specifically for automated testing. Based heavily on the linux kernel project's "USB Gadget Zero" idea, and in theory, this should be testable with <kernelsrc>/tools/usb/testusb.c but... not yet. It's tricky to set that up and poorly documented, so we've got our own tests instead. Instead, we include a set of python unit tests using pyusb. These currently only test a basic core subset of functionality, but have already been very helpful in finding latent bugs. In this first stage, we support only the stm32f4 disco board, (MB997) and FullSpeed USB devices. A generic "rules.mk" is introduced to support multi platform builds. (See below) Some basic performance tests are included, but as they take some time to run, you must manually enable them. See the README for more information NOTE! Only the source/sink functional interface is supported, loopback will require some comparision with a real gadget zero to check exactly how it's working. FOOTNOTES 1: This introduces a rules.mk file that is arguably substantially simpler[1] for re-use, and then uses this rules.mk file to support multiple target outputs from the same shared source tree. Less path requirements are imposed, and less variables need to be defined in each project's makefile. A separate bin directory is created for each project. All useful settings and configurations imported from the original library rules file. cxx support untested, but lifted from the original library rules file. [1] Than the file in the libopencm3-examples repo it is loosely based on.
2015-08-20 00:44:43 +00:00
@printf " LD\t$@\n"
$(Q)$(LD) $(TGT_LDFLAGS) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@
tests: usb: gadget0 compatible interface (stm32f4) This introduces the first firmware setup specifically for automated testing. Based heavily on the linux kernel project's "USB Gadget Zero" idea, and in theory, this should be testable with <kernelsrc>/tools/usb/testusb.c but... not yet. It's tricky to set that up and poorly documented, so we've got our own tests instead. Instead, we include a set of python unit tests using pyusb. These currently only test a basic core subset of functionality, but have already been very helpful in finding latent bugs. In this first stage, we support only the stm32f4 disco board, (MB997) and FullSpeed USB devices. A generic "rules.mk" is introduced to support multi platform builds. (See below) Some basic performance tests are included, but as they take some time to run, you must manually enable them. See the README for more information NOTE! Only the source/sink functional interface is supported, loopback will require some comparision with a real gadget zero to check exactly how it's working. FOOTNOTES 1: This introduces a rules.mk file that is arguably substantially simpler[1] for re-use, and then uses this rules.mk file to support multiple target outputs from the same shared source tree. Less path requirements are imposed, and less variables need to be defined in each project's makefile. A separate bin directory is created for each project. All useful settings and configurations imported from the original library rules file. cxx support untested, but lifted from the original library rules file. [1] Than the file in the libopencm3-examples repo it is loosely based on.
2015-08-20 00:44:43 +00:00
%.bin: %.elf
@printf " OBJCOPY\t$@\n"
$(Q)$(OBJCOPY) -O binary $< $@
%.lss: %.elf
$(OBJDUMP) -h -S $< > $@
%.list: %.elf
$(OBJDUMP) -S $< > $@
%.flash: %.elf
@printf " FLASH\t$<\n"
ifeq (,$(OOCD_FILE))
$(Q)(echo "halt; program $(realpath $(*).elf) verify reset" | nc -4 localhost 4444 2>/dev/null) || \
$(OOCD) -f interface/$(OOCD_INTERFACE).cfg \
tests: usb: gadget0 compatible interface (stm32f4) This introduces the first firmware setup specifically for automated testing. Based heavily on the linux kernel project's "USB Gadget Zero" idea, and in theory, this should be testable with <kernelsrc>/tools/usb/testusb.c but... not yet. It's tricky to set that up and poorly documented, so we've got our own tests instead. Instead, we include a set of python unit tests using pyusb. These currently only test a basic core subset of functionality, but have already been very helpful in finding latent bugs. In this first stage, we support only the stm32f4 disco board, (MB997) and FullSpeed USB devices. A generic "rules.mk" is introduced to support multi platform builds. (See below) Some basic performance tests are included, but as they take some time to run, you must manually enable them. See the README for more information NOTE! Only the source/sink functional interface is supported, loopback will require some comparision with a real gadget zero to check exactly how it's working. FOOTNOTES 1: This introduces a rules.mk file that is arguably substantially simpler[1] for re-use, and then uses this rules.mk file to support multiple target outputs from the same shared source tree. Less path requirements are imposed, and less variables need to be defined in each project's makefile. A separate bin directory is created for each project. All useful settings and configurations imported from the original library rules file. cxx support untested, but lifted from the original library rules file. [1] Than the file in the libopencm3-examples repo it is loosely based on.
2015-08-20 00:44:43 +00:00
-f target/$(OOCD_TARGET).cfg \
-c "program $(realpath $(*).elf) verify reset exit" \
tests: usb: gadget0 compatible interface (stm32f4) This introduces the first firmware setup specifically for automated testing. Based heavily on the linux kernel project's "USB Gadget Zero" idea, and in theory, this should be testable with <kernelsrc>/tools/usb/testusb.c but... not yet. It's tricky to set that up and poorly documented, so we've got our own tests instead. Instead, we include a set of python unit tests using pyusb. These currently only test a basic core subset of functionality, but have already been very helpful in finding latent bugs. In this first stage, we support only the stm32f4 disco board, (MB997) and FullSpeed USB devices. A generic "rules.mk" is introduced to support multi platform builds. (See below) Some basic performance tests are included, but as they take some time to run, you must manually enable them. See the README for more information NOTE! Only the source/sink functional interface is supported, loopback will require some comparision with a real gadget zero to check exactly how it's working. FOOTNOTES 1: This introduces a rules.mk file that is arguably substantially simpler[1] for re-use, and then uses this rules.mk file to support multiple target outputs from the same shared source tree. Less path requirements are imposed, and less variables need to be defined in each project's makefile. A separate bin directory is created for each project. All useful settings and configurations imported from the original library rules file. cxx support untested, but lifted from the original library rules file. [1] Than the file in the libopencm3-examples repo it is loosely based on.
2015-08-20 00:44:43 +00:00
$(NULL)
else
$(Q)(echo "halt; program $(realpath $(*).elf) verify reset" | nc -4 localhost 4444 2>/dev/null) || \
$(Q)$(OOCD) -f $(OOCD_FILE) \
-c "program $(realpath $(*).elf) verify reset exit" \
tests: usb: gadget0 compatible interface (stm32f4) This introduces the first firmware setup specifically for automated testing. Based heavily on the linux kernel project's "USB Gadget Zero" idea, and in theory, this should be testable with <kernelsrc>/tools/usb/testusb.c but... not yet. It's tricky to set that up and poorly documented, so we've got our own tests instead. Instead, we include a set of python unit tests using pyusb. These currently only test a basic core subset of functionality, but have already been very helpful in finding latent bugs. In this first stage, we support only the stm32f4 disco board, (MB997) and FullSpeed USB devices. A generic "rules.mk" is introduced to support multi platform builds. (See below) Some basic performance tests are included, but as they take some time to run, you must manually enable them. See the README for more information NOTE! Only the source/sink functional interface is supported, loopback will require some comparision with a real gadget zero to check exactly how it's working. FOOTNOTES 1: This introduces a rules.mk file that is arguably substantially simpler[1] for re-use, and then uses this rules.mk file to support multiple target outputs from the same shared source tree. Less path requirements are imposed, and less variables need to be defined in each project's makefile. A separate bin directory is created for each project. All useful settings and configurations imported from the original library rules file. cxx support untested, but lifted from the original library rules file. [1] Than the file in the libopencm3-examples repo it is loosely based on.
2015-08-20 00:44:43 +00:00
$(NULL)
endif
clean:
rm -rf $(BUILD_DIR) $(GENERATED_BINS)
tests: usb: gadget0 compatible interface (stm32f4) This introduces the first firmware setup specifically for automated testing. Based heavily on the linux kernel project's "USB Gadget Zero" idea, and in theory, this should be testable with <kernelsrc>/tools/usb/testusb.c but... not yet. It's tricky to set that up and poorly documented, so we've got our own tests instead. Instead, we include a set of python unit tests using pyusb. These currently only test a basic core subset of functionality, but have already been very helpful in finding latent bugs. In this first stage, we support only the stm32f4 disco board, (MB997) and FullSpeed USB devices. A generic "rules.mk" is introduced to support multi platform builds. (See below) Some basic performance tests are included, but as they take some time to run, you must manually enable them. See the README for more information NOTE! Only the source/sink functional interface is supported, loopback will require some comparision with a real gadget zero to check exactly how it's working. FOOTNOTES 1: This introduces a rules.mk file that is arguably substantially simpler[1] for re-use, and then uses this rules.mk file to support multiple target outputs from the same shared source tree. Less path requirements are imposed, and less variables need to be defined in each project's makefile. A separate bin directory is created for each project. All useful settings and configurations imported from the original library rules file. cxx support untested, but lifted from the original library rules file. [1] Than the file in the libopencm3-examples repo it is loosely based on.
2015-08-20 00:44:43 +00:00
.PHONY: all clean flash
-include $(OBJS:.o=.d)