mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-02 03:49:12 +08:00
Make 'make upload' work
This commit is contained in:
@@ -63,11 +63,26 @@ MQUIET = --no-print-directory
|
|||||||
#
|
#
|
||||||
# If the user has listed a config as a target, strip it out and override CONFIGS.
|
# If the user has listed a config as a target, strip it out and override CONFIGS.
|
||||||
#
|
#
|
||||||
|
FIRMWARE_GOAL = firmware
|
||||||
EXPLICIT_CONFIGS := $(filter $(CONFIGS),$(MAKECMDGOALS))
|
EXPLICIT_CONFIGS := $(filter $(CONFIGS),$(MAKECMDGOALS))
|
||||||
ifneq ($(EXPLICIT_CONFIGS),)
|
ifneq ($(EXPLICIT_CONFIGS),)
|
||||||
CONFIGS := $(EXPLICIT_CONFIGS)
|
CONFIGS := $(EXPLICIT_CONFIGS)
|
||||||
.PHONY: $(EXPLICIT_CONFIGS)
|
.PHONY: $(EXPLICIT_CONFIGS)
|
||||||
$(EXPLICIT_CONFIGS): all
|
$(EXPLICIT_CONFIGS): all
|
||||||
|
|
||||||
|
#
|
||||||
|
# If the user has asked to upload, they must have also specified exactly one
|
||||||
|
# config.
|
||||||
|
#
|
||||||
|
ifneq ($(filter upload,$(MAKECMDGOALS)),)
|
||||||
|
ifneq ($(words $(EXPLICIT_CONFIGS)),1)
|
||||||
|
$(error In order to upload, exactly one board config must be specified)
|
||||||
|
endif
|
||||||
|
FIRMWARE_GOAL = upload
|
||||||
|
.PHONY: upload
|
||||||
|
upload:
|
||||||
|
@:
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -100,7 +115,7 @@ $(FIRMWARES): $(BUILD_DIR)%.build/firmware.px4:
|
|||||||
-f $(PX4_MK_DIR)firmware.mk \
|
-f $(PX4_MK_DIR)firmware.mk \
|
||||||
CONFIG=$(config) \
|
CONFIG=$(config) \
|
||||||
WORK_DIR=$(work_dir) \
|
WORK_DIR=$(work_dir) \
|
||||||
firmware
|
$(FIRMWARE_GOAL)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Build the NuttX export archives.
|
# Build the NuttX export archives.
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ class uploader(object):
|
|||||||
|
|
||||||
def __init__(self, portname, baudrate):
|
def __init__(self, portname, baudrate):
|
||||||
# open the port, keep the default timeout short so we can poll quickly
|
# open the port, keep the default timeout short so we can poll quickly
|
||||||
self.port = serial.Serial(portname, baudrate, timeout=0.25)
|
self.port = serial.Serial(portname, baudrate, timeout=0.5)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
if self.port is not None:
|
if self.port is not None:
|
||||||
|
|||||||
@@ -424,7 +424,8 @@ $(PRODUCT_ELF): $(OBJS) $(MODULE_OBJS) $(GLOBAL_DEPS) $(LINK_DEPS) $(MODULE_MKF
|
|||||||
upload: $(PRODUCT_BUNDLE) $(PRODUCT_BIN)
|
upload: $(PRODUCT_BUNDLE) $(PRODUCT_BIN)
|
||||||
$(Q) $(MAKE) -f $(PX4_MK_DIR)/upload.mk \
|
$(Q) $(MAKE) -f $(PX4_MK_DIR)/upload.mk \
|
||||||
METHOD=serial \
|
METHOD=serial \
|
||||||
PRODUCT=$(PRODUCT) \
|
CONFIG=$(CONFIG) \
|
||||||
|
BOARD=$(BOARD) \
|
||||||
BUNDLE=$(PRODUCT_BUNDLE) \
|
BUNDLE=$(PRODUCT_BUNDLE) \
|
||||||
BIN=$(PRODUCT_BIN)
|
BIN=$(PRODUCT_BIN)
|
||||||
|
|
||||||
@@ -435,6 +436,7 @@ clean: $(MODULE_CLEANS)
|
|||||||
$(Q) $(REMOVE) $(OBJS) $(DEP_INCLUDES) $(EXTRA_CLEANS)
|
$(Q) $(REMOVE) $(OBJS) $(DEP_INCLUDES) $(EXTRA_CLEANS)
|
||||||
$(Q) $(RMDIR) $(NUTTX_EXPORT_DIR)
|
$(Q) $(RMDIR) $(NUTTX_EXPORT_DIR)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# DEP_INCLUDES is defined by the toolchain include in terms of $(OBJS)
|
# DEP_INCLUDES is defined by the toolchain include in terms of $(OBJS)
|
||||||
#
|
#
|
||||||
|
|||||||
+2
-1
@@ -102,7 +102,7 @@
|
|||||||
ifeq ($(MODULE_MK),)
|
ifeq ($(MODULE_MK),)
|
||||||
$(error No module makefile specified)
|
$(error No module makefile specified)
|
||||||
endif
|
endif
|
||||||
$(info % MODULE_MK = $(MODULE_MK))
|
$(info %% MODULE_MK = $(MODULE_MK))
|
||||||
|
|
||||||
#
|
#
|
||||||
# Get the board/toolchain config
|
# Get the board/toolchain config
|
||||||
@@ -147,6 +147,7 @@ $(MODULE_COMMAND_FILES): exclude = $(dir $@)COMMAND.$(command).*
|
|||||||
$(MODULE_COMMAND_FILES): $(GLOBAL_DEPS)
|
$(MODULE_COMMAND_FILES): $(GLOBAL_DEPS)
|
||||||
@$(REMOVE) -f $(exclude)
|
@$(REMOVE) -f $(exclude)
|
||||||
@$(MKDIR) -p $(dir $@)
|
@$(MKDIR) -p $(dir $@)
|
||||||
|
@echo "CMD: $(command)"
|
||||||
$(Q) $(TOUCH) $@
|
$(Q) $(TOUCH) $@
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
+6
-3
@@ -21,11 +21,14 @@ 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"
|
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
|
endif
|
||||||
|
|
||||||
.PHONY: all upload-$(METHOD)-$(PRODUCT)
|
.PHONY: all upload-$(METHOD)-$(BOARD)
|
||||||
all: upload-$(METHOD)-$(PRODUCT)
|
all: upload-$(METHOD)-$(BOARD)
|
||||||
|
|
||||||
upload-serial-px4fmu: $(BUNDLE) $(UPLOADER)
|
upload-serial-px4fmu: $(BUNDLE) $(UPLOADER)
|
||||||
@python -u $(UPLOADER) --port $(SERIAL_PORTS) $(PRODUCT_BUNDLE)
|
@python -u $(UPLOADER) --port $(SERIAL_PORTS) $(BUNDLE)
|
||||||
|
|
||||||
|
upload-serial-px4fmuv2: $(BUNDLE) $(UPLOADER)
|
||||||
|
@python -u $(UPLOADER) --port $(SERIAL_PORTS) $(BUNDLE)
|
||||||
|
|
||||||
#
|
#
|
||||||
# JTAG firmware uploading with OpenOCD
|
# JTAG firmware uploading with OpenOCD
|
||||||
|
|||||||
Reference in New Issue
Block a user