aboutsummaryrefslogtreecommitdiff
path: root/makefiles/upload.mk
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2013-01-16 21:12:15 -0800
committerpx4dev <px4@purgatory.org>2013-02-23 22:00:59 -0800
commite9f2197bfa40522d6a58e01888dada4531d9dbcf (patch)
tree468ff734245f0605c937932659c94d8fd5eb766c /makefiles/upload.mk
parent06951351054df9799b966b04efd8f5aae6e3a062 (diff)
downloadpx4-firmware-e9f2197bfa40522d6a58e01888dada4531d9dbcf.tar.gz
px4-firmware-e9f2197bfa40522d6a58e01888dada4531d9dbcf.tar.bz2
px4-firmware-e9f2197bfa40522d6a58e01888dada4531d9dbcf.zip
Move upload functionality out into a separate makefile.
Diffstat (limited to 'makefiles/upload.mk')
-rw-r--r--makefiles/upload.mk41
1 files changed, 41 insertions, 0 deletions
diff --git a/makefiles/upload.mk b/makefiles/upload.mk
new file mode 100644
index 000000000..15e0e240a
--- /dev/null
+++ b/makefiles/upload.mk
@@ -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