From de1849167d600d82afd42c599cf54bb816cebf46 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Mon, 27 Sep 2021 14:49:51 +0200 Subject: [PATCH] Mantis: Add upload_wifi target to upload firmware --- Tools/atl/upload.sh | 11 ++++++ boards/atl/mantis-edu/cmake/upload.cmake | 46 ++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100755 Tools/atl/upload.sh create mode 100644 boards/atl/mantis-edu/cmake/upload.cmake diff --git a/Tools/atl/upload.sh b/Tools/atl/upload.sh new file mode 100755 index 0000000000..98e2a0686a --- /dev/null +++ b/Tools/atl/upload.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -e + +PX4_BINARY_FILE="$1" + +echo "uploading: $PX4_BINARY_FILE" + +PX4_BINARY_FILE_SIZE=$(stat -c%s "$PX4_BINARY_FILE") +curl -v -F "image=@$PX4_BINARY_FILE" -H "Expect:" -H "File-Size:$PX4_BINARY_FILE_SIZE" http://192.168.42.1/cgi-bin/upload + diff --git a/boards/atl/mantis-edu/cmake/upload.cmake b/boards/atl/mantis-edu/cmake/upload.cmake new file mode 100644 index 0000000000..ee4ec5693d --- /dev/null +++ b/boards/atl/mantis-edu/cmake/upload.cmake @@ -0,0 +1,46 @@ +############################################################################ +# +# Copyright (c) 2021 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + + +set(PX4_FW_NAME ${PX4_BINARY_DIR}/${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_${PX4_BOARD_LABEL}.px4) + +# The file needs to have that name in order to be updated automatically. +set(UPLOAD_NAME autopilot.px4) + +add_custom_target(upload_wifi + COMMAND ${CMAKE_COMMAND} -E copy ${PX4_FW_NAME} ${UPLOAD_NAME} + COMMAND ${PX4_SOURCE_DIR}/Tools/atl/upload.sh ${UPLOAD_NAME} + DEPENDS ${PX4_FW_NAME} + COMMENT "uploading autopilot.px4 file" + USES_TERMINAL +)