bldc/make/fw.mk

314 lines
7.8 KiB
Makefile
Raw Normal View History

2014-01-09 06:20:26 -08:00
##############################################################################
# Build global options
# NOTE: Can be overridden externally.
#
USE_LISPBM=1
2014-01-09 06:20:26 -08:00
# Compiler options here.
ifeq ($(USE_OPT),)
USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 -std=gnu99 -D_GNU_SOURCE
USE_OPT += -DBOARD_OTG_NOVBUSSENS $(build_args)
2020-03-31 07:42:11 -07:00
USE_OPT += -fsingle-precision-constant -Wdouble-promotion -specs=nosys.specs
2014-01-09 06:20:26 -08:00
endif
# C specific options here (added to USE_OPT).
ifeq ($(USE_COPT),)
USE_COPT =
2014-01-09 06:20:26 -08:00
endif
# C++ specific options here (added to USE_OPT).
ifeq ($(USE_CPPOPT),)
USE_CPPOPT = -fno-rtti
endif
# Enable this if you want the linker to remove unused code and data
ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
# Linker extra options here.
ifeq ($(USE_LDOPT),)
USE_LDOPT =
endif
# Enable this if you want link time optimizations (LTO)
ifeq ($(USE_LTO),)
USE_LTO = no
endif
2014-01-09 06:20:26 -08:00
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
endif
# Enable this if you want to see the full log while compiling.
ifeq ($(USE_VERBOSE_COMPILE),)
USE_VERBOSE_COMPILE = no
2014-01-09 06:20:26 -08:00
endif
# If enabled, this option makes the build process faster by not compiling
# modules not used in the current configuration.
ifeq ($(USE_SMART_BUILD),)
USE_SMART_BUILD = yes
endif
2014-01-09 06:20:26 -08:00
#
# Build global options
##############################################################################
##############################################################################
# Architecture or project specific options
#
# Stack size to be allocated to the Cortex-M process stack. This stack is
# the stack used by the main() thread.
ifeq ($(USE_PROCESS_STACKSIZE),)
USE_PROCESS_STACKSIZE = 0x800
endif
# Stack size to the allocated to the Cortex-M main/exceptions stack. This
# stack is used for processing interrupts and exceptions.
ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
USE_EXCEPTIONS_STACKSIZE = 0x800
endif
# Enables the use of FPU on Cortex-M4 (no, softfp, hard).
2014-01-09 06:20:26 -08:00
ifeq ($(USE_FPU),)
USE_FPU = hard
2014-01-09 06:20:26 -08:00
endif
# Enable this if you really want to use the STM FWLib.
ifeq ($(USE_FWLIB),)
USE_FWLIB = yes
endif
#
# Architecture or project specific options
##############################################################################
##############################################################################
# Project, sources and paths
#
# Imported source files and paths
2020-03-21 12:14:20 -07:00
CHIBIOS = ChibiOS_3.0.5
# Startup files
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk
# HAL-OSAL files
2014-01-09 06:20:26 -08:00
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/hal/ports/STM32/STM32F4xx/platform.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
# RTOS files
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
# Other files
include hwconf/hwconf.mk
include applications/applications.mk
2015-04-11 01:07:36 -07:00
include nrf/nrf.mk
2019-02-18 10:30:19 -08:00
include libcanard/canard.mk
include imu/imu.mk
include lora/lora.mk
include lzo/lzo.mk
include blackmagic/blackmagic.mk
2022-02-19 12:00:52 -08:00
include encoder/encoder.mk
2014-01-09 06:20:26 -08:00
ifeq ($(USE_LISPBM),1)
include lispBM/lispbm.mk
USE_OPT += -DUSE_LISPBM
endif
2014-01-09 06:20:26 -08:00
# Define linker script file here
LDSCRIPT= ld_eeprom_emu.ld
2014-01-09 06:20:26 -08:00
# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CSRC = $(STARTUPSRC) \
2014-01-09 06:20:26 -08:00
$(KERNSRC) \
$(PORTSRC) \
$(OSALSRC) \
2014-01-09 06:20:26 -08:00
$(HALSRC) \
$(PLATFORMSRC) \
$(CHIBIOS)/os/hal/lib/streams/chprintf.c \
2014-01-09 06:20:26 -08:00
$(CHIBIOS)/os/various/syscalls.c \
board.c \
2014-01-09 06:20:26 -08:00
main.c \
comm_usb_serial.c \
2014-01-09 06:20:26 -08:00
irq_handlers.c \
buffer.c \
comm_usb.c \
2014-01-09 06:20:26 -08:00
crc.c \
digital_filter.c \
ledpwm.c \
mcpwm.c \
servo_dec.c \
utils.c \
servo_simple.c \
2014-01-09 06:20:26 -08:00
packet.c \
terminal.c \
conf_general.c \
eeprom.c \
commands.c \
2014-09-20 04:41:18 -07:00
timeout.c \
2014-12-06 19:30:25 -08:00
comm_can.c \
2015-05-08 13:53:59 -07:00
flash_helper.c \
2015-12-08 12:01:23 -08:00
mc_interface.c \
mcpwm_foc.c \
2019-02-18 10:30:19 -08:00
gpdrive.c \
confgenerator.c \
timer.c \
i2c_bb.c \
2020-06-29 07:26:39 -07:00
spi_bb.c \
virtual_motor.c \
shutdown.c \
mempools.c \
worker.c \
2020-10-21 23:32:51 -07:00
bms.c \
2021-06-15 03:56:38 -07:00
events.c \
$(HWSRC) \
2015-04-11 01:07:36 -07:00
$(APPSRC) \
2019-02-18 10:30:19 -08:00
$(NRFSRC) \
$(CANARDSRC) \
$(IMUSRC) \
$(LORASRC) \
$(LZOSRC) \
2021-04-24 13:36:00 -07:00
$(BLACKMAGICSRC) \
2021-12-15 04:41:33 -08:00
qmlui/qmlui.c \
2022-02-19 12:00:52 -08:00
$(ENCSRC)
ifeq ($(USE_LISPBM),1)
CSRC += $(LISPBMSRC)
endif
2014-01-09 06:20:26 -08:00
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CPPSRC =
# C sources to be compiled in ARM mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
ACSRC =
# C++ sources to be compiled in ARM mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
ACPPSRC =
# C sources to be compiled in THUMB mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
TCSRC =
# C sources to be compiled in THUMB mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
TCPPSRC =
# List ASM source files here
ASMSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
2014-01-09 06:20:26 -08:00
INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
$(HALINC) $(PLATFORMINC) \
2014-04-14 14:02:45 -07:00
$(CHIBIOS)/os/various \
2015-12-08 12:01:23 -08:00
$(CHIBIOS)/os/hal/lib/streams \
2014-04-14 14:02:45 -07:00
mcconf \
appconf \
$(HWINC) \
2015-04-11 01:07:36 -07:00
$(APPINC) \
2019-02-18 10:30:19 -08:00
$(NRFINC) \
$(CANARDINC) \
$(IMUINC) \
$(LORAINC) \
$(LZOINC) \
2021-04-24 13:36:00 -07:00
$(BLACKMAGICINC) \
qmlui \
qmlui/hw \
2022-02-19 12:00:52 -08:00
qmlui/app \
$(ENCINC)
2014-01-09 06:20:26 -08:00
ifeq ($(USE_LISPBM),1)
INCDIR += $(LISPBMINC)
endif
2014-01-09 06:20:26 -08:00
ifdef app_custom_mkfile
include $(app_custom_mkfile)
endif
2014-01-09 06:20:26 -08:00
#
# Project, sources and paths
##############################################################################
##############################################################################
# Compiler settings
#
MCU = cortex-m4
TRGT = $(TCHAIN_PREFIX)
2014-01-09 06:20:26 -08:00
CC = $(TRGT)gcc
CPPC = $(TRGT)g++
# Enable loading with g++ only if you need C++ runtime support.
# NOTE: You can use C++ even without C++ support if you are careful. C++
# runtime support makes code size explode.
LD = $(TRGT)gcc
#LD = $(TRGT)g++
CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
AR = $(TRGT)ar
2014-01-09 06:20:26 -08:00
OD = $(TRGT)objdump
SZ = $(TRGT)size
2014-01-09 06:20:26 -08:00
HEX = $(CP) -O ihex
BIN = $(CP) -O binary
# ARM-specific options here
AOPT =
# THUMB-specific options here
TOPT = -mthumb -DTHUMB
# Define C warning options here
CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes -Wshadow
2014-01-09 06:20:26 -08:00
# Define C++ warning options here
CPPWARN = -Wall -Wextra -Wundef
2014-01-09 06:20:26 -08:00
#
# Compiler settings
##############################################################################
##############################################################################
# Start of user section
#
# List all user C define here, like -D_DEBUG=1
UDEFS =
# Define ASM defines here
UADEFS =
# List all user directories here
UINCDIR =
# List the user directory to look for the libraries here
ULIBDIR =
# List all user libraries here
ULIBS = -lm
#
# End of user defines
##############################################################################
ifeq ($(USE_FWLIB),yes)
include $(CHIBIOS)/ext/stdperiph_stm32f4/stm32lib.mk
CSRC += $(STM32SRC)
INCDIR += $(STM32INC)
USE_OPT += -DUSE_STDPERIPH_DRIVER
endif
2020-12-24 05:10:22 -08:00
RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
include $(RULESPATH)/rules.mk
build/$(PROJECT)/$(PROJECT).bin: build/$(PROJECT)/$(PROJECT).elf
$(BIN) build/$(PROJECT)/$(PROJECT).elf build/$(PROJECT)/$(PROJECT).bin --gap-fill 0xFF