mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 20:33:35 +08:00
Move upload functionality out into a separate makefile.
This commit is contained in:
@@ -85,20 +85,6 @@ $(FIRMWARES): $(BUILD_DIR)/%.build/firmware.px4:
|
|||||||
PLATFORM=$(call PLATFORM_FROM_CONFIG,$(config)) \
|
PLATFORM=$(call PLATFORM_FROM_CONFIG,$(config)) \
|
||||||
WORK_DIR=$(work_dir)
|
WORK_DIR=$(work_dir)
|
||||||
|
|
||||||
#
|
|
||||||
# Generate the config build directory.
|
|
||||||
#
|
|
||||||
#BUILDAREAS = $(foreach config,$(CONFIGS),$(BUILD_DIR)/$(config).build)
|
|
||||||
#.PHONY: buildareas
|
|
||||||
#buildareas: $(BUILDAREAS)
|
|
||||||
#
|
|
||||||
#$(BUILD_DIR)/%.build: config = $(notdir $(basename $@))
|
|
||||||
#$(BUILD_DIR)/%.build: platform = $(call PLATFORM_FROM_CONFIG,$(config))
|
|
||||||
#$(BUILDAREAS): $(BUILD_DIR)/%.build:
|
|
||||||
# @echo %% Setting up build environment for $(config)
|
|
||||||
# $(Q) mkdir -p $@
|
|
||||||
# $(Q) (cd $@ && $(RMDIR) nuttx-export && unzip -q $(ARCHIVE_DIR)/$(platform).export)
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Build the NuttX export archives.
|
# Build the NuttX export archives.
|
||||||
#
|
#
|
||||||
@@ -130,53 +116,6 @@ $(NUTTX_ARCHIVES): $(ARCHIVE_DIR)/%.export: $(NUTTX_SRC) $(NUTTX_APPS)
|
|||||||
$(Q) mkdir -p $(dir $@)
|
$(Q) mkdir -p $(dir $@)
|
||||||
$(Q) $(COPY) $(NUTTX_SRC)/nuttx-export.zip $@
|
$(Q) $(COPY) $(NUTTX_SRC)/nuttx-export.zip $@
|
||||||
|
|
||||||
setup_px4io:
|
|
||||||
|
|
||||||
#
|
|
||||||
# Firmware upload.
|
|
||||||
#
|
|
||||||
|
|
||||||
# serial port defaults by operating system.
|
|
||||||
SYSTYPE = $(shell uname)
|
|
||||||
ifeq ($(SYSTYPE),Darwin)
|
|
||||||
SERIAL_PORTS ?= "/dev/tty.usbmodemPX1,/dev/tty.usbmodemPX2,/dev/tty.usbmodemPX3,/dev/tty.usbmodemPX4,/dev/tty.usbmodem1,/dev/tty.usbmodem2,/dev/tty.usbmodem3,/dev/tty.usbmodem4"
|
|
||||||
endif
|
|
||||||
ifeq ($(SYSTYPE),Linux)
|
|
||||||
SERIAL_PORTS ?= "/dev/ttyACM5,/dev/ttyACM4,/dev/ttyACM3,/dev/ttyACM2,/dev/ttyACM1,/dev/ttyACM0"
|
|
||||||
endif
|
|
||||||
ifeq ($(SERIAL_PORTS),)
|
|
||||||
SERIAL_PORTS = "\\\\.\\COM32,\\\\.\\COM31,\\\\.\\COM30,\\\\.\\COM29,\\\\.\\COM28,\\\\.\\COM27,\\\\.\\COM26,\\\\.\\COM25,\\\\.\\COM24,\\\\.\\COM23,\\\\.\\COM22,\\\\.\\COM21,\\\\.\\COM20,\\\\.\\COM19,\\\\.\\COM18,\\\\.\\COM17,\\\\.\\COM16,\\\\.\\COM15,\\\\.\\COM14,\\\\.\\COM13,\\\\.\\COM12,\\\\.\\COM11,\\\\.\\COM10,\\\\.\\COM9,\\\\.\\COM8,\\\\.\\COM7,\\\\.\\COM6,\\\\.\\COM5,\\\\.\\COM4,\\\\.\\COM3,\\\\.\\COM2,\\\\.\\COM1,\\\\.\\COM0"
|
|
||||||
endif
|
|
||||||
|
|
||||||
upload: $(FIRMWARE_BUNDLE) $(UPLOADER)
|
|
||||||
@python -u $(UPLOADER) --port $(SERIAL_PORTS) $(FIRMWARE_BUNDLE)
|
|
||||||
|
|
||||||
#
|
|
||||||
# JTAG firmware uploading with OpenOCD
|
|
||||||
#
|
|
||||||
ifeq ($(JTAGCONFIG),)
|
|
||||||
JTAGCONFIG=interface/olimex-jtag-tiny.cfg
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: upload-jtag-px4fmu
|
|
||||||
upload-jtag-px4fmu: all
|
|
||||||
@echo Attempting to flash PX4FMU board via JTAG
|
|
||||||
@openocd -f $(JTAGCONFIG) -f ../Bootloader/stm32f4x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx/nuttx" -c "flash write_image erase ../Bootloader/px4fmu_bl.elf" -c "reset run" -c shutdown
|
|
||||||
|
|
||||||
.PHONY: upload-jtag-px4io
|
|
||||||
upload-jtag-px4io: all
|
|
||||||
@echo Attempting to flash PX4IO board via JTAG
|
|
||||||
@openocd -f $(JTAGCONFIG) -f ../Bootloader/stm32f1x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx/nuttx" -c "flash write_image erase ../Bootloader/px4io_bl.elf" -c "reset run" -c shutdown
|
|
||||||
|
|
||||||
#
|
|
||||||
# Hacks and fixups
|
|
||||||
#
|
|
||||||
|
|
||||||
ifeq ($(SYSTYPE),Darwin)
|
|
||||||
# PATH inherited by Eclipse may not include toolchain install location
|
|
||||||
export PATH := $(PATH):/usr/local/bin
|
|
||||||
endif
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Cleanup targets. 'clean' should remove all built products and force
|
# Cleanup targets. 'clean' should remove all built products and force
|
||||||
# a complete re-compilation, 'distclean' should remove everything
|
# a complete re-compilation, 'distclean' should remove everything
|
||||||
|
|||||||
+6
-18
@@ -68,7 +68,6 @@ export ARCHIVE_DIR = $(PX4_BASE)/Archives
|
|||||||
# XXX should be in a common toolchain config somewhere.
|
# XXX should be in a common toolchain config somewhere.
|
||||||
#
|
#
|
||||||
MKFW = $(PX4_BASE)/Tools/px_mkfw.py
|
MKFW = $(PX4_BASE)/Tools/px_mkfw.py
|
||||||
UPLOADER = $(PX4_BASE)/Tools/px_uploader.py
|
|
||||||
COPY = cp
|
COPY = cp
|
||||||
REMOVE = rm -f
|
REMOVE = rm -f
|
||||||
RMDIR = rm -rf
|
RMDIR = rm -rf
|
||||||
@@ -98,21 +97,6 @@ ifeq ($(SYSTYPE),Darwin)
|
|||||||
export PATH := $(PATH):/usr/local/bin
|
export PATH := $(PATH):/usr/local/bin
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#
|
|
||||||
# Serial port defaults.
|
|
||||||
#
|
|
||||||
# XXX The uploader should be smarter than this.
|
|
||||||
#
|
|
||||||
ifeq ($(SYSTYPE),Darwin)
|
|
||||||
SERIAL_PORTS ?= "/dev/tty.usbmodemPX1,/dev/tty.usbmodemPX2,/dev/tty.usbmodemPX3,/dev/tty.usbmodemPX4,/dev/tty.usbmodem1,/dev/tty.usbmodem2,/dev/tty.usbmodem3,/dev/tty.usbmodem4"
|
|
||||||
endif
|
|
||||||
ifeq ($(SYSTYPE),Linux)
|
|
||||||
SERIAL_PORTS ?= "/dev/ttyACM5,/dev/ttyACM4,/dev/ttyACM3,/dev/ttyACM2,/dev/ttyACM1,/dev/ttyACM0"
|
|
||||||
endif
|
|
||||||
ifeq ($(SERIAL_PORTS),)
|
|
||||||
SERIAL_PORTS = "\\\\.\\COM32,\\\\.\\COM31,\\\\.\\COM30,\\\\.\\COM29,\\\\.\\COM28,\\\\.\\COM27,\\\\.\\COM26,\\\\.\\COM25,\\\\.\\COM24,\\\\.\\COM23,\\\\.\\COM22,\\\\.\\COM21,\\\\.\\COM20,\\\\.\\COM19,\\\\.\\COM18,\\\\.\\COM17,\\\\.\\COM16,\\\\.\\COM15,\\\\.\\COM14,\\\\.\\COM13,\\\\.\\COM12,\\\\.\\COM11,\\\\.\\COM10,\\\\.\\COM9,\\\\.\\COM8,\\\\.\\COM7,\\\\.\\COM6,\\\\.\\COM5,\\\\.\\COM4,\\\\.\\COM3,\\\\.\\COM2,\\\\.\\COM1,\\\\.\\COM0"
|
|
||||||
endif
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# NuttX libraries and paths
|
# NuttX libraries and paths
|
||||||
################################################################################
|
################################################################################
|
||||||
@@ -203,8 +187,12 @@ $(PRODUCT_BIN): $(PRODUCT_SYM)
|
|||||||
$(PRODUCT_SYM): $(OBJS) $(GLOBAL_DEPS) $(LINK_DEPS)
|
$(PRODUCT_SYM): $(OBJS) $(GLOBAL_DEPS) $(LINK_DEPS)
|
||||||
$(call LINK,$@,$(OBJS))
|
$(call LINK,$@,$(OBJS))
|
||||||
|
|
||||||
upload: $(PRODUCT_BUNDLE) $(UPLOADER)
|
upload: $(PRODUCT_BUNDLE) $(PRODUCT_BIN)
|
||||||
@python -u $(UPLOADER) --port $(SERIAL_PORTS) $(PRODUCT_BUNDLE)
|
$(Q) make -f $(PX4_MK_INCLUDE)/upload.mk \
|
||||||
|
METHOD=serial \
|
||||||
|
PRODUCT=$(PRODUCT) \
|
||||||
|
BUNDLE=$(PRODUCT_BUNDLE) \
|
||||||
|
BIN=$(PRODUCT_BIN)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo %% cleaning
|
@echo %% cleaning
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
#
|
||||||
|
# Rules and tools for uploading firmware.
|
||||||
|
#
|
||||||
|
|
||||||
|
UPLOADER = $(PX4_BASE)/Tools/px_uploader.py
|
||||||
|
|
||||||
|
SYSTYPE := $(shell uname -s)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Serial port defaults.
|
||||||
|
#
|
||||||
|
# XXX The uploader should be smarter than this.
|
||||||
|
#
|
||||||
|
ifeq ($(SYSTYPE),Darwin)
|
||||||
|
SERIAL_PORTS ?= "/dev/tty.usbmodemPX1,/dev/tty.usbmodemPX2,/dev/tty.usbmodemPX3,/dev/tty.usbmodemPX4,/dev/tty.usbmodem1,/dev/tty.usbmodem2,/dev/tty.usbmodem3,/dev/tty.usbmodem4"
|
||||||
|
endif
|
||||||
|
ifeq ($(SYSTYPE),Linux)
|
||||||
|
SERIAL_PORTS ?= "/dev/ttyACM5,/dev/ttyACM4,/dev/ttyACM3,/dev/ttyACM2,/dev/ttyACM1,/dev/ttyACM0"
|
||||||
|
endif
|
||||||
|
ifeq ($(SERIAL_PORTS),)
|
||||||
|
SERIAL_PORTS = "\\\\.\\COM32,\\\\.\\COM31,\\\\.\\COM30,\\\\.\\COM29,\\\\.\\COM28,\\\\.\\COM27,\\\\.\\COM26,\\\\.\\COM25,\\\\.\\COM24,\\\\.\\COM23,\\\\.\\COM22,\\\\.\\COM21,\\\\.\\COM20,\\\\.\\COM19,\\\\.\\COM18,\\\\.\\COM17,\\\\.\\COM16,\\\\.\\COM15,\\\\.\\COM14,\\\\.\\COM13,\\\\.\\COM12,\\\\.\\COM11,\\\\.\\COM10,\\\\.\\COM9,\\\\.\\COM8,\\\\.\\COM7,\\\\.\\COM6,\\\\.\\COM5,\\\\.\\COM4,\\\\.\\COM3,\\\\.\\COM2,\\\\.\\COM1,\\\\.\\COM0"
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: all upload-$(METHOD)-$(PRODUCT)
|
||||||
|
all: upload-$(METHOD)-$(PRODUCT)
|
||||||
|
|
||||||
|
upload-serial-px4fmu: $(BUNDLE) $(UPLOADER)
|
||||||
|
@python -u $(UPLOADER) --port $(SERIAL_PORTS) $(PRODUCT_BUNDLE)
|
||||||
|
|
||||||
|
#
|
||||||
|
# JTAG firmware uploading with OpenOCD
|
||||||
|
#
|
||||||
|
JTAGCONFIG ?= interface/olimex-jtag-tiny.cfg
|
||||||
|
|
||||||
|
upload-jtag-px4fmu: all
|
||||||
|
@echo Attempting to flash PX4FMU board via JTAG
|
||||||
|
@openocd -f $(JTAGCONFIG) -f ../Bootloader/stm32f4x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx/nuttx" -c "flash write_image erase ../Bootloader/px4fmu_bl.elf" -c "reset run" -c shutdown
|
||||||
|
|
||||||
|
upload-jtag-px4io: all
|
||||||
|
@echo Attempting to flash PX4IO board via JTAG
|
||||||
|
@openocd -f $(JTAGCONFIG) -f ../Bootloader/stm32f1x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx/nuttx" -c "flash write_image erase ../Bootloader/px4io_bl.elf" -c "reset run" -c shutdown
|
||||||
Reference in New Issue
Block a user