mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-20 02:53:15 +08:00
[conf] separate Makefile.ardrone2
instead of putting ARDrone2 specific upload rules into Makefile.omap
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
# Hey Emacs, this is a -*- makefile -*-
|
||||
#
|
||||
# Copyright (C) 2013 The Paparazzi Team
|
||||
#
|
||||
# This file is part of paparazzi.
|
||||
#
|
||||
# paparazzi is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# paparazzi is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with paparazzi; see the file COPYING. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
#
|
||||
# This Makefile uses the generic Makefile.omap and adds upload rules for the ARDrone2
|
||||
#
|
||||
|
||||
include $(PAPARAZZI_SRC)/conf/Makefile.omap
|
||||
|
||||
DRONE = $(PAPARAZZI_SRC)/sw/ext/ardrone2_drivers/ardrone2.py
|
||||
|
||||
# Allow modules or other raw makefiles to add actions to the upload
|
||||
upload_extra:
|
||||
|
||||
|
||||
# Program the device and start it.
|
||||
load upload program: upload_extra $(OBJDIR)/$(TARGET).elf
|
||||
$(Q)$(DRONE) insmod $(PAPARAZZI_SRC)/sw/ext/ardrone2_drivers/cdc-acm.ko
|
||||
$(Q)$(DRONE) upload_paparazzi $(OBJDIR)/$(TARGET).elf $(SUB_DIR)
|
||||
$(Q)$(DRONE) status
|
||||
|
||||
|
||||
# Program the device and start it.
|
||||
load2 upload2 program2: $(OBJDIR)/$(TARGET).elf
|
||||
|
||||
# Kill the application
|
||||
-echo "killall -9 $(TARGET).elf" | telnet $(HOST)
|
||||
|
||||
# Make the target dir and edit the config
|
||||
-{ \
|
||||
echo "mkdir -p $(TARGET_DIR)"; \
|
||||
echo "if grep -q \"start_paparazzi *= \" /data/config.ini; then sed -i 's/\(start_paparazzi *= *\).*/\\\1$(ARDRONE2_START_PAPARAZZI)/g' /data/config.ini; else echo \"start_paparazzi = $(ARDRONE2_START_PAPARAZZI)\" >> /data/config.ini; fi"; \
|
||||
echo "if grep -q \"wifi_mode *= \" /data/config.ini; then sed -i 's/\(wifi_mode *= *\).*/\\\1$(ARDRONE2_WIFI_MODE)/g' /data/config.ini; else echo \"wifi_mode = $(ARDRONE2_WIFI_MODE)\" >> /data/config.ini; fi"; \
|
||||
echo "if grep -q \"ssid_single_player *= \" /data/config.ini; then sed -i 's/\(ssid_single_player *= *\).*/\\\1$(ARDRONE2_SSID)/g' /data/config.ini; else echo \"ssid_single_player = $(ARDRONE2_SSID)\" >> /data/config.ini; fi"; \
|
||||
echo "if grep -q \"static_ip_address_base *= \" /data/config.ini; then sed -i 's/\(static_ip_address_base *= *\).*/\\\1$(ARDRONE2_IP_ADDRESS_BASE)/g' /data/config.ini; else echo \"static_ip_address_base = $(ARDRONE2_IP_ADDRESS_BASE)\" >> /data/config.ini; fi"; \
|
||||
echo "if grep -q \"static_ip_address_probe *= \" /data/config.ini; then sed -i 's/\(static_ip_address_probe *= *\).*/\\\1$(ARDRONE2_IP_ADDRESS_PROBE)/g' /data/config.ini; else echo \"static_ip_address_probe = $(ARDRONE2_IP_ADDRESS_PROBE)\" >> /data/config.ini; fi"; \
|
||||
} | telnet $(HOST)
|
||||
|
||||
# Upload the drivers and new application
|
||||
{ \
|
||||
echo "binary"; \
|
||||
echo "put $(PAPARAZZI_SRC)/sw/ext/ardrone2_drivers/cdc-acm.ko /$(SUB_DIR)/cdc-acm.ko"; \
|
||||
echo "put $(PAPARAZZI_SRC)/sw/ext/ardrone2_drivers/check_update.sh check_update.sh"; \
|
||||
echo "put $(PAPARAZZI_SRC)/sw/ext/ardrone2_drivers/wifi_setup.sh wifi_setup.sh"; \
|
||||
echo "put $(OBJDIR)/$(TARGET).elf /$(SUB_DIR)/$(TARGET).elf"; \
|
||||
echo "quit"; \
|
||||
} | ftp -n $(HOST)
|
||||
|
||||
# Upload the modules and start the application
|
||||
-{ \
|
||||
echo "mv /data/video/check_update.sh /bin/"; \
|
||||
echo "mv /data/video/wifi_setup.sh /bin/"; \
|
||||
echo "chmod 777 /bin/check_update.sh" \
|
||||
echo "chmod 777 /bin/wifi_setup.sh" \
|
||||
echo "insmod $(TARGET_DIR)/cdc-acm.ko"; \
|
||||
echo "chmod 777 $(TARGET_DIR)/$(TARGET).elf"; \
|
||||
echo "$(TARGET_DIR)/$(TARGET).elf > /dev/null 2>&1 &"; \
|
||||
} | telnet $(HOST)
|
||||
|
||||
ifeq ($(ARDRONE2_REBOOT),1)
|
||||
-{ \
|
||||
echo "reboot"; \
|
||||
} | telnet $(HOST)
|
||||
endif
|
||||
|
||||
# Listing of phony targets.
|
||||
.PHONY : upload_extra load upload program load2 upload2 program2
|
||||
@@ -79,65 +79,6 @@ $(OBJDIR):
|
||||
|
||||
elf: $(OBJDIR)/$(TARGET).elf
|
||||
|
||||
# Allow modules or other raw makefiles to add actions to the upload
|
||||
upload_extra:
|
||||
|
||||
|
||||
DRONE = $(PAPARAZZI_HOME)/sw/ext/ardrone2_drivers/ardrone2.py
|
||||
|
||||
# Program the device and start it.
|
||||
load upload program: upload_extra $(OBJDIR)/$(TARGET).elf
|
||||
$(Q)$(DRONE) insmod $(PAPARAZZI_SRC)/sw/ext/ardrone2_drivers/cdc-acm.ko
|
||||
$(Q)$(DRONE) upload_paparazzi $(OBJDIR)/$(TARGET).elf $(SUB_DIR)
|
||||
$(Q)$(DRONE) status
|
||||
|
||||
|
||||
# Program the device and start it.
|
||||
load2 upload2 program2: $(OBJDIR)/$(TARGET).elf
|
||||
|
||||
# Kill the application
|
||||
-echo "killall -9 $(TARGET).elf" | telnet $(HOST)
|
||||
|
||||
# Make the target dir and edit the config
|
||||
-{ \
|
||||
echo "mkdir -p $(TARGET_DIR)"; \
|
||||
echo "if grep -q \"start_paparazzi *= \" /data/config.ini; then sed -i 's/\(start_paparazzi *= *\).*/\\\1$(ARDRONE2_START_PAPARAZZI)/g' /data/config.ini; else echo \"start_paparazzi = $(ARDRONE2_START_PAPARAZZI)\" >> /data/config.ini; fi"; \
|
||||
echo "if grep -q \"wifi_mode *= \" /data/config.ini; then sed -i 's/\(wifi_mode *= *\).*/\\\1$(ARDRONE2_WIFI_MODE)/g' /data/config.ini; else echo \"wifi_mode = $(ARDRONE2_WIFI_MODE)\" >> /data/config.ini; fi"; \
|
||||
echo "if grep -q \"ssid_single_player *= \" /data/config.ini; then sed -i 's/\(ssid_single_player *= *\).*/\\\1$(ARDRONE2_SSID)/g' /data/config.ini; else echo \"ssid_single_player = $(ARDRONE2_SSID)\" >> /data/config.ini; fi"; \
|
||||
echo "if grep -q \"static_ip_address_base *= \" /data/config.ini; then sed -i 's/\(static_ip_address_base *= *\).*/\\\1$(ARDRONE2_IP_ADDRESS_BASE)/g' /data/config.ini; else echo \"static_ip_address_base = $(ARDRONE2_IP_ADDRESS_BASE)\" >> /data/config.ini; fi"; \
|
||||
echo "if grep -q \"static_ip_address_probe *= \" /data/config.ini; then sed -i 's/\(static_ip_address_probe *= *\).*/\\\1$(ARDRONE2_IP_ADDRESS_PROBE)/g' /data/config.ini; else echo \"static_ip_address_probe = $(ARDRONE2_IP_ADDRESS_PROBE)\" >> /data/config.ini; fi"; \
|
||||
} | telnet $(HOST)
|
||||
|
||||
# Upload the drivers and new application
|
||||
{ \
|
||||
echo "binary"; \
|
||||
echo "put $(PAPARAZZI_SRC)/sw/ext/ardrone2_drivers/cdc-acm.ko /$(SUB_DIR)/cdc-acm.ko"; \
|
||||
echo "put $(PAPARAZZI_SRC)/sw/ext/ardrone2_drivers/check_update.sh check_update.sh"; \
|
||||
echo "put $(PAPARAZZI_SRC)/sw/ext/ardrone2_drivers/wifi_setup.sh wifi_setup.sh"; \
|
||||
echo "put $(OBJDIR)/$(TARGET).elf /$(SUB_DIR)/$(TARGET).elf"; \
|
||||
echo "quit"; \
|
||||
} | ftp -n $(HOST)
|
||||
|
||||
# Upload the modules and start the application
|
||||
-{ \
|
||||
echo "mv /data/video/check_update.sh /bin/"; \
|
||||
echo "mv /data/video/wifi_setup.sh /bin/"; \
|
||||
echo "chmod 777 /bin/check_update.sh" \
|
||||
echo "chmod 777 /bin/wifi_setup.sh" \
|
||||
echo "insmod $(TARGET_DIR)/cdc-acm.ko"; \
|
||||
echo "chmod 777 $(TARGET_DIR)/$(TARGET).elf"; \
|
||||
echo "$(TARGET_DIR)/$(TARGET).elf > /dev/null 2>&1 &"; \
|
||||
} | telnet $(HOST)
|
||||
|
||||
ifeq ($(ARDRONE2_REBOOT),1)
|
||||
-{ \
|
||||
echo "reboot"; \
|
||||
} | telnet $(HOST)
|
||||
endif
|
||||
|
||||
|
||||
|
||||
|
||||
# Link: create ELF output file from object files.
|
||||
.SECONDARY : $(OBJDIR)/$(TARGET).elf
|
||||
.PRECIOUS : $(OBJ_C_OMAP) $(OBJ_CPP_OMAP)
|
||||
|
||||
@@ -12,6 +12,8 @@ BOARD_CFG=\"boards/$(BOARD)$(BOARD_VERSION)_$(BOARD_TYPE).h\"
|
||||
|
||||
ARCH=omap
|
||||
$(TARGET).ARCHDIR = $(ARCH)
|
||||
# include conf/Makefile.ardrone2 (with specific upload rules) instead of only Makefile.omap:
|
||||
ap.MAKEFILE = ardrone2
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
USER=foobar
|
||||
|
||||
@@ -12,6 +12,8 @@ BOARD_CFG=\"boards/$(BOARD)$(BOARD_VERSION)_$(BOARD_TYPE).h\"
|
||||
|
||||
ARCH=omap
|
||||
$(TARGET).ARCHDIR = $(ARCH)
|
||||
# include conf/Makefile.ardrone2 (with specific upload rules) instead of only Makefile.omap:
|
||||
ap.MAKEFILE = ardrone2
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
USER=foobar
|
||||
|
||||
Reference in New Issue
Block a user