Browse Source

Revert "Implement the way to run posix simulator directly from IDE without the need to reconfigure command lines, but use runner created via CMake"

This reverts commit fff4934743.
sbg
Lorenz Meier 8 years ago
parent
commit
1926c7bca7
  1. 9
      Tools/sitl_run.sh
  2. 219
      src/firmware/posix/CMakeLists.txt
  3. 6
      src/platforms/posix/main.cpp
  4. 53
      src/platforms/posix/sitl_runner_main.cpp.in

9
Tools/sitl_run.sh

@ -135,15 +135,6 @@ then @@ -135,15 +135,6 @@ then
elif [ "$debugger" == "valgrind" ]
then
valgrind $sitl_command
elif [ "$debugger" == "ide" ]
then
echo "######################################################################"
echo
echo "PX4 simulator not started, use your IDE to start PX4_${model} target."
echo "Hit enter to quit..."
echo
echo "######################################################################"
read
else
$sitl_command
fi

219
src/firmware/posix/CMakeLists.txt

@ -4,137 +4,122 @@ px4_posix_generate_builtin_commands( @@ -4,137 +4,122 @@ px4_posix_generate_builtin_commands(
OUT apps
MODULE_LIST ${module_libraries})
if ("${BOARD}" STREQUAL "eagle" OR ("${BOARD}" STREQUAL "excelsior"))
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})
if ("${BOARD}" STREQUAL "eagle" OR ("${BOARD}" STREQUAL "excelsior"))
include(fastrpc)
include(linux_app)
FASTRPC_STUB_GEN(../qurt/px4muorb.idl)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-prototypes -Wno-missing-declarations")
LINUX_APP(
APP_NAME ${APP_NAME}
IDL_NAME px4muorb
APPS_DEST "/home/linaro"
SOURCES
px4muorb_stub.c
${MAIN_SRC}
apps.cpp
LINK_LIBS
-Wl,--start-group
${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 ${CMAKE_CURRENT_BINARY_DIR}/${APP_NAME}
${PX4_SOURCE_DIR}/posix-configs/eagle/flight/mainapp.config
DEPENDS ${APP_NAME}
DEST /home/linaro)
include(fastrpc)
include(linux_app)
elseif ("${BOARD}" STREQUAL "rpi")
FASTRPC_STUB_GEN(../qurt/px4muorb.idl)
px4_add_executable(${APP_NAME}
${MAIN_SRC}
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-prototypes -Wno-missing-declarations")
LINUX_APP(
APP_NAME px4
IDL_NAME px4muorb
APPS_DEST "/home/linaro"
SOURCES
px4muorb_stub.c
${PX4_SOURCE_DIR}/src/platforms/posix/main.cpp
apps.cpp
)
target_link_libraries(${APP_NAME}
LINK_LIBS
-Wl,--start-group
${module_libraries}
df_driver_framework
${df_driver_libs}
${FASTRPC_ARM_LIBS}
pthread m rt
-Wl,--end-group
)
)
file(GLOB RPI_CONFIG_FILES ${PX4_SOURCE_DIR}/posix-configs/rpi/*.config)
px4_add_scp_push(OUT ${UPLOAD_NAME}
OS ${OS}
BOARD ${BOARD}
FILES ${CMAKE_CURRENT_BINARY_DIR}/${APP_NAME}
${RPI_CONFIG_FILES}
${PX4_SOURCE_DIR}/ROMFS
DEPENDS ${APP_NAME}
DEST /home/pi)
px4_add_adb_push(OUT upload
OS ${OS}
BOARD ${BOARD}
FILES ${CMAKE_CURRENT_BINARY_DIR}/px4
${PX4_SOURCE_DIR}/posix-configs/eagle/flight/mainapp.config
DEPENDS px4
DEST /home/linaro)
elseif ("${BOARD}" STREQUAL "bebop")
elseif ("${BOARD}" STREQUAL "rpi")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
px4_add_executable(px4
${PX4_SOURCE_DIR}/src/platforms/posix/main.cpp
apps.cpp
)
px4_add_executable(${APP_NAME}
${MAIN_SRC}
apps.cpp
)
target_link_libraries(px4
-Wl,--start-group
${module_libraries}
df_driver_framework
${df_driver_libs}
pthread m rt
-Wl,--end-group
)
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()
file(GLOB RPI_CONFIG_FILES ${PX4_SOURCE_DIR}/posix-configs/rpi/*.config)
px4_add_scp_push(OUT upload
OS ${OS}
BOARD ${BOARD}
FILES ${CMAKE_CURRENT_BINARY_DIR}/px4
${RPI_CONFIG_FILES}
${PX4_SOURCE_DIR}/ROMFS
DEPENDS px4
DEST /home/pi)
px4_add_adb_push_to_bebop(OUT ${UPLOAD_NAME}
OS ${OS}
BOARD ${BOARD}
FILES ${CMAKE_CURRENT_BINARY_DIR}/${APP_NAME}
DEPENDS ${APP_NAME}
DEST /usr/bin)
elseif ("${BOARD}" STREQUAL "bebop")
else()
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
)
px4_add_executable(px4
${PX4_SOURCE_DIR}/src/platforms/posix/main.cpp
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()
if (NOT APPLE)
target_link_libraries(px4
-Wl,--start-group
${module_libraries}
${df_driver_libs}
pthread m rt
-Wl,--end-group
)
else()
target_link_libraries(px4
${module_libraries}
${df_driver_libs}
pthread m
)
endif()
endfunction()
SET(SITL_RUNNER_MAIN_CPP ${PX4_SOURCE_DIR}/src/platforms/posix/main.cpp)
px4_add_sitl_app(APP_NAME px4
UPLOAD_NAME upload
MAIN_SRC ${SITL_RUNNER_MAIN_CPP}
px4_add_adb_push_to_bebop(OUT upload
OS ${OS}
BOARD ${BOARD}
FILES ${CMAKE_CURRENT_BINARY_DIR}/px4
DEPENDS px4
DEST /usr/bin)
else()
px4_add_executable(px4
${PX4_SOURCE_DIR}/src/platforms/posix/main.cpp
apps.cpp
)
if (NOT APPLE)
target_link_libraries(px4
-Wl,--start-group
${module_libraries}
${df_driver_libs}
pthread m rt
-Wl,--end-group
)
else()
target_link_libraries(px4
${module_libraries}
${df_driver_libs}
pthread m
)
endif()
endif()
#=============================================================================
# sitl run targets
#
@ -167,7 +152,7 @@ set_target_properties(sitl_gazebo PROPERTIES EXCLUDE_FROM_ALL TRUE) @@ -167,7 +152,7 @@ set_target_properties(sitl_gazebo PROPERTIES EXCLUDE_FROM_ALL TRUE)
# create targets for each viewer/model/debugger combination
set(viewers none jmavsim gazebo replay)
set(debuggers none ide gdb lldb ddd valgrind)
set(debuggers none gdb lldb ddd valgrind)
set(models none iris iris_opt_flow tailsitter standard_vtol plane solo typhoon_h480)
set(all_posix_vmd_make_targets)
foreach(viewer ${viewers})
@ -186,20 +171,6 @@ foreach(viewer ${viewers}) @@ -186,20 +171,6 @@ foreach(viewer ${viewers})
set(_targ_name "${viewer}_${model}_${debugger}")
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(${PX4_SOURCE_DIR}/src/platforms/posix/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
)
endif()
add_custom_target(${_targ_name}
COMMAND ${PX4_SOURCE_DIR}/Tools/sitl_run.sh
$<TARGET_FILE:px4>

6
src/platforms/posix/main.cpp

@ -286,13 +286,7 @@ static void set_cpu_scaling() @@ -286,13 +286,7 @@ static void set_cpu_scaling()
#endif
}
#ifdef __PX4_SITL_MAIN_OVERRIDE
int SITL_MAIN(int argc, char **argv);
int SITL_MAIN(int argc, char **argv)
#else
int main(int argc, char **argv)
#endif
{
bool daemon_mode = false;
bool chroot_on = false;

53
src/platforms/posix/sitl_runner_main.cpp.in

@ -1,53 +0,0 @@ @@ -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);
}
Loading…
Cancel
Save