mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 16:23:34 +08:00
move src/firmware/ to platforms
This commit is contained in:
@@ -1,140 +0,0 @@
|
||||
include(common/px4_upload)
|
||||
|
||||
if (NOT FW_NAME)
|
||||
set(FW_NAME ${CONFIG}.elf)
|
||||
endif()
|
||||
|
||||
add_executable(${FW_NAME} ${PX4_SOURCE_DIR}/src/platforms/empty.c)
|
||||
add_dependencies(${FW_NAME} git_nuttx nuttx_build)
|
||||
|
||||
get_property(module_libraries GLOBAL PROPERTY PX4_LIBRARIES)
|
||||
|
||||
# build NuttX
|
||||
add_subdirectory(${PX4_SOURCE_DIR}/platforms/nuttx/NuttX ${PX4_BINARY_DIR}/NuttX)
|
||||
|
||||
set(nuttx_libs)
|
||||
list(APPEND nuttx_libs
|
||||
nuttx_apps
|
||||
nuttx_arch
|
||||
nuttx_binfmt
|
||||
nuttx_binfmt
|
||||
nuttx_c
|
||||
nuttx_configs
|
||||
nuttx_cxx
|
||||
nuttx_drivers
|
||||
nuttx_fs
|
||||
nuttx_mm
|
||||
nuttx_sched
|
||||
)
|
||||
|
||||
if (CONFIG_NET)
|
||||
list(APPEND nuttx_libs nuttx_net)
|
||||
endif()
|
||||
|
||||
if (NOT LD_SCRIPT)
|
||||
set(LD_SCRIPT ld.script)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${FW_NAME}
|
||||
-T${PX4_BINARY_DIR}/NuttX/nuttx/configs/${BOARD}/scripts/${LD_SCRIPT}
|
||||
-Wl,-Map=${PX4_BINARY_DIR}/${CONFIG}.map
|
||||
-Wl,--warn-common
|
||||
-Wl,--gc-sections
|
||||
-Wl,--start-group
|
||||
${module_libraries}
|
||||
${nuttx_libs}
|
||||
-Wl,--end-group
|
||||
m
|
||||
gcc
|
||||
)
|
||||
|
||||
if (config_romfs_root)
|
||||
add_subdirectory(${PX4_SOURCE_DIR}/ROMFS ${PX4_BINARY_DIR}/ROMFS)
|
||||
target_link_libraries(${FW_NAME} romfs)
|
||||
if (config_io_board)
|
||||
add_dependencies(romfs copy_px4io_bin)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# create px4 file (combined firmware and metadata)
|
||||
set(fw_file ${PX4_BINARY_DIR}/${FW_NAME})
|
||||
string(REPLACE ".elf" ".px4" fw_file ${fw_file})
|
||||
string(REPLACE "nuttx_" "" fw_file ${fw_file})
|
||||
|
||||
add_custom_command(OUTPUT ${BOARD}.bin
|
||||
COMMAND ${OBJCOPY} -O binary ${PX4_BINARY_DIR}/${FW_NAME} ${BOARD}.bin
|
||||
DEPENDS ${FW_NAME}
|
||||
)
|
||||
|
||||
if (NOT FW_PROTOTYPE)
|
||||
set(FW_PROTOTYPE ${BOARD})
|
||||
endif()
|
||||
|
||||
if (TARGET parameters_xml AND TARGET airframes_xml)
|
||||
add_custom_command(OUTPUT ${fw_file}
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/px_mkfw.py
|
||||
--prototype ${PX4_SOURCE_DIR}/Images/${FW_PROTOTYPE}.prototype
|
||||
--git_identity ${PX4_SOURCE_DIR}
|
||||
--parameter_xml ${PX4_BINARY_DIR}/parameters.xml
|
||||
--airframe_xml ${PX4_BINARY_DIR}/airframes.xml
|
||||
--image ${BOARD}.bin > ${fw_file}
|
||||
DEPENDS ${BOARD}.bin parameters_xml airframes_xml
|
||||
COMMENT "Creating ${fw_file}"
|
||||
)
|
||||
|
||||
add_custom_target(px4 ALL DEPENDS ${fw_file})
|
||||
|
||||
# upload helper
|
||||
if (${BOARD} STREQUAL "aerofc-v1")
|
||||
px4_add_upload_aero(OUT upload OS ${OS} BOARD ${BOARD} BUNDLE ${fw_file})
|
||||
else()
|
||||
px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD} BUNDLE ${fw_file})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# print size
|
||||
add_custom_target(size
|
||||
COMMAND size ${FW_NAME}
|
||||
DEPENDS ${FW_NAME}
|
||||
WORKING_DIRECTORY ${PX4_BINARY_DIR}
|
||||
)
|
||||
|
||||
# print weak symbols
|
||||
add_custom_target(check_weak
|
||||
COMMAND ${NM} ${FW_NAME} | ${GREP} " w " | cat
|
||||
DEPENDS ${FW_NAME}
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
# debugger helpers
|
||||
configure_file(gdbinit.in .gdbinit)
|
||||
|
||||
add_custom_target(debug
|
||||
COMMAND ${GDB} $<TARGET_FILE:${FW_NAME}>
|
||||
DEPENDS ${FW_NAME} ${CMAKE_CURRENT_BINARY_DIR}/.gdbinit
|
||||
)
|
||||
|
||||
add_custom_target(debug_tui
|
||||
COMMAND ${GDBTUI} $<TARGET_FILE:${FW_NAME}>
|
||||
DEPENDS ${FW_NAME} ${CMAKE_CURRENT_BINARY_DIR}/.gdbinit
|
||||
)
|
||||
|
||||
add_custom_target(debug_ddd
|
||||
COMMAND ${DDD} --debugger ${GDB} $<TARGET_FILE:${FW_NAME}>
|
||||
DEPENDS ${FW_NAME} ${CMAKE_CURRENT_BINARY_DIR}/.gdbinit
|
||||
)
|
||||
|
||||
add_custom_target(debug_io
|
||||
COMMAND ${GDB} ${fw_io_path}
|
||||
DEPENDS ${FW_NAME} ${CMAKE_CURRENT_BINARY_DIR}/.gdbinit
|
||||
)
|
||||
|
||||
add_custom_target(debug_io_tui
|
||||
COMMAND ${GDBTUI} ${fw_io_path}
|
||||
DEPENDS ${FW_NAME} ${CMAKE_CURRENT_BINARY_DIR}/.gdbinit
|
||||
)
|
||||
|
||||
add_custom_target(debug_io_ddd
|
||||
COMMAND ${DDD} --debugger ${GDB} ${fw_io_path}}
|
||||
DEPENDS ${fw_io} ${CMAKE_CURRENT_BINARY_DIR}/.gdbinit
|
||||
)
|
||||
@@ -1,7 +0,0 @@
|
||||
target extended ${DEBUG_PORT}
|
||||
monitor swdp_scan
|
||||
attach 1
|
||||
monitor vector_catch disable hard
|
||||
set mem inaccessible-by-default off
|
||||
set print pretty
|
||||
source ${PX4_SOURCE_DIR}/Debug/PX4
|
||||
@@ -1,150 +0,0 @@
|
||||
include (common/px4_upload)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
get_property(module_libraries GLOBAL PROPERTY PX4_LIBRARIES)
|
||||
|
||||
px4_posix_generate_builtin_commands(
|
||||
OUT apps
|
||||
MODULE_LIST ${module_libraries})
|
||||
|
||||
# Define build target
|
||||
set(APP_NAME px4)
|
||||
set(MAIN_SRC ${PX4_SOURCE_DIR}/src/platforms/posix/main.cpp)
|
||||
set(UPLOAD_NAME upload)
|
||||
|
||||
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 $<TARGET_FILE:${APP_NAME}>
|
||||
${PX4_SOURCE_DIR}/posix-configs/eagle/flight/mainapp.config
|
||||
DEPENDS ${APP_NAME}
|
||||
DEST /home/linaro)
|
||||
|
||||
elseif ("${BOARD}" STREQUAL "rpi")
|
||||
|
||||
px4_add_executable(${APP_NAME}
|
||||
${MAIN_SRC}
|
||||
apps.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(${APP_NAME}
|
||||
-Wl,--start-group
|
||||
${module_libraries}
|
||||
df_driver_framework
|
||||
${df_driver_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 $<TARGET_FILE:${APP_NAME}>
|
||||
${RPI_CONFIG_FILES}
|
||||
${PX4_SOURCE_DIR}/ROMFS
|
||||
DEPENDS ${APP_NAME}
|
||||
DEST /home/pi)
|
||||
|
||||
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
|
||||
)
|
||||
|
||||
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.cmake)
|
||||
if(BUILD_TESTING)
|
||||
include(./sitl_tests.cmake)
|
||||
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()
|
||||
|
||||
#=============================================================================
|
||||
# install
|
||||
#
|
||||
|
||||
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")
|
||||
@@ -1,155 +0,0 @@
|
||||
|
||||
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 ${PX4_SOURCE_DIR}/src/platforms/posix/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})
|
||||
|
||||
# add a symlink to the logs dir to make it easier to find them
|
||||
add_custom_command(OUTPUT ${PX4_BINARY_DIR}/logs
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${SITL_WORKING_DIR}/rootfs/fs/microsd/log logs
|
||||
WORKING_DIRECTORY ${PX4_BINARY_DIR})
|
||||
add_custom_target(logs_symlink DEPENDS ${PX4_BINARY_DIR}/logs)
|
||||
|
||||
add_custom_target(run_config
|
||||
COMMAND Tools/sitl_run.sh
|
||||
$<TARGET_FILE:px4>
|
||||
${config_sitl_rcS_dir}
|
||||
${config_sitl_debugger}
|
||||
${config_sitl_viewer}
|
||||
${config_sitl_model}
|
||||
${PX4_SOURCE_DIR}
|
||||
${PX4_BINARY_DIR}
|
||||
WORKING_DIRECTORY ${SITL_WORKING_DIR}
|
||||
USES_TERMINAL
|
||||
DEPENDS px4 logs_symlink
|
||||
)
|
||||
|
||||
px4_add_git_submodule(TARGET git_gazebo PATH "${PX4_SOURCE_DIR}/Tools/sitl_gazebo")
|
||||
px4_add_git_submodule(TARGET git_jmavsim PATH "${PX4_SOURCE_DIR}/Tools/jMAVSim")
|
||||
|
||||
# Add support for external project building
|
||||
include(ExternalProject)
|
||||
|
||||
# project to build sitl_gazebo if necessary
|
||||
ExternalProject_Add(sitl_gazebo
|
||||
SOURCE_DIR ${PX4_SOURCE_DIR}/Tools/sitl_gazebo
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
|
||||
BINARY_DIR ${PX4_BINARY_DIR}/build_gazebo
|
||||
INSTALL_COMMAND ""
|
||||
DEPENDS
|
||||
git_gazebo
|
||||
)
|
||||
set_target_properties(sitl_gazebo PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||
|
||||
ExternalProject_Add_Step(sitl_gazebo forceconfigure
|
||||
DEPENDEES update
|
||||
DEPENDERS configure
|
||||
ALWAYS 1
|
||||
)
|
||||
|
||||
# create targets for each viewer/model/debugger combination
|
||||
set(viewers none jmavsim gazebo replay)
|
||||
set(debuggers none ide gdb lldb ddd valgrind callgrind)
|
||||
set(models none iris iris_opt_flow iris_rplidar standard_vtol plane solo tailsitter typhoon_h480 rover hippocampus)
|
||||
set(all_posix_vmd_make_targets)
|
||||
foreach(viewer ${viewers})
|
||||
foreach(debugger ${debuggers})
|
||||
foreach(model ${models})
|
||||
if (debugger STREQUAL "none")
|
||||
if (model STREQUAL "none")
|
||||
set(_targ_name "${viewer}")
|
||||
else()
|
||||
set(_targ_name "${viewer}_${model}")
|
||||
endif()
|
||||
else()
|
||||
if (model STREQUAL "none")
|
||||
set(_targ_name "${viewer}___${debugger}")
|
||||
else()
|
||||
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
|
||||
)
|
||||
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>
|
||||
${config_sitl_rcS_dir}
|
||||
${debugger}
|
||||
${viewer}
|
||||
${model}
|
||||
${PX4_SOURCE_DIR}
|
||||
${PX4_BINARY_DIR}
|
||||
WORKING_DIRECTORY ${SITL_WORKING_DIR}
|
||||
USES_TERMINAL
|
||||
DEPENDS
|
||||
logs_symlink
|
||||
)
|
||||
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()
|
||||
elseif(viewer STREQUAL "jmavsim")
|
||||
add_dependencies(${_targ_name} git_jmavsim)
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
px4_join(OUT posix_vmd_make_target_list LIST ${all_posix_vmd_make_targets} GLUE "\\n")
|
||||
add_custom_target(list_vmd_make_targets
|
||||
COMMAND sh -c "printf \"${posix_vmd_make_target_list}\\n\""
|
||||
COMMENT "List of acceptable '${CONFIG}' <viewer_model_debugger> targets:"
|
||||
VERBATIM
|
||||
)
|
||||
@@ -1,111 +0,0 @@
|
||||
#=============================================================================
|
||||
# tests
|
||||
#
|
||||
|
||||
# TODO: find a way to keep this in sync with tests_main
|
||||
set(tests
|
||||
autodeclination
|
||||
bson
|
||||
commander
|
||||
controllib
|
||||
conv
|
||||
dataman
|
||||
file2
|
||||
float
|
||||
gpio
|
||||
hrt
|
||||
hysteresis
|
||||
int
|
||||
mathlib
|
||||
matrix
|
||||
mavlink
|
||||
mc_pos_control
|
||||
mixer
|
||||
param
|
||||
parameters
|
||||
perf
|
||||
rc
|
||||
servo
|
||||
sf0x
|
||||
sleep
|
||||
uorb
|
||||
versioning
|
||||
)
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
list(REMOVE_ITEM tests
|
||||
hysteresis
|
||||
mixer
|
||||
uorb
|
||||
)
|
||||
endif()
|
||||
|
||||
foreach(test_name ${tests})
|
||||
configure_file(${PX4_SOURCE_DIR}/posix-configs/SITL/init/test/tests_template.in ${PX4_SOURCE_DIR}/posix-configs/SITL/init/test/tests_${test_name}_generated)
|
||||
|
||||
add_test(NAME ${test_name}
|
||||
COMMAND ${PX4_SOURCE_DIR}/Tools/sitl_run.sh
|
||||
$<TARGET_FILE:px4>
|
||||
posix-configs/SITL/init/test
|
||||
none
|
||||
none
|
||||
tests_${test_name}_generated
|
||||
${PX4_SOURCE_DIR}
|
||||
${PX4_BINARY_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")
|
||||
endforeach()
|
||||
|
||||
# run arbitrary commands
|
||||
set(test_cmds
|
||||
hello
|
||||
hrt_test
|
||||
muorb_test
|
||||
vcdev_test
|
||||
wqueue_test
|
||||
)
|
||||
|
||||
foreach(cmd_name ${test_cmds})
|
||||
configure_file(${PX4_SOURCE_DIR}/posix-configs/SITL/init/test/cmd_template.in ${PX4_SOURCE_DIR}/posix-configs/SITL/init/test/cmd_${cmd_name}_generated)
|
||||
|
||||
add_test(NAME posix_${cmd_name}
|
||||
COMMAND ${PX4_SOURCE_DIR}/Tools/sitl_run.sh
|
||||
$<TARGET_FILE:px4>
|
||||
posix-configs/SITL/init/test
|
||||
none
|
||||
none
|
||||
cmd_${cmd_name}_generated
|
||||
${PX4_SOURCE_DIR}
|
||||
${PX4_BINARY_DIR}
|
||||
WORKING_DIRECTORY ${SITL_WORKING_DIR})
|
||||
|
||||
set_tests_properties(posix_${cmd_name} PROPERTIES PASS_REGULAR_EXPRESSION "Shutting down")
|
||||
endforeach()
|
||||
|
||||
|
||||
add_custom_target(test_results
|
||||
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -T Test
|
||||
DEPENDS px4
|
||||
USES_TERMINAL
|
||||
COMMENT "Running tests in sitl"
|
||||
WORKING_DIRECTORY ${PX4_BINARY_DIR})
|
||||
set_target_properties(test_results PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL Coverage)
|
||||
setup_target_for_coverage(test_coverage "${CMAKE_CTEST_COMMAND} --output-on-failure -T Test" coverage.info)
|
||||
endif()
|
||||
|
||||
add_custom_target(test_results_junit
|
||||
COMMAND xsltproc ${PX4_SOURCE_DIR}/Tools/CTest2JUnit.xsl Testing/`head -n 1 < Testing/TAG`/Test.xml > JUnitTestResults.xml
|
||||
DEPENDS test_results
|
||||
COMMENT "Converting ctest output to junit xml"
|
||||
WORKING_DIRECTORY ${PX4_BINARY_DIR})
|
||||
set_target_properties(test_results_junit PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||
|
||||
add_custom_target(test_cdash_submit
|
||||
COMMAND ${CMAKE_CTEST_COMMAND} -D Experimental
|
||||
USES_TERMINAL
|
||||
WORKING_DIRECTORY ${PX4_BINARY_DIR})
|
||||
set_target_properties(test_cdash_submit PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||
@@ -1,60 +0,0 @@
|
||||
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)
|
||||
include(qurt_flags)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-prototypes")
|
||||
|
||||
get_property(module_libraries GLOBAL PROPERTY PX4_LIBRARIES)
|
||||
|
||||
px4_qurt_generate_builtin_commands(
|
||||
OUT ${PX4_BINARY_DIR}/apps
|
||||
MODULE_LIST ${module_libraries})
|
||||
|
||||
FASTRPC_STUB_GEN(px4muorb.idl)
|
||||
|
||||
# Enable build without HexagonSDK to check link dependencies
|
||||
if ("${QURT_ENABLE_STUBS}" STREQUAL "1")
|
||||
add_definitions(-D QURT_EXE_BUILD=1)
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${FASTRPC_DSP_INCLUDES}
|
||||
)
|
||||
add_executable(px4
|
||||
${PX4_BINARY_DIR}/src/firmware/qurt/px4muorb_skel.c
|
||||
${PX4_BINARY_DIR}/apps.cpp)
|
||||
|
||||
target_link_libraries(px4
|
||||
-Wl,--start-group
|
||||
${module_libraries}
|
||||
${df_driver_libs}
|
||||
-Wl,--end-group
|
||||
)
|
||||
else()
|
||||
# Generate the DSP lib and stubs but not the apps side executable
|
||||
# The Apps side executable is generated via the posix_eagle_xxxx target
|
||||
QURT_LIB(LIB_NAME px4
|
||||
IDL_NAME px4muorb
|
||||
SOURCES
|
||||
${PX4_BINARY_DIR}/apps.cpp
|
||||
LINK_LIBS
|
||||
${module_libraries}
|
||||
${df_driver_libs}
|
||||
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()
|
||||
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@@ -1,184 +0,0 @@
|
||||
//=======================================================================
|
||||
// Copyright (c) 2016, Mark Charlebois. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * 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.
|
||||
// * Neither the name of The Linux Foundation 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 "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
// 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.
|
||||
//=========================================================================
|
||||
|
||||
#include "AEEStdDef.idl"
|
||||
|
||||
interface px4muorb{
|
||||
|
||||
/**
|
||||
* interface method to start the uorb service and initialize the muorb
|
||||
*/
|
||||
AEEResult orb_initialize();
|
||||
|
||||
/**
|
||||
* Interface to set an offset to hrt_absolute_time on the DSP.
|
||||
*
|
||||
* @param time_diff_us: time difference of the DSP clock to Linux clock.
|
||||
* A positive number means the Linux clock is ahead of the DSP one.
|
||||
*/
|
||||
AEEResult set_absolute_time_offset( in long time_diff_us );
|
||||
|
||||
/**
|
||||
* Interface to request hrt_absolute_time on the DSP.
|
||||
* @param time_us: pointer to time in us
|
||||
*/
|
||||
AEEResult get_absolute_time(rout unsigned long long time_us);
|
||||
|
||||
/**
|
||||
* Interface to update param for krait.
|
||||
*
|
||||
* @param param: param index.
|
||||
* @param value: param value.
|
||||
*/
|
||||
AEEResult param_update_to_shmem( in unsigned long param, in sequence<octet> value);
|
||||
|
||||
/**
|
||||
* Interface to update index for krait.
|
||||
* @param data: param index array.
|
||||
*/
|
||||
AEEResult param_update_index_from_shmem( rout sequence<octet> data);
|
||||
|
||||
/**
|
||||
* Interface to get param value for krait.
|
||||
*
|
||||
* @param param: param index.
|
||||
* @param value: param value.
|
||||
*/
|
||||
AEEResult param_update_value_from_shmem( in unsigned long param, rout sequence<octet> value);
|
||||
|
||||
/**
|
||||
* Interface called from krait to inform of a published topic.
|
||||
* @param topic_name: name of the topic being advertised
|
||||
*/
|
||||
AEEResult topic_advertised(in string topic_name);
|
||||
|
||||
/**
|
||||
* Interface called from krait to inform of a published topic.
|
||||
* @param topic_name: name of the topic being advertised
|
||||
*/
|
||||
AEEResult topic_unadvertised(in string topic_name);
|
||||
|
||||
/**
|
||||
* Interface to add a subscriber to the identified topic
|
||||
* @param topic_name
|
||||
* @return status
|
||||
* 0 == success
|
||||
* all others is a failure.
|
||||
*/
|
||||
AEEResult add_subscriber( in string topic_name );
|
||||
|
||||
/**
|
||||
* Interface to remove a subscriber for the identified topic.
|
||||
* @param topic_name
|
||||
* @return status
|
||||
* 0 == success
|
||||
* all others is a failure.
|
||||
*/
|
||||
AEEResult remove_subscriber( in string topic_name );
|
||||
|
||||
/**
|
||||
* Interface called from krait for topic data.
|
||||
* @param topic_name
|
||||
* @param data
|
||||
* a sequence of bytes for the passed data stream.
|
||||
* as per the HExagon Documention, the max size of this stream is 255 bytes.
|
||||
* @return status
|
||||
* 0 == success
|
||||
* all others is a failure.
|
||||
*/
|
||||
AEEResult send_topic_data( in string topic_name, in sequence<octet> data );
|
||||
|
||||
/**
|
||||
* Inteface to check if there are subscribers on the remote adsp client
|
||||
* This inteface is required as the krait app can be restarted without adsp
|
||||
* being re-started. In this scenario the krait app does not know if there
|
||||
* is subscriber on the remote end(ie adsp).
|
||||
* @param topic_name
|
||||
* The name of the topic for which the subscription needs to be checked.
|
||||
* @param rout int status
|
||||
* The status of the subscription, 0=no-subscribers, 1 = more than one subscriber.
|
||||
* @return status
|
||||
* 0 == success
|
||||
* all others is a failure.
|
||||
*/
|
||||
AEEResult is_subscriber_present( in string topic_name, rout long status );
|
||||
|
||||
/**
|
||||
* Interface to receive data from adsp. Since there is only one interface, the different message
|
||||
* types are identified by the msg_type field.
|
||||
* @param msg_type
|
||||
* The possible values are:
|
||||
* 1 ==> add_subscriber
|
||||
* 2 ==> remove_subscriber
|
||||
* 3 ==> recieve_topic_data
|
||||
* 4 ==> advertised_topic
|
||||
* @note: for message types, 1 & 2, the data pointer returned is null with length of 0.
|
||||
* @param topic_name
|
||||
* The topic being returned.
|
||||
* @param data
|
||||
* the data stream
|
||||
* @param bytes_returned
|
||||
* The number of bytes returned in the byte buffer.
|
||||
* @return status
|
||||
* 0 == success
|
||||
* all others is a failure.
|
||||
*/
|
||||
AEEResult receive_msg( rout long msg_type, rout string topic_name, rout sequence<octet> data, rout long bytes_returned );
|
||||
|
||||
/**
|
||||
* Since the receive_msg is a blocking call, the client will not be able to peform a clean shutdown. Calling this
|
||||
* function will unblock the receive msg an return an error code.
|
||||
* Ideally this should be implemented as a timeout for the #receive_msg call.
|
||||
* @param none
|
||||
* @return status
|
||||
* 0 = success
|
||||
* all others is a failure.
|
||||
**/
|
||||
AEEResult unblock_recieve_msg();
|
||||
|
||||
/**
|
||||
* This interface will perform a bulk read from the adsp and return the data buffer.
|
||||
* The structure of the messages is as follows
|
||||
* +----------------+-----------+---------------+----------+----------------+
|
||||
* | Topic Name Len | datal_len |TopicName(nullterminated) | data bytes |
|
||||
* +----------------+-----------+---------------+----------+----------------+
|
||||
* |<-- 2 bytes -->|<-2bytes-> |<-- topicnamelen bytes -->|<-datalenbytes->|
|
||||
* +----------------+---------------------------+----------+----------------+
|
||||
* @param data
|
||||
* The output buffer where the data needs to be copied
|
||||
* @param bytes_returned
|
||||
* The number of bytes the buffer is filled up by.
|
||||
* @param topic_count
|
||||
* The numbe of topics filled in the buffer.
|
||||
* @return status
|
||||
* 0 = success
|
||||
* all others is a failure.
|
||||
**/
|
||||
AEEResult receive_bulk_data( rout sequence<octet> data, rout long bytes_returned, rout long topic_count );
|
||||
};
|
||||
@@ -30,11 +30,11 @@
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
include_directories("../../uORB")
|
||||
|
||||
px4_add_module(
|
||||
MODULE modules__muorb__adsp
|
||||
COMPILE_FLAGS
|
||||
INCLUDES
|
||||
${PX4_SOURCE_DIR}/src/modules/uORB
|
||||
SRCS
|
||||
px4muorb.cpp
|
||||
uORBFastRpcChannel.cpp
|
||||
|
||||
@@ -38,7 +38,7 @@ px4_add_module(
|
||||
MAIN muorb
|
||||
INCLUDES
|
||||
${HEXAGON_SDK_INCLUDES}
|
||||
${PX4_BINARY_DIR}/src/firmware/posix
|
||||
${PX4_BINARY_DIR}/platforms/posix
|
||||
SRCS
|
||||
uORBKraitFastRpcChannel.cpp
|
||||
px4muorb_KraitRpcWrapper.cpp
|
||||
|
||||
@@ -35,9 +35,8 @@ set(EXTRA_DEPENDS)
|
||||
if("${CONFIG_SHMEM}" STREQUAL "1")
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PX4_SOURCE_DIR}/cmake/cmake_hexagon")
|
||||
include(hexagon_sdk)
|
||||
|
||||
include_directories(${PX4_BINARY_DIR}/src/firmware/posix)
|
||||
include_directories(${HEXAGON_SDK_INCLUDES})
|
||||
include_directories(${PX4_BINARY_DIR}/platforms/posix)
|
||||
list(APPEND SHMEM_SRCS
|
||||
shmem_posix.c
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user