espressif_tinyusb/examples/make.mk

90 lines
1.8 KiB
Makefile
Raw Normal View History

#
# Common make definition for all examples
#
# Compiler
CROSS_COMPILE = arm-none-eabi-
CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
OBJCOPY = $(CROSS_COMPILE)objcopy
SIZE = $(CROSS_COMPILE)size
MKDIR = mkdir
SED = sed
CP = cp
RM = rm
PYTHON ?= python
check_defined = \
$(strip $(foreach 1,$1, \
$(call __check_defined,$1,$(strip $(value 2)))))
__check_defined = \
$(if $(value $1),, \
$(error Undefined make flag: $1$(if $2, ($2))))
2019-09-03 08:25:36 +02:00
define newline
endef
# Select the board to build for.
ifeq ($(BOARD),)
$(info You must provide a BOARD parameter with 'BOARD=')
2019-09-03 08:25:36 +02:00
$(info Supported boards are:)
$(info $(sort $(subst /.,,$(subst $(TOP)/hw/bsp/, $(newline)-,$(wildcard $(TOP)/hw/bsp/*/.)))))
$(error BOARD not defined)
else
ifeq ($(wildcard $(TOP)/hw/bsp/$(BOARD)/.),)
$(error Invalid BOARD specified)
endif
endif
# Build directory
2019-05-24 07:04:47 +02:00
BUILD = _build/build-$(BOARD)
# Board specific
include $(TOP)/hw/bsp/$(BOARD)/board.mk
2019-05-14 08:59:45 +02:00
# Include all source C in board folder
SRC_C += hw/bsp/board.c
2019-05-14 08:59:45 +02:00
SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/hw/bsp/$(BOARD)/*.c))
# Compiler Flags
CFLAGS += \
-fsingle-precision-constant \
-fno-strict-aliasing \
-Wdouble-promotion \
-Wno-endif-labels \
-Wstrict-prototypes \
-Wall \
-Wextra \
-Werror \
-Werror-implicit-function-declaration \
2019-09-20 08:49:33 +02:00
-Wfatal-errors \
-Wfloat-equal \
-Wundef \
-Wshadow \
-Wwrite-strings \
-Wsign-compare \
-Wmissing-format-attribute \
-Wno-deprecated-declarations \
-Wnested-externs \
-Wunreachable-code \
-Wno-error=lto-type-mismatch \
-ffunction-sections \
-fdata-sections
# This causes lots of warning with nrf5x build due to nrfx code
# CFLAGS += -Wcast-align
# Debugging/Optimization
ifeq ($(DEBUG), 1)
CFLAGS += -Og -ggdb -DCFG_TUSB_DEBUG=2
else
2019-10-03 14:22:43 +02:00
ifneq ($(BOARD), spresense)
CFLAGS += -flto -Os
2019-10-03 14:22:43 +02:00
else
CFLAGS += -Os
endif
endif