cmake consolidate px4 executable builds and upload

This commit is contained in:
Daniel Agar 2018-01-31 18:49:09 -05:00
parent 2ff81393bc
commit 102c0ead53
9 changed files with 120 additions and 480 deletions

View File

@ -1,32 +0,0 @@
#!/bin/bash
# upload script for network-connected devices via scp (eg Raspberry Pi)
if [[ "$#" < 2 ]]; then
echo "usage: scp_upload.sh SRC1 [SRC2 ...] DEST"
exit
fi
if [ -z ${AUTOPILOT_HOST+x} ]; then
host=px4autopilot
echo "\$AUTOPILOT_HOST is not set (use default: $host)"
else
host=$AUTOPILOT_HOST
echo "\$AUTOPILOT_HOST is set to $host"
fi
user=pi
if [ -n "${AUTOPILOT_USER}" ]; then
user=${AUTOPILOT_USER}
fi
# Get last argument
for last; do true; done
# All except last argument
length=$(($#-1))
src_files=${@:1:$length}
echo "Uploading $src_files..."
# Upload files
scp -r $src_files ${user}@${host}:$last

View File

@ -1,182 +0,0 @@
############################################################################
#
# Copyright (c) 2017 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.
#
############################################################################
#=============================================================================
#
# Defined functions in this file
#
# utility functions
#
# * px4_add_upload
# * px4_add_adb_push
# * px4_add_adb_push_to_bebop
# * px4_add_scp_push
# * px4_add_upload_aero
#
#=============================================================================
#
# px4_add_upload
#
# This function generates source code from ROS msg definitions.
#
# Usage:
# px4_add_upload(OUT <target> BUNDLE <file.px4>)
#
# Input:
# BUNDLE : the firmware.px4 file
# OS : the operating system
# BOARD : the board
#
# Output:
# OUT : the firmware target
#
# Example:
# px4_add_upload(OUT upload
# BUNDLE main.px4
# )
#
function(px4_add_upload)
px4_parse_function_args(
NAME px4_add_upload
ONE_VALUE OS BOARD OUT BUNDLE
REQUIRED OS BOARD OUT BUNDLE
ARGN ${ARGN})
set(serial_ports)
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
list(APPEND serial_ports
/dev/serial/by-id/*_PX4_*
/dev/serial/by-id/usb-3D_Robotics*
/dev/serial/by-id/usb-The_Autopilot*
/dev/serial/by-id/usb-Bitcraze*
/dev/serial/by-id/pci-3D_Robotics*
/dev/serial/by-id/pci-Bitcraze*
/dev/serial/by-id/usb-Gumstix*
)
elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
list(APPEND serial_ports
/dev/tty.usbmodemPX*,/dev/tty.usbmodem*
)
elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
foreach(port RANGE 32 0)
list(APPEND serial_ports
"COM${port}")
endforeach()
endif()
px4_join(OUT serial_ports LIST "${serial_ports}" GLUE ",")
add_custom_target(${OUT}
COMMAND ${PYTHON_EXECUTABLE}
${PX4_SOURCE_DIR}/Tools/px_uploader.py --port ${serial_ports} ${BUNDLE}
DEPENDS ${BUNDLE}
WORKING_DIRECTORY ${PX4_BINARY_DIR}
COMMENT "uploading ${BUNDLE}"
VERBATIM
USES_TERMINAL
)
endfunction()
function(px4_add_adb_push)
px4_parse_function_args(
NAME px4_add_upload
ONE_VALUE OS BOARD OUT DEST
MULTI_VALUE FILES DEPENDS
REQUIRED OS BOARD OUT FILES DEPENDS DEST
ARGN ${ARGN})
add_custom_target(${OUT}
COMMAND ${PX4_SOURCE_DIR}/Tools/adb_upload.sh ${FILES} ${DEST}
DEPENDS ${DEPENDS}
WORKING_DIRECTORY ${PX4_BINARY_DIR}
COMMENT "uploading ${BUNDLE}"
VERBATIM
USES_TERMINAL
)
endfunction()
function(px4_add_adb_push_to_bebop)
px4_parse_function_args(
NAME px4_add_upload_to_bebop
ONE_VALUE OS BOARD OUT DEST
MULTI_VALUE FILES DEPENDS
REQUIRED OS BOARD OUT FILES DEPENDS DEST
ARGN ${ARGN})
add_custom_target(${OUT}
COMMAND ${PX4_SOURCE_DIR}/Tools/adb_upload_to_bebop.sh ${FILES} ${DEST}
DEPENDS ${DEPENDS}
WORKING_DIRECTORY ${PX4_BINARY_DIR}
COMMENT "uploading ${BUNDLE}"
VERBATIM
USES_TERMINAL
)
endfunction()
function(px4_add_scp_push)
px4_parse_function_args(
NAME px4_add_upload
ONE_VALUE OS BOARD OUT DEST
MULTI_VALUE FILES DEPENDS
REQUIRED OS BOARD OUT FILES DEPENDS DEST
ARGN ${ARGN})
add_custom_target(${OUT}
COMMAND ${PX4_SOURCE_DIR}/Tools/scp_upload.sh ${FILES} ${DEST}
DEPENDS ${DEPENDS}
WORKING_DIRECTORY ${PX4_BINARY_DIR}
COMMENT "uploading ${BUNDLE}"
VERBATIM
USES_TERMINAL
)
endfunction()
function(px4_add_upload_aero)
px4_parse_function_args(
NAME px4_add_upload_aero
ONE_VALUE OS BOARD OUT BUNDLE
REQUIRED OS BOARD OUT BUNDLE
ARGN ${ARGN})
add_custom_target(${OUT}
COMMAND ${PX4_SOURCE_DIR}/Tools/aero_upload.sh ${BUNDLE}
DEPENDS ${BUNDLE}
WORKING_DIRECTORY ${PX4_BINARY_DIR}
COMMENT "uploading ${BUNDLE}"
VERBATIM
USES_TERMINAL
)
endfunction()

View File

@ -31,7 +31,6 @@
#
############################################################################
include(common/px4_upload)
include(cygwin_cygpath)
add_subdirectory(src)
@ -130,9 +129,43 @@ if (TARGET parameters_xml AND TARGET airframes_xml)
# upload helper
if (${BOARD} STREQUAL "aerofc-v1")
px4_add_upload_aero(OUT upload OS ${OS} BOARD ${BOARD} BUNDLE ${fw_file})
add_custom_target(upload
COMMAND ${PX4_SOURCE_DIR}/Tools/aero_upload.sh ${fw_file}
DEPENDS ${fw_file}
COMMENT "uploading px4"
USES_TERMINAL
)
else()
px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD} BUNDLE ${fw_file})
set(serial_ports)
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
list(APPEND serial_ports
/dev/serial/by-id/*_PX4_*
/dev/serial/by-id/usb-3D_Robotics*
/dev/serial/by-id/usb-The_Autopilot*
/dev/serial/by-id/usb-Bitcraze*
/dev/serial/by-id/pci-3D_Robotics*
/dev/serial/by-id/pci-Bitcraze*
/dev/serial/by-id/usb-Gumstix*
)
elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
list(APPEND serial_ports
/dev/tty.usbmodemPX*,/dev/tty.usbmodem*
)
elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
foreach(port RANGE 32 0)
list(APPEND serial_ports
"COM${port}")
endforeach()
endif()
px4_join(OUT serial_ports LIST "${serial_ports}" GLUE ",")
add_custom_target(upload
COMMAND ${PYTHON_EXECUTABLE}
${PX4_SOURCE_DIR}/Tools/px_uploader.py --port ${serial_ports} ${fw_file}
DEPENDS ${fw_file}
COMMENT "uploading px4"
USES_TERMINAL
)
endif()
endif()

View File

@ -1,4 +1,3 @@
include (common/px4_upload)
add_subdirectory(src)
@ -10,12 +9,7 @@ px4_posix_generate_builtin_commands(
OUT apps
MODULE_LIST ${module_libraries})
# Define build target
set(APP_NAME px4)
set(MAIN_SRC src/main.cpp)
set(UPLOAD_NAME upload)
if ("${BOARD}" STREQUAL "eagle" OR ("${BOARD}" STREQUAL "excelsior"))
if (("${BOARD}" STREQUAL "eagle") OR ("${BOARD}" STREQUAL "excelsior"))
include(fastrpc)
include(linux_app)
@ -23,89 +17,72 @@ if ("${BOARD}" STREQUAL "eagle" OR ("${BOARD}" STREQUAL "excelsior"))
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-prototypes -Wno-missing-declarations")
LINUX_APP(
APP_NAME ${APP_NAME}
APP_NAME px4
IDL_NAME px4muorb
APPS_DEST "/home/linaro"
SOURCES
px4muorb_stub.c
${MAIN_SRC}
src/main.cpp
apps.cpp
LINK_LIBS
-Wl,--start-group
${module_libraries}
${df_driver_libs}
${FASTRPC_ARM_LIBS}
pthread m rt
${module_libraries}
${df_driver_libs}
${FASTRPC_ARM_LIBS}
pthread m rt
-Wl,--end-group
)
px4_add_adb_push(OUT ${UPLOAD_NAME}
OS ${OS}
BOARD ${BOARD}
FILES $<TARGET_FILE:${APP_NAME}>
${PX4_SOURCE_DIR}/posix-configs/eagle/flight/mainapp.config
DEPENDS ${APP_NAME}
DEST /home/linaro)
add_custom_target(upload
COMMAND ${PX4_SOURCE_DIR}/Tools/adb_upload.sh $<TARGET_FILE:px4> ${PX4_SOURCE_DIR}/posix-configs/eagle/flight/mainapp.config /home/linaro
DEPENDS px4
COMMENT "uploading px4"
USES_TERMINAL
)
elseif ("${BOARD}" STREQUAL "rpi")
px4_add_executable(${APP_NAME}
${MAIN_SRC}
else()
px4_add_executable(px4
src/main.cpp
apps.cpp
)
target_link_libraries(${APP_NAME}
-Wl,--start-group
${module_libraries}
df_driver_framework
${df_driver_libs}
pthread m rt
-Wl,--end-group
if (APPLE)
target_link_libraries(px4
${module_libraries}
df_driver_framework
${df_driver_libs}
pthread m
)
else()
target_link_libraries(px4
-Wl,--start-group
${module_libraries}
df_driver_framework
${df_driver_libs}
pthread m rt
-Wl,--end-group
)
endif()
endif()
file(GLOB RPI_CONFIG_FILES ${PX4_SOURCE_DIR}/posix-configs/rpi/*.config)
px4_add_scp_push(OUT ${UPLOAD_NAME}
OS ${OS}
BOARD ${BOARD}
FILES $<TARGET_FILE:${APP_NAME}>
${RPI_CONFIG_FILES}
${PX4_SOURCE_DIR}/ROMFS
DEPENDS ${APP_NAME}
DEST /home/pi)
if ("${BOARD}" STREQUAL "rpi")
add_custom_target(upload
COMMAND scp -r $<TARGET_FILE:px4> ${PX4_SOURCE_DIR}/posix-configs/rpi/*.config ${PX4_SOURCE_DIR}/ROMFS pi@navio:/home/pi
DEPENDS px4
COMMENT "uploading px4"
USES_TERMINAL
)
elseif ("${BOARD}" STREQUAL "bebop")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
px4_add_executable(${APP_NAME}
${MAIN_SRC}
apps.cpp
add_custom_target(upload
COMMAND ${CMAKE_STRIP} -R .comment -R .gnu.version -o $<TARGET_FILE:px4>.stripped $<TARGET_FILE:px4>
COMMAND ${PX4_SOURCE_DIR}/Tools/adb_upload_to_bebop.sh $<TARGET_FILE:px4>.stripped /usr/bin
DEPENDS px4
COMMENT "uploading px4"
USES_TERMINAL
)
if (NOT APPLE)
target_link_libraries(${APP_NAME}
-Wl,--start-group
${module_libraries}
${df_driver_libs}
pthread m rt
-Wl,--end-group
)
else()
target_link_libraries(${APP_NAME}
${module_libraries}
${df_driver_libs}
pthread m
)
endif()
px4_add_adb_push_to_bebop(OUT ${UPLOAD_NAME}
OS ${OS}
BOARD ${BOARD}
FILES $<TARGET_FILE:px4>.stripped
DEPENDS px4
DEST /usr/bin)
elseif ("${BOARD}" STREQUAL "sitl")
include(sitl_target)
@ -113,28 +90,6 @@ elseif ("${BOARD}" STREQUAL "sitl")
include(sitl_tests)
endif()
else()
px4_add_executable(${APP_NAME}
${MAIN_SRC}
apps.cpp
)
if (NOT APPLE)
target_link_libraries(${APP_NAME}
-Wl,--start-group
${module_libraries}
${df_driver_libs}
pthread m rt
-Wl,--end-group
)
else()
target_link_libraries(${APP_NAME}
${module_libraries}
${df_driver_libs}
pthread m
)
endif()
endif()
#=============================================================================
@ -145,8 +100,4 @@ install(TARGETS px4 DESTINATION ${CMAKE_INSTALL_BINDIR})
install(DIRECTORY ${PROJECT_SOURCE_DIR}/ROMFS DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
install(DIRECTORY ${PROJECT_SOURCE_DIR}/posix-configs DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
add_custom_command(OUTPUT ${APP_NAME}.stripped
COMMAND ${STRIP_TOOL} -R .comment -R .gnu.version -o $<TARGET_FILE:px4>.stripped $<TARGET_FILE:px4>
DEPENDS px4
)
add_custom_target(strip DEPENDS "${APP_NAME}.stripped")

View File

@ -169,6 +169,9 @@ function(px4_os_add_flags)
)
# This block sets added_definitions and added_cxx_flags.
set(added_c_flags)
set(added_cxx_flags)
set(added_exe_linker_flags)
set(added_definitions
-D__PX4_POSIX
-Dnoreturn_function=__attribute__\(\(noreturn\)\)
@ -180,8 +183,6 @@ function(px4_os_add_flags)
-D__DF_DARWIN
)
set(added_cxx_flags)
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
message(FATAL_ERROR "PX4 Firmware requires XCode 8 or newer on Mac OS. Version installed on this system: ${CMAKE_CXX_COMPILER_VERSION}")
endif()
@ -204,22 +205,13 @@ function(px4_os_add_flags)
-D__USE_LINUX_IOCTL_DEFS
-U __CUSTOM_FILE_IO__
)
else()
list(APPEND added_definitions
-D__PX4_LINUX
-D__DF_LINUX
)
# Use -pthread For linux/g++.
set(added_cxx_flags
-pthread
)
endif()
set(added_exe_linker_flags)
# This block sets added_c_flags (appends to others).
if ("${BOARD}" STREQUAL "eagle")
@ -230,12 +222,8 @@ function(px4_os_add_flags)
endif()
# Add the toolchain specific flags
set(added_c_flags ${POSIX_CMAKE_C_FLAGS} --sysroot=${HEXAGON_ARM_SYSROOT})
list(APPEND added_cxx_flags
${POSIX_CMAKE_CXX_FLAGS}
--sysroot=${HEXAGON_ARM_SYSROOT}
)
list(APPEND added_c_flags --sysroot=${HEXAGON_ARM_SYSROOT})
list(APPEND added_cxx_flags --sysroot=${HEXAGON_ARM_SYSROOT})
list(APPEND added_exe_linker_flags
-Wl,-rpath-link,${HEXAGON_ARM_SYSROOT}/usr/lib
@ -251,33 +239,24 @@ function(px4_os_add_flags)
set(HEXAGON_ARM_SYSROOT $ENV{HEXAGON_ARM_SYSROOT})
endif()
set(excelsior_flags --sysroot=${HEXAGON_ARM_SYSROOT}/lib32-apq8096 -mfloat-abi=softfp -mfpu=neon -mthumb-interwork)
# Add the toolchain specific flags
set(added_c_flags ${POSIX_CMAKE_C_FLAGS} --sysroot=${HEXAGON_ARM_SYSROOT}/lib32-apq8096 -mfloat-abi=softfp -mfpu=neon -mthumb-interwork)
list(APPEND added_cxx_flags
${POSIX_CMAKE_CXX_FLAGS}
--sysroot=${HEXAGON_ARM_SYSROOT}/lib32-apq8096 -mfloat-abi=softfp -mfpu=neon -mthumb-interwork
)
list(APPEND added_c_flags ${excelsior_flags})
list(APPEND added_cxx_flags ${excelsior_flags})
list(APPEND added_exe_linker_flags
-Wl,-rpath-link,${HEXAGON_ARM_SYSROOT}/lib32-apq8096/usr/lib
-Wl,-rpath-link,${HEXAGON_ARM_SYSROOT}/lib32-apq8096/lib
--sysroot=${HEXAGON_ARM_SYSROOT}/lib32-apq8096 -mfloat-abi=softfp -mfpu=neon -mthumb-interwork
${excelsior_flags}
)
elseif ("${BOARD}" STREQUAL "rpi")
SET(RPI_COMPILE_FLAGS
-mcpu=cortex-a53
-mfpu=neon
-mfloat-abi=hard
)
LIST(APPEND added_c_flags ${RPI_COMPILE_FLAGS})
LIST(APPEND added_cxx_flags ${RPI_COMPILE_FLAGS})
FIND_PROGRAM(CXX_COMPILER_PATH ${CMAKE_CXX_COMPILER})
elseif ("${BOARD}" STREQUAL "rpi")
set(RPI_COMPILE_FLAGS -mcpu=cortex-a53 -mfpu=neon -mfloat-abi=hard)
list(APPEND added_c_flags ${RPI_COMPILE_FLAGS})
list(APPEND added_cxx_flags ${RPI_COMPILE_FLAGS})
find_program(CXX_COMPILER_PATH ${CMAKE_CXX_COMPILER})
GET_FILENAME_COMPONENT(CXX_COMPILER_PATH ${CXX_COMPILER_PATH} DIRECTORY)
GET_FILENAME_COMPONENT(CXX_COMPILER_PATH "${CXX_COMPILER_PATH}/../" ABSOLUTE)
@ -290,8 +269,8 @@ function(px4_os_add_flags)
-I${CXX_COMPILER_PATH}/arm-linux-gnueabihf/libc/usr/include/
)
set(added_c_flags ${POSIX_CMAKE_C_FLAGS} ${CLANG_COMPILE_FLAGS})
list(APPEND added_cxx_flags ${POSIX_CMAKE_CXX_FLAGS} ${CLANG_COMPILE_FLAGS})
list(APPEND added_c_flags ${CLANG_COMPILE_FLAGS})
list(APPEND added_cxx_flags ${CLANG_COMPILE_FLAGS})
list(APPEND added_exe_linker_flags ${POSIX_CMAKE_EXE_LINKER_FLAGS} ${CLANG_COMPILE_FLAGS}
-B${CXX_COMPILER_PATH}/arm-linux-gnueabihf/libc/usr/lib
-L${CXX_COMPILER_PATH}/arm-linux-gnueabihf/libc/usr/lib

View File

@ -1,43 +1,3 @@
function(px4_add_sitl_app)
px4_parse_function_args(NAME px4_add_sitl_app
ONE_VALUE APP_NAME MAIN_SRC UPLOAD_NAME
REQUIRED APP_NAME MAIN_SRC
ARGN ${ARGN}
)
px4_add_executable(${APP_NAME}
${MAIN_SRC}
apps.cpp
)
if (NOT APPLE)
target_link_libraries(${APP_NAME}
-Wl,--start-group
${module_libraries}
${df_driver_libs}
pthread m rt
-Wl,--end-group
)
else()
target_link_libraries(${APP_NAME}
${module_libraries}
${df_driver_libs}
pthread m
)
endif()
endfunction()
#=============================================================================
# sitl run targets
#
set(SITL_RUNNER_MAIN_CPP src/main.cpp)
px4_add_sitl_app(APP_NAME px4
UPLOAD_NAME upload
MAIN_SRC ${SITL_RUNNER_MAIN_CPP}
)
set(SITL_WORKING_DIR ${PX4_BINARY_DIR}/tmp)
file(MAKE_DIRECTORY ${SITL_WORKING_DIR})
@ -106,20 +66,6 @@ foreach(viewer ${viewers})
endif()
endif()
if (debugger STREQUAL "ide" AND viewer STREQUAL "gazebo")
set(SITL_RUNNER_SOURCE_DIR ${PX4_SOURCE_DIR})
set(SITL_RUNNER_MODEL_FILE ${PX4_SOURCE_DIR}/${config_sitl_rcS_dir}/${model})
set(SITL_RUNNER_WORKING_DIRECTORY ${SITL_WORKING_DIR})
configure_file(src/sitl_runner_main.cpp.in sitl_runner_main_${model}.cpp @ONLY)
px4_add_sitl_app(APP_NAME px4_${model}
UPLOAD_NAME upload_${model}
MAIN_SRC ${CMAKE_CURRENT_BINARY_DIR}/sitl_runner_main_${model}.cpp
)
set_target_properties(px4_${model} PROPERTIES EXCLUDE_FROM_ALL TRUE)
endif()
add_custom_target(${_targ_name}
COMMAND ${PX4_SOURCE_DIR}/Tools/sitl_run.sh
$<TARGET_FILE:px4>
@ -136,12 +82,9 @@ foreach(viewer ${viewers})
)
list(APPEND all_posix_vmd_make_targets ${_targ_name})
if (viewer STREQUAL "gazebo")
add_dependencies(${_targ_name} sitl_gazebo)
if (viewer STREQUAL "gazebo")
add_dependencies(${_targ_name} px4_${model})
endif()
add_dependencies(${_targ_name} px4 sitl_gazebo)
elseif(viewer STREQUAL "jmavsim")
add_dependencies(${_targ_name} git_jmavsim)
add_dependencies(${_targ_name} px4 git_jmavsim)
endif()
endforeach()
endforeach()

View File

@ -52,7 +52,7 @@ foreach(test_name ${tests})
tests_${test_name}_generated
${PX4_SOURCE_DIR}
${PX4_BINARY_DIR}
WORKING_DIRECTORY ${SITL_WORKING_DIR})
WORKING_DIRECTORY ${SITL_WORKING_DIR})
set_tests_properties(${test_name} PROPERTIES FAIL_REGULAR_EXPRESSION "${test_name} FAILED")
set_tests_properties(${test_name} PROPERTIES PASS_REGULAR_EXPRESSION "${test_name} PASSED")
@ -79,7 +79,7 @@ foreach(cmd_name ${test_cmds})
cmd_${cmd_name}_generated
${PX4_SOURCE_DIR}
${PX4_BINARY_DIR}
WORKING_DIRECTORY ${SITL_WORKING_DIR})
WORKING_DIRECTORY ${SITL_WORKING_DIR})
set_tests_properties(posix_${cmd_name} PROPERTIES PASS_REGULAR_EXPRESSION "Shutting down")
endforeach()

View File

@ -1,53 +0,0 @@
/****************************************************************************
*
* Copyright (C) 2015 Anton Matosov. 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.
*
****************************************************************************/
/**
* @file sitl_runner_main.cpp
* Basic shell to execute px4 with specific model
*
* @author Anton Matosov <anton.matosov@gmail.com>
*/
#include <unistd.h>
#define __PX4_SITL_MAIN_OVERRIDE
#include "@SITL_RUNNER_MAIN_CPP@"
int main(int argc, const char **argv)
{
if (chdir("@SITL_RUNNER_WORKING_DIRECTORY@") != 0) {
PX4_ERR("Failed to change current directory to @SITL_RUNNER_WORKING_DIRECTORY@. error %i", errno);
return errno;
}
const char *argsOverride[] = {argv[0], "@SITL_RUNNER_SOURCE_DIR@", "@SITL_RUNNER_MODEL_FILE@"};
return SITL_MAIN(sizeof(argsOverride) / sizeof(argsOverride[0]), (char**)argsOverride);
}

View File

@ -1,5 +1,4 @@
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PX4_SOURCE_DIR}/cmake/cmake_hexagon")
include(common/px4_upload)
include(toolchain/Toolchain-qurt)
include(fastrpc)
include(qurt_lib)
@ -26,14 +25,16 @@ if ("${QURT_ENABLE_STUBS}" STREQUAL "1")
${CMAKE_CURRENT_BINARY_DIR}
${FASTRPC_DSP_INCLUDES}
)
add_executable(px4
${PX4_BINARY_DIR}/src/firmware/qurt/px4muorb_skel.c
${PX4_BINARY_DIR}/apps.cpp)
${PX4_BINARY_DIR}/apps.cpp
)
target_link_libraries(px4
-Wl,--start-group
${module_libraries}
${df_driver_libs}
${module_libraries}
${df_driver_libs}
-Wl,--end-group
)
else()
@ -49,14 +50,14 @@ else()
m
)
px4_add_adb_push(OUT upload
OS ${OS}
BOARD ${BOARD}
FILES ${CMAKE_CURRENT_BINARY_DIR}/libpx4.so
${CMAKE_CURRENT_BINARY_DIR}/libpx4muorb_skel.so
${PX4_SOURCE_DIR}/posix-configs/eagle/flight/px4.config
DEPENDS px4 px4muorb_skel
DEST /usr/share/data/adsp)
endif()
add_custom_target(upload
COMMAND
${PX4_SOURCE_DIR}/Tools/adb_upload.sh
${CMAKE_CURRENT_BINARY_DIR}/libpx4.so ${CMAKE_CURRENT_BINARY_DIR}/libpx4muorb_skel.so ${PX4_SOURCE_DIR}/posix-configs/eagle/flight/px4.config
/usr/share/data/adsp
DEPENDS px4 px4muorb_skel
COMMENT "uploading px4"
USES_TERMINAL
)
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
endif()