Merge pull request #1566 from kevindehecker/PX4_USB

Pixhawk flashing via USB

Add flash through usb functionality PX4.
Automatically detects which target is being flashed, and redirects accordingly.

Also update stm32 usb serial and add timeout to try to make it more reliable...
This commit is contained in:
Felix Ruess
2016-03-23 21:20:00 +01:00
14 changed files with 436 additions and 305 deletions
+1 -2
View File
@@ -158,9 +158,8 @@ else ifeq ($(FLASH_MODE),PX4_BOOTLOADER)
# Program the device and start it.
upload: $(OBJDIR)/$(TARGET).bin
$(PAPARAZZI_SRC)/sw/tools/px4/px_mkfw.py --prototype $(PX4_PROTOTYPE) --image $(OBJDIR)/$(TARGET).bin > $(OBJDIR)/$(TARGET).px4
$(PAPARAZZI_SRC)/sw/tools/px4/print_message.py
$(PAPARAZZI_SRC)/sw/tools/px4/set_target.py $(PX4_TARGET) $(OBJDIR)/$(TARGET).px4
$(PAPARAZZI_SRC)/sw/tools/px4/px_uploader.py --port $(PX4_BL_PORT) $(OBJDIR)/$(TARGET).px4
#
# no known flash mode
else
+1 -1
View File
@@ -76,7 +76,7 @@
<target name="test_datalink" board="px4fmu_2.4" />
</firmware>
<modules main_freq="512">
<load name="px4io_flash.xml" />
<load name="px4_flash.xml" />
<load name="geo_mag.xml" />
<load name="air_data.xml" />
<load name="send_imu_mag_current.xml" />
+1 -1
View File
@@ -76,7 +76,7 @@
<target name="test_datalink" board="px4fmu_2.4" />
</firmware>
<modules main_freq="512">
<load name="px4io_flash.xml" />
<load name="px4_flash.xml" />
<load name="geo_mag.xml" />
<load name="air_data.xml" />
<load name="send_imu_mag_current.xml" />
+1
View File
@@ -22,6 +22,7 @@ HARD_FLOAT=yes
# default flash mode is the PX4 bootloader
# possibilities: DFU, SWD, PX4 bootloader
FLASH_MODE ?= PX4_BOOTLOADER
PX4_TARGET = "ap"
PX4_PROTOTYPE ?= "${PAPARAZZI_HOME}/sw/tools/px4/px4fmu-v2.prototype"
PX4_BL_PORT ?= "/dev/serial/by-id/usb-3D_Robotics*,/dev/serial/by-id/pci-3D_Robotics*"
+2 -3
View File
@@ -16,12 +16,11 @@ $(TARGET).LDSCRIPT=$(SRC_ARCH)/px4io_2.4.ld
# default flash mode is via usb dfu bootloader
# possibilities: DFU, SWD, PX4_BOOTLOADER
PX4_BL_PORT ?= "/dev/serial/by-id/usb-FTDI_*"
PX4_BL_PORT ?= "/dev/serial/by-id/usb-Paparazzi_UAV_CDC_Serial_STM32_*"
PX4_PROTOTYPE ?= "${PAPARAZZI_HOME}/sw/tools/px4/px4io-v2.prototype"
PX4_TARGET = "fbw"
FLASH_MODE ?= PX4_BOOTLOADER
#
# default LED configuration
#
+32
View File
@@ -0,0 +1,32 @@
<!DOCTYPE module SYSTEM "module.dtd">
<module name="px4_flash">
<doc>
<description>Enables to flashes the px4 FBW and AP through the original px4 bootloader.</description>
</doc>
<header>
<file name="px4_flash.h"/>
</header>
<init fun="px4flash_init()"/>
<event fun="px4flash_event()"/>
<makefile target="ap">
<raw>
</raw>
<file name="px4_flash.c"/>
<file name="usb_ser_hw.c" dir="arch/stm32"/>
<configure name="PX4IO_UART" default="uart6" case="upper|lower"/>
<configure name="PX4IO_BAUD" default="B1500000"/>
<define name="USE_$(PX4IO_UART_UPPER)"/>
<define name="PX4IO_UART" value="$(PX4IO_UART_LOWER)"/>
<define name="$(PX4IO_UART_UPPER)_BAUD" value="$(PX4IO_BAUD)"/>
<configure name="FLASH_UART" default="usb_serial" case="upper|lower"/>
<configure name="FLASH_BAUD" default="B115200"/>
<define name="USE_$(FLASH_UART_UPPER)"/>
<define name="FLASH_UART" value="$(FLASH_UART_LOWER)"/>
<define name="$(FLASH_UART_UPPER)_BAUD" value="$(FLASH_BAUD)"/>
</makefile>
</module>
-31
View File
@@ -1,31 +0,0 @@
<!DOCTYPE module SYSTEM "module.dtd">
<module name="px4io_flash">
<doc>
<description>Flashes the px4io f1 through the px4 bootloader.</description>
</doc>
<header>
<file name="px4io_flash.h"/>
</header>
<init fun="px4ioflash_init()"/>
<event fun="px4ioflash_event()"/>
<makefile target="ap">
<raw>
</raw>
<file name="px4io_flash.c"/>
<configure name="PX4IO_UART" default="uart6" case="upper|lower"/>
<configure name="PX4IO_BAUD" default="B1500000"/>
<define name="USE_$(PX4IO_UART_UPPER)"/>
<define name="PX4IO_UART" value="$(PX4IO_UART_LOWER)"/>
<define name="$(PX4IO_UART_UPPER)_BAUD" value="$(PX4IO_BAUD)"/>
<configure name="TELEM2_UART" default="uart3" case="upper|lower"/>
<configure name="TELEM2_BAUD" default="B115200"/>
<define name="USE_$(TELEM2_UART_UPPER)"/>
<define name="TELEM2_UART" value="$(TELEM2_UART_LOWER)"/>
<define name="$(TELEM2_UART_UPPER)_BAUD" value="$(TELEM2_BAUD)"/>
</makefile>
</module>