Sync betaflight to Gitea
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
|
||||
|
||||
## V : Set verbosity level based on the V= parameter
|
||||
## V=0 Low
|
||||
## V=1 High
|
||||
export AT := @
|
||||
|
||||
ifndef V
|
||||
export V0 :=
|
||||
export V1 := $(AT)
|
||||
export STDOUT :=
|
||||
export MAKE := $(MAKE) --no-print-directory
|
||||
else ifeq ($(V), 0)
|
||||
export V0 := $(AT)
|
||||
export V1 := $(AT)
|
||||
export STDOUT:= "> /dev/null"
|
||||
export MAKE := $(MAKE) --no-print-directory
|
||||
else ifeq ($(V), 1)
|
||||
export V0 :=
|
||||
export V1 :=
|
||||
export STDOUT :=
|
||||
endif
|
||||
@@ -0,0 +1,59 @@
|
||||
checks: check-target-independence \
|
||||
check-fastdata-usage-correctness \
|
||||
check-platform-included \
|
||||
check-stale-submodule-paths
|
||||
|
||||
check-target-independence:
|
||||
$(V1) for test_target in $(VALID_TARGETS); do \
|
||||
FOUND=$$(grep -rE "\W$${test_target}(\W.*)?$$" src/main | grep -vE "(//)|(/\*).*\W$${test_target}(\W.*)?$$" | grep -vE "^src/main/target"); \
|
||||
if [ "$${FOUND}" != "" ]; then \
|
||||
echo "Target dependencies for target '$${test_target}' found:"; \
|
||||
echo "$${FOUND}"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
check-fastdata-usage-correctness:
|
||||
$(V1) NON_TRIVIALLY_INITIALIZED=$$(grep -Ern "\W?FAST_DATA_ZERO_INIT\W.*=.*" src/main/ | grep -Ev "=\s*(false|NULL|0(\.0*f?)?)\s*[,;]"); \
|
||||
if [ "$${NON_TRIVIALLY_INITIALIZED}" != "" ]; then \
|
||||
echo "Non-trivially initialized FAST_DATA_ZERO_INIT variables found, use FAST_DATA instead:"; \
|
||||
echo "$${NON_TRIVIALLY_INITIALIZED}"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
TRIVIALLY_INITIALIZED=$$(grep -Ern "\W?FAST_DATA\W.*;" src/main/ | grep -v "="); \
|
||||
EXPLICITLY_TRIVIALLY_INITIALIZED=$$(grep -Ern "\W?FAST_DATA\W.*;" src/main/ | grep -E "=\s*(false|NULL|0(\.0*f?)?)\s*[,;]"); \
|
||||
if [ "$${TRIVIALLY_INITIALIZED}$${EXPLICITLY_TRIVIALLY_INITIALIZED}" != "" ]; then \
|
||||
echo "Trivially initialized FAST_DATA variables found, use FAST_DATA_ZERO_INIT instead to save FLASH:"; \
|
||||
echo "$${TRIVIALLY_INITIALIZED}\n$${EXPLICITLY_TRIVIALLY_INITIALIZED}"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
check-platform-included:
|
||||
$(V1) PLATFORM_NOT_INCLUDED=$$(find src/main -type d -name target -prune -o -type f -name \*.c -exec grep -L "^#include \"platform.h\"" {} \;); \
|
||||
if [ "$$(echo $${PLATFORM_NOT_INCLUDED} | grep -v -e '^$$' | wc -l)" -ne 0 ]; then \
|
||||
echo "The following compilation units do not include the required target specific configuration provided by 'platform.h':"; \
|
||||
echo "$${PLATFORM_NOT_INCLUDED}"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
# Catches a common branch-switch trap: a directory was promoted to a submodule on
|
||||
# one branch, but the working tree still has the old embedded files from an earlier
|
||||
# branch (or vice versa). The build then fails with cryptic header/source errors.
|
||||
# We flag any path listed in .gitmodules that exists as a non-empty directory but
|
||||
# is missing the submodule .git marker — i.e. it has content that doesn't belong
|
||||
# to a hydrated submodule. Tells the user to clean the path and re-hydrate.
|
||||
check-stale-submodule-paths:
|
||||
$(V1) SENTINEL=$$(mktemp); $(RM) $$SENTINEL; \
|
||||
git config --file .gitmodules --get-regexp '\.path$$' 2>/dev/null | awk '{print $$2}' | \
|
||||
while IFS= read -r p; do \
|
||||
[ -d "$$p" ] || continue; \
|
||||
[ -e "$$p/.git" ] && continue; \
|
||||
[ -z "$$(ls -A "$$p" 2>/dev/null)" ] && continue; \
|
||||
echo "STALE: $$p contains files but is not a hydrated submodule on this branch"; \
|
||||
echo " fix: rm -rf $$p && git submodule update --init --checkout --recursive -- $$p"; \
|
||||
echo "stale" > $$SENTINEL; \
|
||||
done; \
|
||||
if [ -f $$SENTINEL ]; then \
|
||||
$(RM) $$SENTINEL; \
|
||||
exit 1; \
|
||||
fi
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
|
||||
CONFIGS_REPO_URL ?= https://github.com/betaflight/config
|
||||
# handle only this directory as config submodule
|
||||
CONFIGS_SUBMODULE_DIR := src/config
|
||||
BASE_CONFIGS = $(sort $(notdir $(patsubst %/,%,$(dir $(wildcard $(CONFIG_DIR)/configs/*/config.h)))))
|
||||
|
||||
ifneq ($(words $(CONFIG_DIR)),1)
|
||||
$(error CONFIG_DIR/BETAFLIGHT_CONFIG path contains whitespace; unsupported by GNU make wildcard.)
|
||||
endif
|
||||
|
||||
# Config handling — only active when CONFIG= is set explicitly
|
||||
ifneq ($(CONFIG),)
|
||||
|
||||
ifeq ($(wildcard $(CONFIG_DIR)/configs/),)
|
||||
$(error `$(CONFIG_DIR)` not found. Have you hydrated configuration using: 'make configs'?)
|
||||
endif
|
||||
|
||||
ifneq ($(TARGET),)
|
||||
$(error TARGET or CONFIG should be specified. Not both.)
|
||||
endif
|
||||
|
||||
CONFIG_HEADER_FILE = $(CONFIG_DIR)/configs/$(CONFIG)/config.h
|
||||
CONFIG_SOURCE_FILE = $(CONFIG_DIR)/configs/$(CONFIG)/config.c
|
||||
INCLUDE_DIRS += $(CONFIG_DIR)/configs/$(CONFIG)
|
||||
|
||||
# include $(CONFIG)/config.mk if it exists
|
||||
-include $(CONFIG_DIR)/configs/$(CONFIG)/config.mk
|
||||
|
||||
# OCTOSPI_FLASH_CHIP selects the flash chip wired to the OCTOSPI/XSPI peripheral.
|
||||
# Set in per-config config.mk (e.g. OCTOSPI_FLASH_CHIP := MX66UW1G45G). Emits both
|
||||
# USE_FLASH_<chip> (chip driver gating) and OCTOSPI_FLASH_CHIP_<chip> (build-time
|
||||
# selection marker for chips that cannot be probed via JEDEC RDID, such as those
|
||||
# operating in 8-line OPI mode).
|
||||
ifneq ($(OCTOSPI_FLASH_CHIP),)
|
||||
TARGET_FLAGS += -DUSE_FLASH_$(OCTOSPI_FLASH_CHIP) -DOCTOSPI_FLASH_CHIP_$(OCTOSPI_FLASH_CHIP)
|
||||
endif
|
||||
|
||||
ifneq ($(wildcard $(CONFIG_HEADER_FILE)),)
|
||||
|
||||
CONFIG_SRC :=
|
||||
ifneq ($(wildcard $(CONFIG_SOURCE_FILE)),)
|
||||
CONFIG_SRC += $(CONFIG_SOURCE_FILE)
|
||||
TARGET_FLAGS += -DUSE_CONFIG_SOURCE
|
||||
endif
|
||||
|
||||
CONFIG_REVISION := norevision
|
||||
ifeq ($(shell git -C "$(CONFIG_DIR)" rev-parse --is-inside-work-tree 2>/dev/null),true)
|
||||
ifeq ($(strip $(shell git -C "$(CONFIG_DIR)" status --porcelain -uno 2>/dev/null)),)
|
||||
CONFIG_REVISION := $(shell git -C "$(CONFIG_DIR)" rev-parse --short=7 HEAD 2>/dev/null)
|
||||
CONFIG_REVISION_DEFINE := -D'__CONFIG_REVISION__="$(CONFIG_REVISION)"'
|
||||
endif
|
||||
endif
|
||||
|
||||
# Extract constants from $(CONFIG_HEADER_FILE) via preprocessor expansion
|
||||
# Oscillator frequency (MHz) -> Hz
|
||||
HSE_VALUE_MHZ := $(call pp_def_value,$(CONFIG_HEADER_FILE),SYSTEM_HSE_MHZ)
|
||||
ifneq ($(strip $(HSE_VALUE_MHZ)),)
|
||||
HSE_VALUE := $(shell echo $$(( $(HSE_VALUE_MHZ) * 1000000 )) )
|
||||
endif
|
||||
|
||||
# MCU target from config header
|
||||
TARGET := $(call pp_def_value,$(CONFIG_HEADER_FILE),FC_TARGET_MCU)
|
||||
ifeq ($(strip $(TARGET)),)
|
||||
$(error No TARGET identified. Is the $(CONFIG_HEADER_FILE) valid for $(CONFIG)?)
|
||||
endif
|
||||
|
||||
# Optional EXST address adjustment
|
||||
EXST_ADJUST_VMA := $(call pp_def_value,$(CONFIG_HEADER_FILE),FC_VMA_ADDRESS)
|
||||
ifneq ($(strip $(EXST_ADJUST_VMA)),)
|
||||
EXST = yes
|
||||
endif
|
||||
|
||||
else #exists
|
||||
$(error `$(CONFIG_HEADER_FILE)` not found. Have you hydrated configuration using: 'make configs'?)
|
||||
endif #CONFIG_HEADER_FILE exists
|
||||
endif #config
|
||||
|
||||
.PHONY: configs
|
||||
configs:
|
||||
ifeq ($(shell realpath "$(CONFIG_DIR)"),$(shell realpath "$(CONFIGS_SUBMODULE_DIR)"))
|
||||
@echo "Updating config submodule: $(CONFIGS_SUBMODULE_DIR)"
|
||||
$(V1) git submodule update --init -- "$(CONFIGS_SUBMODULE_DIR)" || { echo "Config submodule update failed. Please check your git configuration."; exit 1; }
|
||||
@echo "Submodule update succeeded."
|
||||
else
|
||||
ifeq ($(wildcard $(CONFIG_DIR)),)
|
||||
@echo "Hydrating clone for configs: $(CONFIG_DIR)"
|
||||
$(V1) git clone --depth=1 $(CONFIGS_REPO_URL) "$(CONFIG_DIR)"
|
||||
else
|
||||
$(V1) git -C "$(CONFIG_DIR)" pull --ff-only origin
|
||||
endif
|
||||
endif
|
||||
|
||||
$(BASE_CONFIGS):
|
||||
@echo "Building target config $@"
|
||||
$(V0) $(MAKE) fwo CONFIG=$@
|
||||
@echo "Building target config $@ succeeded."
|
||||
|
||||
## <CONFIG>_rev : build configured target and add revision to filename
|
||||
$(addsuffix _rev,$(BASE_CONFIGS)):
|
||||
$(V0) $(MAKE) fwo CONFIG=$(subst _rev,,$@) REV=yes
|
||||
|
||||
# When configs are not hydrated, BASE_CONFIGS is empty so config targets
|
||||
# have no recipe. Override Make's default "No rule" error with a helpful message
|
||||
# but only for targets explicitly requested on the command line.
|
||||
ifeq ($(wildcard $(CONFIG_DIR)/configs/),)
|
||||
.DEFAULT:
|
||||
@if echo " $(MAKECMDGOALS) " | grep -q " $@ "; then \
|
||||
echo "*** No rule to make target '$@'. If this is a configuration target, run 'make configs' first." >&2; \
|
||||
exit 1; \
|
||||
fi
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
# DroneCAN stack + libcanard transport.
|
||||
#
|
||||
# Each MCU family that wants the stack opts in from its own .mk file with
|
||||
# one line:
|
||||
#
|
||||
# LIB_SUBMODULES += $(DRONECAN_LIB_DIR)
|
||||
#
|
||||
# When this file is sourced (after the MCU .mk has populated
|
||||
# LIB_SUBMODULES) the presence of that path triggers the rest of the
|
||||
# wiring: source list, size-optimised flags and include directory. MCUs
|
||||
# that don't opt in never reference libcanard, so neither the external
|
||||
# library nor the Betaflight-side glue is compiled for non-CAN targets.
|
||||
|
||||
ifneq ($(filter $(DRONECAN_LIB_DIR),$(LIB_SUBMODULES)),)
|
||||
|
||||
MCU_COMMON_SRC += \
|
||||
io/dronecan/dronecan.c \
|
||||
io/dronecan/dronecan_gnss.c \
|
||||
io/dronecan/dronecan_node.c \
|
||||
dronecan/libcanard/canard.c
|
||||
|
||||
SIZE_OPTIMISED_SRC += \
|
||||
dronecan/libcanard/canard.c
|
||||
|
||||
INCLUDE_DIRS += $(ROOT)/$(DRONECAN_LIB_DIR)
|
||||
|
||||
endif
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
# linux.mk
|
||||
#
|
||||
# Goals:
|
||||
# Configure an environment that will allow Taulabs GCS and firmware to be built
|
||||
# on a Linux system. The environment will support the current versions of Qt SDK
|
||||
# and the ARM toolchain installed to either the Taulabs/tools directory, their
|
||||
# respective default installation locations, or made available on the system path.
|
||||
|
||||
# First look for `python3`. If `which` doesn't return a null value, then it exists!
|
||||
ifneq ($(shell which python3), "")
|
||||
PYTHON:=python3
|
||||
else
|
||||
# Get Python version, separate major/minor/patch, then put into wordlist
|
||||
PYTHON_VERSION_=$(wordlist 2,4,$(subst ., ,$(shell python -V 2>&1)))
|
||||
# Get major version from aforementioned list
|
||||
PYTHON_MAJOR_VERSION_=$(word 1,$(PYTHON_VERSION_))
|
||||
# Just in case Make has some weird scope stuff
|
||||
PYTHON=0
|
||||
# If the major Python version is the one we want..
|
||||
ifeq ($(PYTHON_MAJOR_VERSION_),3)
|
||||
# Then we can just use the normal Python executable
|
||||
PYTHON:=python
|
||||
else
|
||||
# And if it doesn't exist, let's use the default Python, and warn the user.
|
||||
# PYTHON NOT FOUND.
|
||||
PYTHON:=python
|
||||
echo "Python not found."
|
||||
endif
|
||||
endif
|
||||
|
||||
export PYTHON
|
||||
@@ -0,0 +1,31 @@
|
||||
# macosx.mk
|
||||
#
|
||||
# Goals:
|
||||
# Configure an environment that will allow Taulabs GCS and firmware to be built
|
||||
# on a Mac OSX system. The environment will support the current version of the
|
||||
# ARM toolchain installed to either their respective default installation
|
||||
# locations, the tools directory or made available on the system path.
|
||||
|
||||
# First look for `python3`. If `which` doesn't return a null value, then it exists!
|
||||
ifneq ($(shell which python3), "")
|
||||
PYTHON:=python3
|
||||
else
|
||||
# Get Python version, separate major/minor/patch, then put into wordlist
|
||||
PYTHON_VERSION_=$(wordlist 2,4,$(subst ., ,$(shell python -V 2>&1)))
|
||||
# Get major version from aforementioned list
|
||||
PYTHON_MAJOR_VERSION_=$(word 1,$(PYTHON_VERSION_))
|
||||
# Just in case Make has some weird scope stuff
|
||||
PYTHON=0
|
||||
# If the major Python version is the one we want..
|
||||
ifeq ($(PYTHON_MAJOR_VERSION_),3)
|
||||
# Then we can just use the normal Python executable
|
||||
PYTHON:=python
|
||||
else
|
||||
# And if it doesn't exist, let's use the default Python, and warn the user.
|
||||
# PYTHON NOT FOUND.
|
||||
PYTHON:=python
|
||||
echo "Python not found."
|
||||
endif
|
||||
endif
|
||||
|
||||
export PYTHON
|
||||
@@ -0,0 +1,19 @@
|
||||
OPENOCD ?= openocd
|
||||
OPENOCD_IF ?= interface/stlink-v2.cfg
|
||||
|
||||
ifeq ($(TARGET_MCU_FAMILY),STM32F4)
|
||||
OPENOCD_CFG := target/stm32f4x.cfg
|
||||
|
||||
else ifeq ($(TARGET_MCU_FAMILY),STM32G4)
|
||||
OPENOCD_CFG := target/stm32g4x.cfg
|
||||
|
||||
else ifeq ($(TARGET_MCU_FAMILY),STM32F7)
|
||||
OPENOCD_CFG := target/stm32f7x.cfg
|
||||
|
||||
else ifeq ($(TARGET_MCU_FAMILY),STM32H7)
|
||||
OPENOCD_CFG := target/stm32h7x.cfg
|
||||
endif
|
||||
|
||||
ifneq ($(OPENOCD_CFG),)
|
||||
OPENOCD_COMMAND = $(OPENOCD) -f $(OPENOCD_IF) -f $(OPENOCD_CFG)
|
||||
endif
|
||||
@@ -0,0 +1,44 @@
|
||||
###############################################################################
|
||||
# Generic preprocessor macro expansion helpers
|
||||
#
|
||||
# Public interface (pp_*):
|
||||
# pp_def_value(<header.h>, EXPR) -> expanded EXPR
|
||||
# pp_def_value_str(<header.h>, EXPR) -> expanded EXPR containing string, unquoting it
|
||||
#
|
||||
# Notes:
|
||||
# - Uses $(CROSS_CC) -E with -imacros to include only the given header's macros.
|
||||
# - value_str: merge adjacent strings and remove quotes ("a""b" "B C" -> abB C)
|
||||
###############################################################################
|
||||
|
||||
_pp_expand_raw = $(strip $(shell \
|
||||
printf '%s' "$2" | \
|
||||
$(CROSS_CC) $(CPPFLAGS) \
|
||||
$(addprefix -D,$(OPTIONS)) \
|
||||
$(addprefix -I,$(INCLUDE_DIRS)) \
|
||||
$(addprefix -isystem,$(SYS_INCLUDE_DIRS)) \
|
||||
-E -P -xc -imacros "$1" - \
|
||||
| tr -d '\r\n' \
|
||||
))
|
||||
|
||||
# Expand only if the macro NAME is defined in header $1; otherwise yield empty
|
||||
# Use octal-escaped '#' so old make (3.81 on macOS) doesn't treat it as a comment.
|
||||
_pp_expand_guarded_raw = $(strip $(shell \
|
||||
printf '\043 if defined(%s)\n%s\n\043 endif\n' "$2" "$2" | \
|
||||
$(CROSS_CC) $(CPPFLAGS) \
|
||||
$(addprefix -D,$(OPTIONS)) \
|
||||
$(addprefix -I,$(INCLUDE_DIRS)) \
|
||||
$(addprefix -isystem,$(SYS_INCLUDE_DIRS)) \
|
||||
-E -P -xc -imacros "$1" - \
|
||||
| tr -d '\r\n' \
|
||||
))
|
||||
|
||||
# Concatenate adjacent strings (C rules) and remove quotes
|
||||
# Preprocessor already merged whitespace between tokens
|
||||
_pp_quote :="
|
||||
_pp_unquote = $(subst $(_pp_quote),,$(subst " ",,$1))
|
||||
|
||||
# Expanded value; empty if macro is not defined
|
||||
pp_def_value = $(call _pp_expand_guarded_raw,$1,$2)
|
||||
|
||||
# String values: collapse C string concatenation (" " -> ""), remove quotes
|
||||
pp_def_value_str = $(call _pp_unquote,$(call _pp_expand_guarded_raw,$1,$2))
|
||||
+591
@@ -0,0 +1,591 @@
|
||||
PG_SRC = \
|
||||
pg/adc.c \
|
||||
pg/alt_hold_multirotor.c \
|
||||
pg/alt_hold_wing.c \
|
||||
pg/autopilot.c \
|
||||
pg/beeper.c \
|
||||
pg/beeper_dev.c \
|
||||
pg/board.c \
|
||||
pg/bus_i2c.c \
|
||||
pg/bus_quadspi.c \
|
||||
pg/bus_spi.c \
|
||||
pg/can.c \
|
||||
pg/dashboard.c \
|
||||
pg/dronecan.c \
|
||||
pg/displayport_profiles.c \
|
||||
pg/dyn_notch.c \
|
||||
pg/flash.c \
|
||||
pg/flight_plan.c \
|
||||
pg/gimbal.c \
|
||||
pg/gps.c \
|
||||
pg/gps_lap_timer.c \
|
||||
pg/gps_rescue_multirotor.c \
|
||||
pg/gps_rescue_wing.c \
|
||||
pg/gyrodev.c \
|
||||
pg/max7456.c \
|
||||
pg/mco.c \
|
||||
pg/motor.c \
|
||||
pg/msp.c \
|
||||
pg/pg.c \
|
||||
pg/pilot.c \
|
||||
pg/piniobox.c \
|
||||
pg/pinio.c \
|
||||
pg/pin_pull_up_down.c \
|
||||
pg/pos_hold_multirotor.c \
|
||||
pg/pos_hold_wing.c \
|
||||
pg/rcdevice.c \
|
||||
pg/rpm_filter.c \
|
||||
pg/rx.c \
|
||||
pg/rx_pwm.c \
|
||||
pg/rx_spi.c \
|
||||
pg/rx_spi_cc2500.c \
|
||||
pg/rx_spi_expresslrs.c \
|
||||
pg/scheduler.c \
|
||||
pg/sdcard.c \
|
||||
pg/sdio.c \
|
||||
pg/serial_uart.c \
|
||||
pg/stats.c \
|
||||
pg/timerio.c \
|
||||
pg/timerup.c \
|
||||
pg/usb.c \
|
||||
pg/vcd.c \
|
||||
pg/vtx_io.c \
|
||||
pg/vtx_table.c
|
||||
|
||||
COMMON_SRC = \
|
||||
build/build_config.c \
|
||||
build/debug.c \
|
||||
build/version.c \
|
||||
main.c \
|
||||
common/bitarray.c \
|
||||
common/chirp.c \
|
||||
common/colorconversion.c \
|
||||
common/crc.c \
|
||||
common/encoding.c \
|
||||
common/explog_approx.c \
|
||||
common/filter.c \
|
||||
common/gps_conversion.c \
|
||||
common/huffman.c \
|
||||
common/huffman_table.c \
|
||||
common/maths.c \
|
||||
common/printf.c \
|
||||
common/printf_serial.c \
|
||||
common/pwl.c \
|
||||
common/sdft.c \
|
||||
common/sensor_alignment.c \
|
||||
common/stopwatch.c \
|
||||
common/streambuf.c \
|
||||
common/string_light.c \
|
||||
common/strtol.c \
|
||||
common/time.c \
|
||||
common/typeconversion.c \
|
||||
common/uvarint.c \
|
||||
common/vector.c \
|
||||
config/config.c \
|
||||
config/config_eeprom.c \
|
||||
config/config_streamer.c \
|
||||
config/feature.c \
|
||||
config/simplified_tuning.c \
|
||||
cli/cli.c \
|
||||
cli/settings.c \
|
||||
drivers/dshot.c \
|
||||
drivers/dshot_command.c \
|
||||
drivers/buf_writer.c \
|
||||
drivers/bus.c \
|
||||
drivers/bus_i2c_busdev.c \
|
||||
drivers/bus_i2c_utils.c \
|
||||
drivers/bus_i2c_soft.c \
|
||||
drivers/bus_octospi.c \
|
||||
drivers/bus_quadspi.c \
|
||||
drivers/buttons.c \
|
||||
drivers/camera_control.c \
|
||||
drivers/display.c \
|
||||
drivers/display_canvas.c \
|
||||
drivers/dma.c \
|
||||
drivers/io.c \
|
||||
drivers/io_preinit.c \
|
||||
drivers/lcd_console.c \
|
||||
drivers/lcd_panel/lcd_panel_font_5x7.c \
|
||||
drivers/lcd_panel/lcd_panel_stub.c \
|
||||
drivers/lcd_panel/ssd1306_i2c.c \
|
||||
drivers/light_led.c \
|
||||
drivers/motor.c \
|
||||
drivers/pinio.c \
|
||||
drivers/pin_pull_up_down.c \
|
||||
drivers/pwm_output.c \
|
||||
drivers/resource.c \
|
||||
drivers/serial.c \
|
||||
drivers/serial_impl.c \
|
||||
drivers/serial_lcd_console.c \
|
||||
drivers/sound_beeper.c \
|
||||
drivers/stack_check.c \
|
||||
drivers/timer_common.c \
|
||||
drivers/transponder_ir_arcitimer.c \
|
||||
drivers/transponder_ir_ilap.c \
|
||||
drivers/transponder_ir_erlt.c \
|
||||
fc/board_info.c \
|
||||
fc/dispatch.c \
|
||||
fc/faults.c \
|
||||
fc/tasks.c \
|
||||
fc/runtime_config.c \
|
||||
fc/stats.c \
|
||||
io/beeper.c \
|
||||
io/piniobox.c \
|
||||
io/serial.c \
|
||||
io/serial_resource.c \
|
||||
io/smartaudio_protocol.c \
|
||||
io/statusindicator.c \
|
||||
io/tramp_protocol.c \
|
||||
io/transponder_ir.c \
|
||||
io/usb_cdc_hid.c \
|
||||
io/usb_msc.c \
|
||||
msp/msp.c \
|
||||
msp/msp_box.c \
|
||||
msp/msp_build_info.c \
|
||||
msp/msp_serial.c \
|
||||
scheduler/scheduler.c \
|
||||
sensors/adcinternal.c \
|
||||
sensors/battery.c \
|
||||
sensors/current.c \
|
||||
sensors/voltage.c \
|
||||
target/config_helper.c \
|
||||
fc/init.c \
|
||||
fc/controlrate_profile.c \
|
||||
drivers/accgyro/gyro_sync.c \
|
||||
drivers/rx/rx_spi.c \
|
||||
drivers/rx/rx_xn297.c \
|
||||
drivers/rx/rx_pwm.c \
|
||||
drivers/serial_softserial.c \
|
||||
fc/core.c \
|
||||
fc/gps_lap_timer.c \
|
||||
fc/rc.c \
|
||||
fc/rc_adjustments.c \
|
||||
fc/rc_controls.c \
|
||||
fc/rc_modes.c \
|
||||
flight/alt_hold_multirotor.c \
|
||||
flight/alt_hold_wing.c \
|
||||
flight/autopilot_multirotor.c \
|
||||
flight/autopilot_wing.c \
|
||||
flight/dyn_notch_filter.c \
|
||||
flight/failsafe.c \
|
||||
flight/flight_plan_nav.c \
|
||||
flight/gps_rescue_multirotor.c \
|
||||
flight/gps_rescue_wing.c \
|
||||
flight/imu.c \
|
||||
flight/mixer.c \
|
||||
flight/mixer_init.c \
|
||||
flight/mixer_tricopter.c \
|
||||
flight/pid.c \
|
||||
flight/pid_init.c \
|
||||
flight/position.c \
|
||||
flight/position_estimator.c \
|
||||
flight/position_filter.c \
|
||||
flight/position_nav.c \
|
||||
flight/pos_hold_multirotor.c \
|
||||
flight/pos_hold_wing.c \
|
||||
flight/rpm_filter.c \
|
||||
flight/servos.c \
|
||||
flight/servos_tricopter.c \
|
||||
io/serial_4way.c \
|
||||
io/serial_4way_avrootloader.c \
|
||||
io/serial_4way_stk500v2.c \
|
||||
rx/ibus.c \
|
||||
rx/jetiexbus.c \
|
||||
rx/msp.c \
|
||||
rx/pwm.c \
|
||||
rx/frsky_crc.c \
|
||||
rx/rc_stats.c \
|
||||
rx/rx.c \
|
||||
rx/rx_bind.c \
|
||||
rx/rx_spi.c \
|
||||
rx/rx_spi_common.c \
|
||||
rx/crsf.c \
|
||||
rx/ghst.c \
|
||||
rx/sbus.c \
|
||||
rx/sbus_channels.c \
|
||||
rx/spektrum.c \
|
||||
rx/srxl2.c \
|
||||
io/spektrum_vtx_control.c \
|
||||
io/spektrum_rssi.c \
|
||||
rx/sumd.c \
|
||||
rx/sumh.c \
|
||||
rx/xbus.c \
|
||||
rx/fport.c \
|
||||
rx/mavlink.c \
|
||||
rx/msp_override.c \
|
||||
sensors/acceleration.c \
|
||||
sensors/acceleration_init.c \
|
||||
sensors/boardalignment.c \
|
||||
sensors/compass.c \
|
||||
sensors/gyro.c \
|
||||
sensors/gyro_init.c \
|
||||
sensors/initialisation.c \
|
||||
sensors/sensors.c \
|
||||
blackbox/blackbox.c \
|
||||
blackbox/blackbox_encoding.c \
|
||||
blackbox/blackbox_io.c \
|
||||
cms/cms.c \
|
||||
cms/cms_menu_blackbox.c \
|
||||
cms/cms_menu_failsafe.c \
|
||||
cms/cms_menu_firmware.c \
|
||||
cms/cms_menu_gps_rescue_multirotor.c \
|
||||
cms/cms_menu_gps_rescue_wing.c \
|
||||
cms/cms_menu_gps_lap_timer.c \
|
||||
cms/cms_menu_imu.c \
|
||||
cms/cms_menu_ledstrip.c \
|
||||
cms/cms_menu_main.c \
|
||||
cms/cms_menu_misc.c \
|
||||
cms/cms_menu_osd.c \
|
||||
cms/cms_menu_power.c \
|
||||
cms/cms_menu_saveexit.c \
|
||||
cms/cms_menu_vtx_common.c \
|
||||
cms/cms_menu_vtx_rtc6705.c \
|
||||
cms/cms_menu_vtx_smartaudio.c \
|
||||
cms/cms_menu_vtx_tramp.c \
|
||||
cms/cms_menu_persistent_stats.c \
|
||||
cms/cms_menu_rpm_limit.c \
|
||||
cms/cms_menu_quick.c \
|
||||
drivers/display_ug2864hsweg01.c \
|
||||
drivers/light_ws2811strip.c \
|
||||
drivers/rangefinder/rangefinder_hcsr04.c \
|
||||
drivers/rangefinder/rangefinder_lidartf.c \
|
||||
drivers/rangefinder/rangefinder_lidarmt.c \
|
||||
drivers/rangefinder/rangefinder_nooploop.c \
|
||||
drivers/rangefinder/rangefinder_upt1.c \
|
||||
drivers/vtx_common.c \
|
||||
drivers/vtx_table.c \
|
||||
io/dashboard.c \
|
||||
io/displayport_fb_osd.c \
|
||||
io/displayport_frsky_osd.c \
|
||||
io/displayport_max7456.c \
|
||||
io/displayport_msp.c \
|
||||
io/displayport_oled.c \
|
||||
io/displayport_srxl.c \
|
||||
io/displayport_crsf.c \
|
||||
io/displayport_hott.c \
|
||||
io/frsky_osd.c \
|
||||
io/gimbal_control.c \
|
||||
io/rcdevice_cam.c \
|
||||
io/rcdevice.c \
|
||||
io/gps.c \
|
||||
io/ledstrip.c \
|
||||
io/pidaudio.c \
|
||||
osd/osd.c \
|
||||
osd/osd_custom_text.c \
|
||||
osd/osd_elements.c \
|
||||
osd/osd_warnings.c \
|
||||
sensors/barometer.c \
|
||||
sensors/rangefinder.c \
|
||||
sensors/opticalflow.c \
|
||||
telemetry/telemetry.c \
|
||||
telemetry/crsf.c \
|
||||
telemetry/ghst.c \
|
||||
telemetry/srxl.c \
|
||||
telemetry/frsky_hub.c \
|
||||
telemetry/hott.c \
|
||||
telemetry/jetiexbus.c \
|
||||
telemetry/smartport.c \
|
||||
telemetry/ltm.c \
|
||||
telemetry/mavlink.c \
|
||||
telemetry/mavlink_mission.c \
|
||||
telemetry/msp_shared.c \
|
||||
telemetry/ibus.c \
|
||||
telemetry/ibus_shared.c \
|
||||
sensors/esc_sensor.c \
|
||||
io/vtx.c \
|
||||
io/vtx_rtc6705.c \
|
||||
io/vtx_smartaudio.c \
|
||||
io/vtx_tramp.c \
|
||||
io/vtx_control.c \
|
||||
io/vtx_msp.c \
|
||||
cms/cms_menu_vtx_msp.c
|
||||
|
||||
ifneq ($(SIMULATOR_BUILD),yes)
|
||||
|
||||
COMMON_SRC += \
|
||||
drivers/bus_spi.c \
|
||||
drivers/serial_uart.c \
|
||||
drivers/accgyro/accgyro_mpu6050.c \
|
||||
drivers/accgyro/accgyro_mpu6500.c \
|
||||
drivers/accgyro/accgyro_mpu.c \
|
||||
drivers/accgyro/accgyro_spi_bmi160.c \
|
||||
drivers/accgyro/accgyro_spi_bmi270.c \
|
||||
drivers/accgyro/accgyro_spi_icm20649.c \
|
||||
drivers/accgyro/accgyro_spi_icm20689.c \
|
||||
drivers/accgyro/accgyro_spi_icm426xx.c \
|
||||
drivers/accgyro/accgyro_spi_icm456xx.c \
|
||||
drivers/accgyro/accgyro_spi_icm40609.c \
|
||||
drivers/accgyro/accgyro_spi_l3gd20.c \
|
||||
drivers/accgyro/accgyro_spi_lsm6dso.c \
|
||||
drivers/accgyro/accgyro_spi_lsm6dso_init.c \
|
||||
drivers/accgyro/accgyro_spi_lsm6dsv16x.c \
|
||||
drivers/accgyro/accgyro_spi_mpu6000.c \
|
||||
drivers/accgyro/accgyro_spi_mpu6500.c \
|
||||
drivers/accgyro/accgyro_spi_mpu9250.c \
|
||||
drivers/accgyro/accgyro_virtual.c \
|
||||
BoschSensortec/BMI270-Sensor-API/bmi270_maximum_fifo.c \
|
||||
drivers/barometer/barometer_2smpb_02b.c \
|
||||
drivers/barometer/barometer_bmp085.c \
|
||||
drivers/barometer/barometer_bmp280.c \
|
||||
drivers/barometer/barometer_bmp388.c \
|
||||
drivers/barometer/barometer_bmp5xx.c \
|
||||
drivers/barometer/barometer_dps310.c \
|
||||
drivers/barometer/barometer_lps22df.c \
|
||||
drivers/barometer/barometer_lps.c \
|
||||
drivers/barometer/barometer_ms5611.c \
|
||||
drivers/barometer/barometer_qmp6988.c \
|
||||
drivers/barometer/barometer_virtual.c \
|
||||
drivers/compass/compass_ak8963.c \
|
||||
drivers/compass/compass_ak8975.c \
|
||||
drivers/compass/compass_hmc5883l.c \
|
||||
drivers/compass/compass_ist8310.c \
|
||||
drivers/compass/compass_lis2mdl.c \
|
||||
drivers/compass/compass_lis3mdl.c \
|
||||
drivers/compass/compass_mmc560x.c \
|
||||
drivers/compass/compass_mpu925x_ak8963.c \
|
||||
drivers/compass/compass_qmc5883.c \
|
||||
drivers/compass/compass_virtual.c \
|
||||
drivers/max7456.c \
|
||||
drivers/vtx_rtc6705.c \
|
||||
drivers/vtx_rtc6705_soft_spi.c
|
||||
|
||||
RX_SRC = \
|
||||
drivers/rx/expresslrs_driver.c \
|
||||
drivers/rx/rx_a7105.c \
|
||||
drivers/rx/rx_cc2500.c \
|
||||
drivers/rx/rx_cyrf6936.c \
|
||||
drivers/rx/rx_nrf24l01.c \
|
||||
drivers/rx/rx_pwm.c \
|
||||
drivers/rx/rx_spi.c \
|
||||
drivers/rx/rx_sx127x.c \
|
||||
drivers/rx/rx_sx1280.c \
|
||||
drivers/rx/rx_xn297.c \
|
||||
rx/cc2500_common.c \
|
||||
rx/cc2500_frsky_shared.c \
|
||||
rx/cc2500_frsky_d.c \
|
||||
rx/cc2500_frsky_x.c \
|
||||
rx/cc2500_sfhss.c \
|
||||
rx/cc2500_redpine.c \
|
||||
rx/a7105_flysky.c \
|
||||
rx/cyrf6936_spektrum.c \
|
||||
rx/expresslrs.c \
|
||||
rx/expresslrs_common.c \
|
||||
rx/expresslrs_telemetry.c
|
||||
|
||||
FLASH_SRC += \
|
||||
drivers/flash/flash.c \
|
||||
drivers/flash/flash_m25p16.c \
|
||||
drivers/flash/flash_mt29f.c \
|
||||
drivers/flash/flash_mx66uw1g45g.c \
|
||||
drivers/flash/flash_w25m.c \
|
||||
drivers/flash/flash_w25n.c \
|
||||
drivers/flash/flash_w25q128fv.c \
|
||||
io/flashfs.c
|
||||
|
||||
SDCARD_SRC += \
|
||||
drivers/sdcard.c \
|
||||
drivers/sdcard_spi.c \
|
||||
drivers/sdcard_sdio_baremetal.c \
|
||||
drivers/sdcard_standard.c \
|
||||
io/asyncfatfs/asyncfatfs.c \
|
||||
io/asyncfatfs/fat_standard.c
|
||||
|
||||
INCLUDE_DIRS += $(FATFS_DIR)
|
||||
VPATH := $(VPATH):$(FATFS_DIR)
|
||||
|
||||
# Gyro driver files that only contain initialization and configuration code - not runtime code
|
||||
SIZE_OPTIMISED_SRC += \
|
||||
drivers/accgyro/accgyro_mpu6050.c \
|
||||
drivers/accgyro/accgyro_mpu6500.c \
|
||||
drivers/accgyro/accgyro_spi_mpu6000.c \
|
||||
drivers/accgyro/accgyro_spi_mpu6500.c \
|
||||
drivers/accgyro/accgyro_spi_mpu9250.c \
|
||||
drivers/accgyro/accgyro_spi_icm20689.c \
|
||||
drivers/accgyro/accgyro_spi_icm426xx.c \
|
||||
drivers/accgyro/accgyro_spi_lsm6dso_init.c \
|
||||
drivers/barometer/barometer_bmp085.c \
|
||||
drivers/barometer/barometer_bmp280.c \
|
||||
drivers/barometer/barometer_ms5611.c \
|
||||
drivers/barometer/barometer_lps.c \
|
||||
drivers/barometer/barometer_qmp6988.c \
|
||||
drivers/barometer/barometer_2smpb_02b.c \
|
||||
drivers/compass/compass_ak8963.c \
|
||||
drivers/compass/compass_ak8975.c \
|
||||
drivers/compass/compass_hmc5883l.c \
|
||||
drivers/compass/compass_qmc5883.c \
|
||||
drivers/compass/compass_lis2mdl.c \
|
||||
drivers/compass/compass_lis3mdl.c \
|
||||
drivers/compass/compass_mmc560x.c \
|
||||
drivers/compass/compass_ist8310.c \
|
||||
drivers/display_ug2864hsweg01.c \
|
||||
drivers/vtx_rtc6705_soft_spi.c \
|
||||
drivers/vtx_rtc6705.c
|
||||
|
||||
|
||||
SPEED_OPTIMISED_SRC += \
|
||||
drivers/bus_spi.c \
|
||||
drivers/serial_uart.c \
|
||||
drivers/accgyro/accgyro_mpu.c \
|
||||
drivers/accgyro/accgyro_spi_bmi160.c \
|
||||
drivers/accgyro/accgyro_spi_bmi270.c \
|
||||
drivers/accgyro/accgyro_spi_lsm6dso.c
|
||||
|
||||
endif
|
||||
|
||||
COMMON_DEVICE_SRC = $(CMSIS_SRC) $(DEVICE_STDPERIPH_SRC)
|
||||
|
||||
COMMON_SRC += $(CONFIG_SRC) $(PG_SRC) $(COMMON_DEVICE_SRC) $(RX_SRC)
|
||||
|
||||
ifeq ($(EXST),yes)
|
||||
TARGET_FLAGS += -DUSE_EXST
|
||||
endif
|
||||
|
||||
ifeq ($(RAM_BASED),yes)
|
||||
TARGET_FLAGS += -DUSE_EXST -DCONFIG_IN_RAM -DRAMBASED
|
||||
endif
|
||||
|
||||
ifeq ($(SIMULATOR_BUILD),yes)
|
||||
TARGET_FLAGS += -DSIMULATOR_BUILD
|
||||
endif
|
||||
|
||||
SPEED_OPTIMISED_SRC += \
|
||||
common/encoding.c \
|
||||
common/filter.c \
|
||||
common/maths.c \
|
||||
common/pwl.c \
|
||||
common/sdft.c \
|
||||
common/stopwatch.c \
|
||||
common/typeconversion.c \
|
||||
common/vector.c \
|
||||
drivers/buf_writer.c \
|
||||
drivers/bus.c \
|
||||
drivers/bus_quadspi.c \
|
||||
drivers/io.c \
|
||||
drivers/serial.c \
|
||||
fc/core.c \
|
||||
fc/tasks.c \
|
||||
fc/rc.c \
|
||||
fc/rc_controls.c \
|
||||
fc/runtime_config.c \
|
||||
flight/dyn_notch_filter.c \
|
||||
flight/imu.c \
|
||||
flight/mixer.c \
|
||||
flight/pid.c \
|
||||
flight/rpm_filter.c \
|
||||
rx/ibus.c \
|
||||
rx/rc_stats.c \
|
||||
rx/rx.c \
|
||||
rx/rx_spi.c \
|
||||
rx/crsf.c \
|
||||
rx/frsky_crc.c \
|
||||
rx/sbus.c \
|
||||
rx/sbus_channels.c \
|
||||
rx/spektrum.c \
|
||||
rx/srxl2.c \
|
||||
rx/sumd.c \
|
||||
rx/xbus.c \
|
||||
rx/fport.c \
|
||||
scheduler/scheduler.c \
|
||||
sensors/acceleration.c \
|
||||
sensors/boardalignment.c \
|
||||
sensors/gyro.c \
|
||||
$(CMSIS_SRC) \
|
||||
$(DEVICE_STDPERIPH_SRC) \
|
||||
|
||||
SIZE_OPTIMISED_SRC += \
|
||||
sensors/gyro_init.c \
|
||||
sensors/acceleration_init.c \
|
||||
flight/pid_init.c \
|
||||
flight/mixer_init.c \
|
||||
cli/cli.c \
|
||||
cli/settings.c \
|
||||
drivers/light_ws2811strip.c \
|
||||
drivers/vtx_common.c \
|
||||
fc/init.c \
|
||||
fc/board_info.c \
|
||||
config/config_eeprom.c \
|
||||
config/feature.c \
|
||||
config/config_streamer.c \
|
||||
config/simplified_tuning.c \
|
||||
io/dashboard.c \
|
||||
io/serial.c \
|
||||
io/serial_4way.c \
|
||||
io/serial_4way_avrootloader.c \
|
||||
io/serial_4way_stk500v2.c \
|
||||
io/transponder_ir.c \
|
||||
io/usb_cdc_hid.c \
|
||||
msp/msp_serial.c \
|
||||
cms/cms.c \
|
||||
cms/cms_menu_blackbox.c \
|
||||
cms/cms_menu_failsafe.c \
|
||||
cms/cms_menu_firmware.c \
|
||||
cms/cms_menu_gps_rescue_multirotor.c \
|
||||
cms/cms_menu_gps_rescue_wing.c \
|
||||
cms/cms_menu_gps_lap_timer.c \
|
||||
cms/cms_menu_imu.c \
|
||||
cms/cms_menu_ledstrip.c \
|
||||
cms/cms_menu_main.c \
|
||||
cms/cms_menu_misc.c \
|
||||
cms/cms_menu_osd.c \
|
||||
cms/cms_menu_power.c \
|
||||
cms/cms_menu_saveexit.c \
|
||||
cms/cms_menu_vtx_common.c \
|
||||
cms/cms_menu_vtx_rtc6705.c \
|
||||
cms/cms_menu_vtx_smartaudio.c \
|
||||
cms/cms_menu_vtx_tramp.c \
|
||||
cms/cms_menu_persistent_stats.c \
|
||||
cms/cms_menu_rpm_limit.c \
|
||||
cms/cms_menu_quick.c \
|
||||
io/vtx.c \
|
||||
io/vtx_rtc6705.c \
|
||||
io/vtx_smartaudio.c \
|
||||
io/vtx_tramp.c \
|
||||
io/vtx_control.c \
|
||||
io/spektrum_vtx_control.c \
|
||||
osd/osd.c \
|
||||
osd/osd_custom_text.c \
|
||||
osd/osd_elements.c \
|
||||
osd/osd_warnings.c \
|
||||
rx/rx_bind.c \
|
||||
io/vtx_msp.c \
|
||||
cms/cms_menu_vtx_msp.c
|
||||
|
||||
# check if target.mk supplied
|
||||
SRC := $(STARTUP_SRC) $(MCU_COMMON_SRC) $(TARGET_SRC) $(VARIANT_SRC)
|
||||
|
||||
# Files that should not be optimized, useful for debugging IMPRECISE cpu faults.
|
||||
# Specify FULL PATH, e.g. "./lib/main/STM32F7/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_sdmmc.c"
|
||||
NOT_OPTIMISED_SRC := $(NOT_OPTIMISED_SRC) \
|
||||
|
||||
ifneq ($(DSP_LIB),)
|
||||
|
||||
INCLUDE_DIRS += $(DSP_LIB)/Include
|
||||
SRC += $(wildcard $(DSP_LIB)/Source/*/*.S)
|
||||
|
||||
endif
|
||||
|
||||
SRC += $(FLASH_SRC) $(MSC_SRC) $(SDCARD_SRC) $(COMMON_SRC)
|
||||
|
||||
#excludes
|
||||
SRC := $(filter-out $(MCU_EXCLUDES), $(SRC))
|
||||
SPEED_OPTIMISED_SRC := $(filter-out $(MCU_EXCLUDES), $(SPEED_OPTIMISED_SRC))
|
||||
SIZE_OPTIMISED_SRC := $(filter-out $(MCU_EXCLUDES), $(SIZE_OPTIMISED_SRC))
|
||||
|
||||
SRC += $(VCP_SRC)
|
||||
|
||||
# end target specific make file checks
|
||||
|
||||
# Search path and source files for the Open Location Code library
|
||||
OLC_DIR := google/olc
|
||||
|
||||
ifneq ($(OLC_DIR),)
|
||||
INCLUDE_DIRS += $(LIB_MAIN_DIR)/$(OLC_DIR)
|
||||
SRC += $(OLC_DIR)/olc.c
|
||||
SIZE_OPTIMISED_SRC += $(OLC_DIR)/olc.c
|
||||
endif
|
||||
|
||||
# libcanard (DroneCAN transport) and the Betaflight-side glue live in the
|
||||
# per-MCU makefiles: they're only wired into the build for families whose
|
||||
# platform mk adds a CAN driver (currently STM32G4 / H7 / C5). This keeps
|
||||
# non-CAN targets from having to compile a ~2k-line external library whose
|
||||
# symbols would never link.
|
||||
@@ -0,0 +1,46 @@
|
||||
# shared.mk
|
||||
#
|
||||
# environment variables common to all operating systems supported by the make system
|
||||
|
||||
# Make sure we know a few things about the architecture
|
||||
UNAME := $(shell uname)
|
||||
ARCH := $(shell uname -m)
|
||||
ifneq (,$(filter $(ARCH), x86_64 amd64))
|
||||
X86-64 := 1
|
||||
X86_64 := 1
|
||||
AMD64 := 1
|
||||
ARCHFAMILY := x86_64
|
||||
else
|
||||
ARCHFAMILY := $(ARCH)
|
||||
endif
|
||||
|
||||
# configure some variables dependent upon what type of system this is
|
||||
|
||||
# Linux
|
||||
ifeq ($(UNAME), Linux)
|
||||
OSFAMILY := linux
|
||||
endif
|
||||
|
||||
# Mac OSX
|
||||
ifeq ($(UNAME), Darwin)
|
||||
OSFAMILY := macosx
|
||||
endif
|
||||
|
||||
# Detect all Windows-based POSIX environments (MinGW, MSYS, Cygwin)
|
||||
ifneq (,$(filter MINGW% MSYS% CYGWIN%,$(UNAME)))
|
||||
OSFAMILY := windows
|
||||
|
||||
# Set specific environment flags if needed
|
||||
ifneq (,$(filter CYGWIN%,$(UNAME)))
|
||||
CYGWIN := 1
|
||||
else
|
||||
MINGW := 1
|
||||
endif
|
||||
endif
|
||||
|
||||
# report an error if we couldn't work out what OS this is running on
|
||||
ifndef OSFAMILY
|
||||
$(info uname reports $(UNAME))
|
||||
$(info uname -m reports $(ARCH))
|
||||
$(error failed to detect operating system)
|
||||
endif
|
||||
+414
@@ -0,0 +1,414 @@
|
||||
###############################################################
|
||||
#
|
||||
# Installers for tools
|
||||
#
|
||||
# NOTE: These are not tied to the default goals and must be invoked manually
|
||||
#
|
||||
# ARM SDK Version: 13.3.Rel1
|
||||
#
|
||||
# Release date: July 04, 2024
|
||||
#
|
||||
# PICO SDK Version: 2.X - July 03, 2025
|
||||
#
|
||||
###############################################################
|
||||
|
||||
##############################
|
||||
#
|
||||
# Check that environmental variables are sane
|
||||
#
|
||||
##############################
|
||||
|
||||
# Set up ARM (STM32) SDK
|
||||
# Checked below, Should match the output of $(shell arm-none-eabi-gcc -dumpversion)
|
||||
# must match arm-none-eabi-gcc-<version> file in arm sdk distribution
|
||||
GCC_REQUIRED_VERSION ?= 13.3.1
|
||||
|
||||
## arm_sdk_install : Install Arm SDK
|
||||
.PHONY: arm_sdk_install
|
||||
|
||||
# source: https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
|
||||
ifeq ($(OSFAMILY)-$(ARCHFAMILY), linux-x86_64)
|
||||
ARM_SDK_URL := https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi.tar.xz
|
||||
DL_CHECKSUM = 0601a9588bc5b9c99ad2b56133b7f118
|
||||
else ifeq ($(OSFAMILY)-$(ARCHFAMILY), macosx-x86_64)
|
||||
ARM_SDK_URL := https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-darwin-x86_64-arm-none-eabi.tar.xz
|
||||
DL_CHECKSUM = 4bb141e44b831635fde4e8139d470f1f
|
||||
else ifeq ($(OSFAMILY)-$(ARCHFAMILY), macosx-arm64)
|
||||
ARM_SDK_URL := https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-darwin-arm64-arm-none-eabi.tar.xz
|
||||
DL_CHECKSUM = f1c18320bb3121fa89dca11399273f4e
|
||||
else ifeq ($(OSFAMILY), windows)
|
||||
ARM_SDK_URL := https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi.zip
|
||||
DL_CHECKSUM = 39d9882ca0eb475e81170ae826c1435d
|
||||
else
|
||||
$(error No toolchain URL defined for $(OSFAMILY)-$(ARCHFAMILY))
|
||||
endif
|
||||
|
||||
ARM_SDK_FILE := $(notdir $(ARM_SDK_URL))
|
||||
# remove compression suffixes
|
||||
ARM_SDK_DIR := $(TOOLS_DIR)/$(patsubst %.zip,%, \
|
||||
$(patsubst %.tar.xz,%, \
|
||||
$(notdir $(ARM_SDK_URL))))
|
||||
|
||||
SDK_INSTALL_MARKER := $(ARM_SDK_DIR)/.installed
|
||||
|
||||
.PHONY: arm_sdk_version
|
||||
|
||||
arm_sdk_version: | $(ARM_SDK_DIR)
|
||||
$(V1) $(ARM_SDK_DIR)/bin/arm-none-eabi-gcc --version
|
||||
|
||||
# order-only prereq on directory existance:
|
||||
arm_sdk_install: | $(TOOLS_DIR)
|
||||
arm_sdk_install: arm_sdk_download $(SDK_INSTALL_MARKER)
|
||||
|
||||
$(SDK_INSTALL_MARKER): $(DL_DIR)/$(ARM_SDK_FILE)
|
||||
# verify ckecksum first
|
||||
@checksum=$$(md5sum "$<" | awk '{print $$1}'); \
|
||||
if [ "$$checksum" != "$(DL_CHECKSUM)" ]; then \
|
||||
echo "$@ Checksum mismatch! Expected $(DL_CHECKSUM), got $$checksum."; \
|
||||
exit 1; \
|
||||
fi
|
||||
ifeq ($(OSFAMILY), windows)
|
||||
$(V1) unzip -q -d $(TOOLS_DIR) "$<"
|
||||
else
|
||||
# binary only release so just extract it
|
||||
$(V1) tar -C $(TOOLS_DIR) -xf "$<"
|
||||
endif
|
||||
$(V1) touch $(SDK_INSTALL_MARKER)
|
||||
|
||||
.PHONY: arm_sdk_download
|
||||
arm_sdk_download: | $(DL_DIR)
|
||||
arm_sdk_download: $(DL_DIR)/$(ARM_SDK_FILE)
|
||||
$(DL_DIR)/$(ARM_SDK_FILE):
|
||||
# download the source only if it's newer than what we already have
|
||||
$(V1) curl -L -k -o "$@" $(if $(wildcard $@), -z "$@",) "$(ARM_SDK_URL)"
|
||||
|
||||
## arm_sdk_clean : Uninstall Arm SDK
|
||||
.PHONY: arm_sdk_clean
|
||||
arm_sdk_clean:
|
||||
$(V1) [ ! -d "$(ARM_SDK_DIR)" ] || $(RM) -r $(ARM_SDK_DIR)
|
||||
$(V1) [ ! -d "$(DL_DIR)" ] || $(RM) -r $(DL_DIR)
|
||||
|
||||
.PHONY: openocd_win_install
|
||||
|
||||
openocd_win_install: | $(DL_DIR) $(TOOLS_DIR)
|
||||
openocd_win_install: OPENOCD_URL := git://git.code.sf.net/p/openocd/code
|
||||
openocd_win_install: OPENOCD_REV := cf1418e9a85013bbf8dbcc2d2e9985695993d9f4
|
||||
openocd_win_install: OPENOCD_OPTIONS :=
|
||||
|
||||
ifeq ($(OPENOCD_FTDI), yes)
|
||||
openocd_win_install: OPENOCD_OPTIONS := $(OPENOCD_OPTIONS) --enable-ft2232_ftd2xx --with-ftd2xx-win32-zipdir=$(FTD2XX_DIR)
|
||||
endif
|
||||
|
||||
openocd_win_install: openocd_win_clean libusb_win_install ftd2xx_install
|
||||
# download the source
|
||||
@echo " DOWNLOAD $(OPENOCD_URL) @ $(OPENOCD_REV)"
|
||||
$(V1) [ ! -d "$(OPENOCD_BUILD_DIR)" ] || $(RM) -rf "$(OPENOCD_BUILD_DIR)"
|
||||
$(V1) mkdir -p "$(OPENOCD_BUILD_DIR)"
|
||||
$(V1) git clone --no-checkout $(OPENOCD_URL) "$(DL_DIR)/openocd-build"
|
||||
$(V1) ( \
|
||||
cd $(OPENOCD_BUILD_DIR) ; \
|
||||
git checkout -q $(OPENOCD_REV) ; \
|
||||
)
|
||||
|
||||
# apply patches
|
||||
@echo " PATCH $(OPENOCD_BUILD_DIR)"
|
||||
$(V1) ( \
|
||||
cd $(OPENOCD_BUILD_DIR) ; \
|
||||
git apply < $(ROOT_DIR)/flight/Project/OpenOCD/0003-freertos-cm4f-fpu-support.patch ; \
|
||||
git apply < $(ROOT_DIR)/flight/Project/OpenOCD/0004-st-icdi-disable.patch ; \
|
||||
)
|
||||
|
||||
# build and install
|
||||
@echo " BUILD $(OPENOCD_WIN_DIR)"
|
||||
$(V1) mkdir -p "$(OPENOCD_WIN_DIR)"
|
||||
$(V1) ( \
|
||||
cd $(OPENOCD_BUILD_DIR) ; \
|
||||
./bootstrap ; \
|
||||
./configure --enable-maintainer-mode --prefix="$(OPENOCD_WIN_DIR)" \
|
||||
--build=i686-pc-linux-gnu --host=i586-mingw32msvc \
|
||||
CPPFLAGS=-I$(LIBUSB_WIN_DIR)/include \
|
||||
LDFLAGS=-L$(LIBUSB_WIN_DIR)/lib/gcc \
|
||||
$(OPENOCD_OPTIONS) \
|
||||
--disable-werror \
|
||||
--enable-stlink ; \
|
||||
$(MAKE) ; \
|
||||
$(MAKE) install ; \
|
||||
)
|
||||
|
||||
# delete the extracted source when we're done
|
||||
$(V1) [ ! -d "$(OPENOCD_BUILD_DIR)" ] || $(RM) -rf "$(OPENOCD_BUILD_DIR)"
|
||||
|
||||
.PHONY: openocd_win_clean
|
||||
openocd_win_clean:
|
||||
@echo " CLEAN $(OPENOCD_WIN_DIR)"
|
||||
$(V1) [ ! -d "$(OPENOCD_WIN_DIR)" ] || $(RM) -r "$(OPENOCD_WIN_DIR)"
|
||||
|
||||
# Set up openocd tools
|
||||
OPENOCD_DIR := $(TOOLS_DIR)/openocd
|
||||
OPENOCD_WIN_DIR := $(TOOLS_DIR)/openocd_win
|
||||
OPENOCD_BUILD_DIR := $(DL_DIR)/openocd-build
|
||||
|
||||
.PHONY: openocd_install
|
||||
|
||||
openocd_install: | $(DL_DIR) $(TOOLS_DIR)
|
||||
openocd_install: OPENOCD_URL := git://git.code.sf.net/p/openocd/code
|
||||
openocd_install: OPENOCD_TAG := v0.9.0
|
||||
openocd_install: OPENOCD_OPTIONS := --enable-maintainer-mode --prefix="$(OPENOCD_DIR)" --enable-buspirate --enable-stlink
|
||||
|
||||
ifeq ($(OPENOCD_FTDI), yes)
|
||||
openocd_install: OPENOCD_OPTIONS := $(OPENOCD_OPTIONS) --enable-ftdi
|
||||
endif
|
||||
|
||||
ifeq ($(UNAME), Darwin)
|
||||
openocd_install: OPENOCD_OPTIONS := $(OPENOCD_OPTIONS) --disable-option-checking
|
||||
endif
|
||||
|
||||
openocd_install: openocd_clean
|
||||
# download the source
|
||||
@echo " DOWNLOAD $(OPENOCD_URL) @ $(OPENOCD_TAG)"
|
||||
$(V1) [ ! -d "$(OPENOCD_BUILD_DIR)" ] || $(RM) -rf "$(OPENOCD_BUILD_DIR)"
|
||||
$(V1) mkdir -p "$(OPENOCD_BUILD_DIR)"
|
||||
$(V1) git clone --no-checkout $(OPENOCD_URL) "$(OPENOCD_BUILD_DIR)"
|
||||
$(V1) ( \
|
||||
cd $(OPENOCD_BUILD_DIR) ; \
|
||||
git checkout -q tags/$(OPENOCD_TAG) ; \
|
||||
)
|
||||
|
||||
# build and install
|
||||
@echo " BUILD $(OPENOCD_DIR)"
|
||||
$(V1) mkdir -p "$(OPENOCD_DIR)"
|
||||
$(V1) ( \
|
||||
cd $(OPENOCD_BUILD_DIR) ; \
|
||||
./bootstrap ; \
|
||||
./configure $(OPENOCD_OPTIONS) ; \
|
||||
$(MAKE) ; \
|
||||
$(MAKE) install ; \
|
||||
)
|
||||
|
||||
# delete the extracted source when we're done
|
||||
$(V1) [ ! -d "$(OPENOCD_BUILD_DIR)" ] || $(RM) -rf "$(OPENOCD_BUILD_DIR)"
|
||||
|
||||
.PHONY: openocd_clean
|
||||
openocd_clean:
|
||||
@echo " CLEAN $(OPENOCD_DIR)"
|
||||
$(V1) [ ! -d "$(OPENOCD_DIR)" ] || $(RM) -r "$(OPENOCD_DIR)"
|
||||
|
||||
STM32FLASH_DIR := $(TOOLS_DIR)/stm32flash
|
||||
|
||||
.PHONY: stm32flash_install
|
||||
stm32flash_install: STM32FLASH_URL := http://stm32flash.googlecode.com/svn/trunk
|
||||
stm32flash_install: STM32FLASH_REV := 61
|
||||
stm32flash_install: stm32flash_clean
|
||||
# download the source
|
||||
@echo " DOWNLOAD $(STM32FLASH_URL) @ r$(STM32FLASH_REV)"
|
||||
$(V1) svn export -q -r "$(STM32FLASH_REV)" "$(STM32FLASH_URL)" "$(STM32FLASH_DIR)"
|
||||
|
||||
# build
|
||||
@echo " BUILD $(STM32FLASH_DIR)"
|
||||
$(V1) $(MAKE) --silent -C $(STM32FLASH_DIR) all
|
||||
|
||||
.PHONY: stm32flash_clean
|
||||
stm32flash_clean:
|
||||
@echo " CLEAN $(STM32FLASH_DIR)"
|
||||
$(V1) [ ! -d "$(STM32FLASH_DIR)" ] || $(RM) -r "$(STM32FLASH_DIR)"
|
||||
|
||||
# Set up uncrustify tools
|
||||
UNCRUSTIFY_DIR := $(TOOLS_DIR)/uncrustify-0.61
|
||||
UNCRUSTIFY_BUILD_DIR := $(DL_DIR)/uncrustify
|
||||
|
||||
.PHONY: uncrustify_install
|
||||
uncrustify_install: | $(DL_DIR) $(TOOLS_DIR)
|
||||
uncrustify_install: UNCRUSTIFY_URL := http://downloads.sourceforge.net/project/uncrustify/uncrustify/uncrustify-0.61/uncrustify-0.61.tar.gz
|
||||
uncrustify_install: UNCRUSTIFY_FILE := uncrustify-0.61.tar.gz
|
||||
uncrustify_install: UNCRUSTIFY_OPTIONS := prefix=$(UNCRUSTIFY_DIR)
|
||||
uncrustify_install: uncrustify_clean
|
||||
ifneq ($(OSFAMILY), windows)
|
||||
@echo " DOWNLOAD $(UNCRUSTIFY_URL)"
|
||||
$(V1) curl -L -k -o "$(DL_DIR)/$(UNCRUSTIFY_FILE)" "$(UNCRUSTIFY_URL)"
|
||||
endif
|
||||
# extract the src
|
||||
@echo " EXTRACT $(UNCRUSTIFY_FILE)"
|
||||
$(V1) tar -C $(TOOLS_DIR) -xf "$(DL_DIR)/$(UNCRUSTIFY_FILE)"
|
||||
|
||||
@echo " BUILD $(UNCRUSTIFY_DIR)"
|
||||
$(V1) ( \
|
||||
cd $(UNCRUSTIFY_DIR) ; \
|
||||
./configure --prefix="$(UNCRUSTIFY_DIR)" ; \
|
||||
$(MAKE) ; \
|
||||
$(MAKE) install ; \
|
||||
)
|
||||
# delete the extracted source when we're done
|
||||
$(V1) [ ! -d "$(UNCRUSTIFY_BUILD_DIR)" ] || $(RM) -r "$(UNCRUSTIFY_BUILD_DIR)"
|
||||
|
||||
.PHONY: uncrustify_clean
|
||||
uncrustify_clean:
|
||||
@echo " CLEAN $(UNCRUSTIFY_DIR)"
|
||||
$(V1) [ ! -d "$(UNCRUSTIFY_DIR)" ] || $(RM) -r "$(UNCRUSTIFY_DIR)"
|
||||
@echo " CLEAN $(UNCRUSTIFY_BUILD_DIR)"
|
||||
$(V1) [ ! -d "$(UNCRUSTIFY_BUILD_DIR)" ] || $(RM) -r "$(UNCRUSTIFY_BUILD_DIR)"
|
||||
|
||||
# ZIP download URL
|
||||
zip_install: ZIP_URL := http://pkgs.fedoraproject.org/repo/pkgs/zip/zip30.tar.gz/7b74551e63f8ee6aab6fbc86676c0d37/zip30.tar.gz
|
||||
|
||||
zip_install: ZIP_FILE := $(notdir $(ZIP_URL))
|
||||
|
||||
ZIP_DIR = $(TOOLS_DIR)/zip30
|
||||
|
||||
# order-only prereq on directory existance:
|
||||
zip_install : | $(DL_DIR) $(TOOLS_DIR)
|
||||
zip_install: zip_clean
|
||||
$(V1) curl -L -k -o "$(DL_DIR)/$(ZIP_FILE)" "$(ZIP_URL)"
|
||||
$(V1) tar --force-local -C $(TOOLS_DIR) -xzf "$(DL_DIR)/$(ZIP_FILE)"
|
||||
ifneq ($(OSFAMILY), windows)
|
||||
$(V1) cd "$(ZIP_DIR)" && $(MAKE) -f unix/Makefile generic_gcc
|
||||
else
|
||||
$(V1) cd "$(ZIP_DIR)" && $(MAKE) -f win32/makefile.gcc
|
||||
endif
|
||||
|
||||
.PHONY: zip_clean
|
||||
zip_clean:
|
||||
$(V1) [ ! -d "$(ZIP_DIR)" ] || $(RM) -rf $(ZIP_DIR)
|
||||
|
||||
##############################
|
||||
#
|
||||
# Set up paths to tools
|
||||
#
|
||||
##############################
|
||||
|
||||
ifeq ($(shell [ -d "$(ARM_SDK_DIR)" ] && echo "exists"), exists)
|
||||
ARM_SDK_PREFIX := $(ARM_SDK_DIR)/bin/arm-none-eabi-
|
||||
else ifeq (,$(filter %_sdk %_install test% clean% %-print checks help configs platform-%, $(MAKECMDGOALS)))
|
||||
# Try to find ARM toolchain in PATH (validated later after platform is known)
|
||||
GCC_VERSION = $(shell arm-none-eabi-gcc -dumpversion 2>/dev/null)
|
||||
ifneq ($(GCC_VERSION),)
|
||||
ARM_SDK_PREFIX ?= arm-none-eabi-
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(shell [ -d "$(ZIP_DIR)" ] && echo "exists"), exists)
|
||||
export ZIPBIN := $(ZIP_DIR)/zip
|
||||
else
|
||||
export ZIPBIN := zip
|
||||
endif
|
||||
|
||||
ifeq ($(shell [ -d "$(OPENOCD_DIR)" ] && echo "exists"), exists)
|
||||
OPENOCD := $(OPENOCD_DIR)/bin/openocd
|
||||
else
|
||||
# not installed, hope it's in the path...
|
||||
OPENOCD ?= openocd
|
||||
endif
|
||||
|
||||
ifeq ($(shell [ -d "$(UNCRUSTIFY_DIR)" ] && echo "exists"), exists)
|
||||
UNCRUSTIFY := $(UNCRUSTIFY_DIR)/bin/uncrustify
|
||||
else
|
||||
# not installed, hope it's in the path...
|
||||
UNCRUSTIFY ?= uncrustify
|
||||
endif
|
||||
|
||||
# Google Breakpad
|
||||
DUMP_SYMBOLS_TOOL := $(TOOLS_DIR)/breakpad/$(OSFAMILY)-$(ARCHFAMILY)/dump_syms
|
||||
BREAKPAD_URL := http://dronin.tracer.nz/tools/breakpad.zip
|
||||
BREAKPAD_DL_FILE := $(DL_DIR)/$(notdir $(BREAKPAD_URL))
|
||||
BREAKPAD_DIR := $(TOOLS_DIR)/breakpad
|
||||
|
||||
.PHONY: breakpad_install
|
||||
breakpad_install: | $(DL_DIR) $(TOOLS_DIR)
|
||||
breakpad_install: breakpad_clean
|
||||
@echo " DOWNLOAD $(BREAKPAD_URL)"
|
||||
$(V1) $(V1) curl -L -k -z "$(BREAKPAD_DL_FILE)" -o "$(BREAKPAD_DL_FILE)" "$(BREAKPAD_URL)"
|
||||
@echo " EXTRACT $(notdir $(BREAKPAD_DL_FILE))"
|
||||
$(V1) mkdir -p "$(BREAKPAD_DIR)"
|
||||
$(V1) unzip -q -d $(BREAKPAD_DIR) "$(BREAKPAD_DL_FILE)"
|
||||
ifeq ($(OSFAMILY), windows)
|
||||
$(V1) ln -s "$(TOOLS_DIR)/breakpad/$(OSFAMILY)-i686" "$(TOOLS_DIR)/breakpad/$(OSFAMILY)-x86_64"
|
||||
endif
|
||||
|
||||
.PHONY: breakpad_clean
|
||||
breakpad_clean:
|
||||
@echo " CLEAN $(BREAKPAD_DIR)"
|
||||
$(V1) [ ! -d "$(BREAKPAD_DIR)" ] || $(RM) -rf $(BREAKPAD_DIR)
|
||||
@echo " CLEAN $(BREAKPAD_DL_FILE)"
|
||||
$(V1) $(RM) -f $(BREAKPAD_DL_FILE)
|
||||
|
||||
# Platform-specific tools
|
||||
# Each platform tools.mk appends to PLATFORM_SDKS and defines per-SDK properties:
|
||||
# PLATFORM_SDK_<name>_SUBMODULE - submodule path (e.g. lib/modules/pico-sdk)
|
||||
# PLATFORM_SDK_<name>_HYDRATE - make target to hydrate the SDK
|
||||
# PLATFORM_SDK_<name>_TOOLS - make targets to install required toolchains and tools
|
||||
#
|
||||
# 'none' is the default for targets with no toolchain needs (e.g. SITL).
|
||||
# 'arm' is for ARM-based targets without a platform-specific SDK submodule.
|
||||
# Platform SDKs declare their toolchain in _TOOLS (e.g. arm_sdk_install, esp_tools_install).
|
||||
PLATFORM_SDKS :=
|
||||
PLATFORM_SDK_arm_TOOLS := arm_sdk_install
|
||||
PLATFORM_SDK_arm_CC := $(if $(ARM_SDK_PREFIX),$(ARM_SDK_PREFIX)gcc,arm-none-eabi-gcc)
|
||||
PLATFORM_SDK_arm_CC_VERSION := $(GCC_REQUIRED_VERSION)
|
||||
PLATFORM_SDK_arm_CC_INSTALL := arm_sdk_install
|
||||
|
||||
include $(wildcard $(PLATFORM_DIR)/*/mk/tools.mk)
|
||||
|
||||
## platform-sdk-list-print : list registered SDK names (space-separated)
|
||||
.PHONY: platform-sdk-list-print
|
||||
platform-sdk-list-print:
|
||||
@echo $(sort arm $(PLATFORM_SDKS))
|
||||
|
||||
## platform-sdk-cache-paths-print : print cache paths for SDK specified by SDK= variable
|
||||
.PHONY: platform-sdk-cache-paths-print
|
||||
platform-sdk-cache-paths-print:
|
||||
ifneq ($(PLATFORM_SDK_$(SDK)_SUBMODULE),)
|
||||
@echo "$(PLATFORM_SDK_$(SDK)_SUBMODULE)"
|
||||
@echo ".git/modules/$(PLATFORM_SDK_$(SDK)_SUBMODULE)"
|
||||
else
|
||||
@echo "tools"
|
||||
endif
|
||||
|
||||
## platform-sdk-cache-key-print : print cache key for SDK specified by SDK= variable
|
||||
# The path component is included so relocating a submodule (e.g. lib/main → lib/modules)
|
||||
# busts the cache; otherwise the gitlink SHA is unchanged across a path move and a stale
|
||||
# cache from the old path would be restored over the new one.
|
||||
.PHONY: platform-sdk-cache-key-print
|
||||
platform-sdk-cache-key-print:
|
||||
ifneq ($(PLATFORM_SDK_$(SDK)_SUBMODULE),)
|
||||
@echo $(subst /,-,$(PLATFORM_SDK_$(SDK)_SUBMODULE))-$(shell git rev-parse HEAD:$(PLATFORM_SDK_$(SDK)_SUBMODULE) 2>/dev/null)
|
||||
else
|
||||
@echo "base"
|
||||
endif
|
||||
|
||||
## platform-sdk-hydrate : hydrate SDK specified by SDK= variable, or all SDKs if SDK is unset
|
||||
.PHONY: platform-sdk-hydrate
|
||||
platform-sdk-hydrate:
|
||||
ifneq ($(PLATFORM_SDK_$(SDK)_HYDRATE),)
|
||||
$(V1) $(MAKE) $(PLATFORM_SDK_$(SDK)_HYDRATE)
|
||||
else ifdef SDK
|
||||
@true
|
||||
else
|
||||
$(V1) $(MAKE) $(foreach s,$(PLATFORM_SDKS),$(PLATFORM_SDK_$(s)_HYDRATE))
|
||||
endif
|
||||
|
||||
## platform-tools-install : install tools for SDK specified by SDK= variable, or all if unset
|
||||
.PHONY: platform-tools-install
|
||||
platform-tools-install:
|
||||
ifdef SDK
|
||||
$(V1) $(if $(PLATFORM_SDK_$(SDK)_TOOLS),$(MAKE) $(PLATFORM_SDK_$(SDK)_TOOLS),@true)
|
||||
else
|
||||
$(V1) $(MAKE) $(sort $(PLATFORM_SDK_arm_TOOLS) $(foreach s,$(PLATFORM_SDKS),$(PLATFORM_SDK_$(s)_TOOLS)))
|
||||
endif
|
||||
|
||||
## target-sdk-print : print the SDK name for the current TARGET or CONFIG ('arm' if no platform SDK)
|
||||
.PHONY: target-sdk-print
|
||||
target-sdk-print:
|
||||
@echo $(PLATFORM_SDK)
|
||||
|
||||
## build-sdk-print : print the SDK name for BUILD= (auto-detects TARGET vs CONFIG)
|
||||
.PHONY: build-sdk-print
|
||||
build-sdk-print:
|
||||
ifdef BUILD
|
||||
$(V1) if [ -d "$(PLATFORM_DIR)/*/target/$(BUILD)" ] 2>/dev/null || \
|
||||
ls $(PLATFORM_DIR)/*/target/$(BUILD)/target.mk >/dev/null 2>&1; then \
|
||||
$(MAKE) -s TARGET=$(BUILD) target-sdk-print; \
|
||||
else \
|
||||
$(MAKE) -s CONFIG=$(BUILD) target-sdk-print; \
|
||||
fi
|
||||
else
|
||||
$(error BUILD= variable required)
|
||||
endif
|
||||
@@ -0,0 +1,44 @@
|
||||
# Platform toolchain validation
|
||||
#
|
||||
# Included after the MCU family .mk so PLATFORM_SDK is known.
|
||||
# Each platform SDK registers in its tools.mk:
|
||||
# PLATFORM_SDK_<name>_CC - compiler binary to validate
|
||||
# PLATFORM_SDK_<name>_CC_VERSION - required version (checked via -dumpversion, optional)
|
||||
# PLATFORM_SDK_<name>_CC_INSTALL - make target that installs the toolchain
|
||||
#
|
||||
# Platforms with no _CC (e.g. none/SITL) skip validation.
|
||||
# Utility goals that don't compile also skip validation.
|
||||
|
||||
_SKIP_TOOLCHECK_GOALS := %_sdk %_install test% clean% %-print checks help configs platform-%
|
||||
|
||||
ifneq ($(filter-out $(_SKIP_TOOLCHECK_GOALS), $(MAKECMDGOALS)),)
|
||||
ifdef PLATFORM_SDK
|
||||
|
||||
_SDK_CC := $(PLATFORM_SDK_$(PLATFORM_SDK)_CC)
|
||||
_SDK_CC_VERSION := $(PLATFORM_SDK_$(PLATFORM_SDK)_CC_VERSION)
|
||||
_SDK_CC_INSTALL := $(PLATFORM_SDK_$(PLATFORM_SDK)_CC_INSTALL)
|
||||
|
||||
ifneq ($(_SDK_CC),)
|
||||
# Check compiler is available
|
||||
_FOUND_VERSION := $(shell $(_SDK_CC) -dumpversion 2>/dev/null)
|
||||
ifeq ($(_FOUND_VERSION),)
|
||||
$(error **ERROR** $(_SDK_CC) not found. Run 'make $(_SDK_CC_INSTALL)' to install the toolchain)
|
||||
endif
|
||||
|
||||
# Check version matches if a specific version is required
|
||||
ifneq ($(_SDK_CC_VERSION),)
|
||||
ifneq ($(_FOUND_VERSION),$(_SDK_CC_VERSION))
|
||||
$(error **ERROR** $(_SDK_CC) version '$(_FOUND_VERSION)' found but '$(_SDK_CC_VERSION)' is required. Override with GCC_REQUIRED_VERSION in mk/local.mk or run 'make $(_SDK_CC_INSTALL)' to install the correct version)
|
||||
endif
|
||||
endif
|
||||
|
||||
# ARM toolchain found in PATH — set prefix so the rest of the build uses it
|
||||
ifeq ($(ARM_SDK_PREFIX),)
|
||||
ifneq ($(filter arm_sdk_install,$(PLATFORM_SDK_$(PLATFORM_SDK)_TOOLS)),)
|
||||
ARM_SDK_PREFIX := arm-none-eabi-
|
||||
endif
|
||||
endif
|
||||
|
||||
endif # _SDK_CC
|
||||
endif # PLATFORM_SDK
|
||||
endif # goals filter
|
||||
@@ -0,0 +1,14 @@
|
||||
# windows.mk
|
||||
#
|
||||
# Goals:
|
||||
# Configure an environment that will allow Taulabs GCS and firmware to be built
|
||||
# on a Windows system. The environment will support the current version of the
|
||||
# ARM toolchain installed to either their respective default installation
|
||||
# locations, the tools directory or made available on the system path.
|
||||
#
|
||||
# Requirements:
|
||||
# msysGit
|
||||
# Python
|
||||
|
||||
PYTHON := python
|
||||
export PYTHON
|
||||
Reference in New Issue
Block a user