diff --git a/CMakeLists.txt b/CMakeLists.txt index b4b3c5e34d..c5f1bf449b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -397,6 +397,8 @@ endif() #============================================================================= # subdirectories # +add_subdirectory(src/platforms/common) + foreach(module ${config_module_list}) add_subdirectory(src/${module}) endforeach() diff --git a/Tools/astyle/files_to_check_code_style.sh b/Tools/astyle/files_to_check_code_style.sh index 1fc7daf032..cf1be67d09 100755 --- a/Tools/astyle/files_to_check_code_style.sh +++ b/Tools/astyle/files_to_check_code_style.sh @@ -8,9 +8,9 @@ then PATTERN="$1" fi -exec find src \ - -path src/examples/attitude_estimator_ekf -prune -o \ - -path src/examples/ekf_att_pos_estimator -prune -o \ +exec find src platforms \ + -path platforms/nuttx/NuttX -prune -o \ + -path platforms/nuttx/nuttx-configs -prune -o \ -path src/lib/DriverFramework -prune -o \ -path src/lib/ecl -prune -o \ -path src/lib/matrix -prune -o \ diff --git a/cmake/configs/nuttx_aerocore2_default.cmake b/cmake/configs/nuttx_aerocore2_default.cmake index 081ad2a757..3d201edd84 100644 --- a/cmake/configs/nuttx_aerocore2_default.cmake +++ b/cmake/configs/nuttx_aerocore2_default.cmake @@ -126,11 +126,6 @@ set(config_module_list lib/terrain_estimation lib/tunes lib/version - platforms/nuttx - - # had to add for cmake, not sure why wasn't in original config - platforms/common - platforms/nuttx/px4_layer # # OBC challenge diff --git a/cmake/configs/nuttx_aerofc-v1_default.cmake b/cmake/configs/nuttx_aerofc-v1_default.cmake index 7a2337fb3f..47cb05b4b6 100644 --- a/cmake/configs/nuttx_aerofc-v1_default.cmake +++ b/cmake/configs/nuttx_aerofc-v1_default.cmake @@ -87,7 +87,4 @@ set(config_module_list lib/rc lib/tailsitter_recovery lib/version - platforms/common - platforms/nuttx - platforms/nuttx/px4_layer ) diff --git a/cmake/configs/nuttx_auav-x21_default.cmake b/cmake/configs/nuttx_auav-x21_default.cmake index 408dbe2174..e8fb2875bc 100644 --- a/cmake/configs/nuttx_auav-x21_default.cmake +++ b/cmake/configs/nuttx_auav-x21_default.cmake @@ -137,11 +137,6 @@ set(config_module_list lib/terrain_estimation lib/tunes lib/version - platforms/nuttx - - # had to add for cmake, not sure why wasn't in original config - platforms/common - platforms/nuttx/px4_layer # # OBC challenge diff --git a/cmake/configs/nuttx_crazyflie_default.cmake b/cmake/configs/nuttx_crazyflie_default.cmake index 8da7b1cb2a..e976f90303 100644 --- a/cmake/configs/nuttx_crazyflie_default.cmake +++ b/cmake/configs/nuttx_crazyflie_default.cmake @@ -93,11 +93,6 @@ set(config_module_list lib/tailsitter_recovery lib/terrain_estimation lib/version - platforms/nuttx - - # had to add for cmake, not sure why wasn't in original config - platforms/common - platforms/nuttx/px4_layer # # OBC challenge diff --git a/cmake/configs/nuttx_esc35-v1_default.cmake b/cmake/configs/nuttx_esc35-v1_default.cmake index de768001cb..1446f25ae8 100644 --- a/cmake/configs/nuttx_esc35-v1_default.cmake +++ b/cmake/configs/nuttx_esc35-v1_default.cmake @@ -71,7 +71,4 @@ set(config_module_list modules/systemlib modules/systemlib/param modules/uORB - platforms/common - platforms/nuttx - platforms/nuttx/px4_layer ) diff --git a/cmake/configs/nuttx_mindpx-v2_default.cmake b/cmake/configs/nuttx_mindpx-v2_default.cmake index f7962b92b9..9f5486fd3b 100644 --- a/cmake/configs/nuttx_mindpx-v2_default.cmake +++ b/cmake/configs/nuttx_mindpx-v2_default.cmake @@ -141,11 +141,6 @@ set(config_module_list lib/terrain_estimation lib/tunes lib/version - platforms/nuttx - - # had to add for cmake, not sure why wasn't in original config - platforms/common - platforms/nuttx/px4_layer # # OBC challenge diff --git a/cmake/configs/nuttx_nxphlite-v3_default.cmake b/cmake/configs/nuttx_nxphlite-v3_default.cmake index 18497332c9..e298abbfd0 100644 --- a/cmake/configs/nuttx_nxphlite-v3_default.cmake +++ b/cmake/configs/nuttx_nxphlite-v3_default.cmake @@ -150,13 +150,6 @@ set(config_module_list lib/version lib/DriverFramework/framework - # - # Platform - # - platforms/common - platforms/nuttx - platforms/nuttx/px4_layer - # # OBC challenge # diff --git a/cmake/configs/nuttx_px4-same70xplained-v1_default.cmake b/cmake/configs/nuttx_px4-same70xplained-v1_default.cmake index cffc6fb7d3..46529d343c 100644 --- a/cmake/configs/nuttx_px4-same70xplained-v1_default.cmake +++ b/cmake/configs/nuttx_px4-same70xplained-v1_default.cmake @@ -119,11 +119,6 @@ set(config_module_list lib/tailsitter_recovery lib/terrain_estimation lib/version - platforms/nuttx - - # had to add for cmake, not sure why wasn't in original config - platforms/common - platforms/nuttx/px4_layer # # OBC challenge diff --git a/cmake/configs/nuttx_px4-stm32f4discovery_default.cmake b/cmake/configs/nuttx_px4-stm32f4discovery_default.cmake index fa45a6d0bb..1585d3338a 100644 --- a/cmake/configs/nuttx_px4-stm32f4discovery_default.cmake +++ b/cmake/configs/nuttx_px4-stm32f4discovery_default.cmake @@ -43,11 +43,6 @@ set(config_module_list lib/mathlib/math/filter lib/mixer lib/version - platforms/nuttx - - # had to add for cmake, not sure why wasn't in original config - platforms/common - platforms/nuttx/px4_layer # # Demo apps diff --git a/cmake/configs/nuttx_px4cannode-v1_default.cmake b/cmake/configs/nuttx_px4cannode-v1_default.cmake index 1eb386b105..bc9d6119d6 100644 --- a/cmake/configs/nuttx_px4cannode-v1_default.cmake +++ b/cmake/configs/nuttx_px4cannode-v1_default.cmake @@ -63,7 +63,5 @@ set(config_module_list modules/systemlib modules/systemlib/param modules/uORB - platforms/common - platforms/nuttx - platforms/nuttx/px4_layer + ) \ No newline at end of file diff --git a/cmake/configs/nuttx_px4esc-v1_default.cmake b/cmake/configs/nuttx_px4esc-v1_default.cmake index 0d7dd356f3..3c7d1ef1d3 100644 --- a/cmake/configs/nuttx_px4esc-v1_default.cmake +++ b/cmake/configs/nuttx_px4esc-v1_default.cmake @@ -72,7 +72,5 @@ set(config_module_list modules/systemlib modules/systemlib/param modules/uORB - platforms/common - platforms/nuttx - platforms/nuttx/px4_layer + ) \ No newline at end of file diff --git a/cmake/configs/nuttx_px4fmu-v2_default.cmake b/cmake/configs/nuttx_px4fmu-v2_default.cmake index cc6b33612f..3074954189 100644 --- a/cmake/configs/nuttx_px4fmu-v2_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v2_default.cmake @@ -154,13 +154,6 @@ set(config_module_list lib/tunes lib/version - # - # Platform - # - platforms/common - platforms/nuttx - platforms/nuttx/px4_layer - # # OBC challenge # diff --git a/cmake/configs/nuttx_px4fmu-v2_test.cmake b/cmake/configs/nuttx_px4fmu-v2_test.cmake index 49db89e030..936403269f 100644 --- a/cmake/configs/nuttx_px4fmu-v2_test.cmake +++ b/cmake/configs/nuttx_px4fmu-v2_test.cmake @@ -138,11 +138,6 @@ set(config_module_list lib/terrain_estimation lib/tunes lib/version - platforms/nuttx - - # had to add for cmake, not sure why wasn't in original config - platforms/common - platforms/nuttx/px4_layer # # OBC challenge diff --git a/cmake/configs/nuttx_px4fmu-v3_default.cmake b/cmake/configs/nuttx_px4fmu-v3_default.cmake index 2fa87dd0b7..940216d181 100644 --- a/cmake/configs/nuttx_px4fmu-v3_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v3_default.cmake @@ -155,13 +155,6 @@ set(config_module_list lib/tunes lib/version - # - # Platform - # - platforms/common - platforms/nuttx - platforms/nuttx/px4_layer - # # OBC challenge # diff --git a/cmake/configs/nuttx_px4fmu-v4_default.cmake b/cmake/configs/nuttx_px4fmu-v4_default.cmake index 4535450c99..ae7886af1e 100644 --- a/cmake/configs/nuttx_px4fmu-v4_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v4_default.cmake @@ -148,13 +148,6 @@ set(config_module_list lib/tunes lib/version - # - # Platform - # - platforms/common - platforms/nuttx - platforms/nuttx/px4_layer - # # OBC challenge # diff --git a/cmake/configs/nuttx_px4fmu-v4pro_default.cmake b/cmake/configs/nuttx_px4fmu-v4pro_default.cmake index b4735ae0fc..c07d33756c 100644 --- a/cmake/configs/nuttx_px4fmu-v4pro_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v4pro_default.cmake @@ -147,13 +147,6 @@ set(config_module_list lib/tunes lib/version - # - # Platform - # - platforms/common - platforms/nuttx - platforms/nuttx/px4_layer - # # OBC challenge # diff --git a/cmake/configs/nuttx_px4fmu-v5_default.cmake b/cmake/configs/nuttx_px4fmu-v5_default.cmake index 111c9b5813..72405c8959 100644 --- a/cmake/configs/nuttx_px4fmu-v5_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v5_default.cmake @@ -149,13 +149,6 @@ set(config_module_list lib/tunes lib/version - # - # Platform - # - platforms/common - platforms/nuttx - platforms/nuttx/px4_layer - # # OBC challenge # diff --git a/cmake/configs/nuttx_px4io-v2_default.cmake b/cmake/configs/nuttx_px4io-v2_default.cmake index 78e3abe4d5..0a0ebcb384 100644 --- a/cmake/configs/nuttx_px4io-v2_default.cmake +++ b/cmake/configs/nuttx_px4io-v2_default.cmake @@ -7,5 +7,4 @@ set(config_module_list lib/mixer lib/rc modules/px4iofirmware - platforms/common ) diff --git a/cmake/configs/nuttx_px4nucleoF767ZI-v1_default.cmake b/cmake/configs/nuttx_px4nucleoF767ZI-v1_default.cmake index bb1bb263e6..353de186e9 100644 --- a/cmake/configs/nuttx_px4nucleoF767ZI-v1_default.cmake +++ b/cmake/configs/nuttx_px4nucleoF767ZI-v1_default.cmake @@ -126,11 +126,6 @@ set(config_module_list lib/terrain_estimation lib/tunes lib/version - platforms/nuttx - - # had to add for cmake, not sure why wasn't in original config - platforms/common - platforms/nuttx/px4_layer # # OBC challenge diff --git a/cmake/configs/nuttx_s2740vc-v1_default.cmake b/cmake/configs/nuttx_s2740vc-v1_default.cmake index 5176924673..2c6e3fe492 100644 --- a/cmake/configs/nuttx_s2740vc-v1_default.cmake +++ b/cmake/configs/nuttx_s2740vc-v1_default.cmake @@ -60,12 +60,4 @@ set(config_module_list modules/systemlib/param modules/systemlib lib/version - - # - # Libraries - # - # had to add for cmake, not sure why wasn't in original config - platforms/nuttx - platforms/common - platforms/nuttx/px4_layer ) diff --git a/cmake/configs/nuttx_tap-v1_default.cmake b/cmake/configs/nuttx_tap-v1_default.cmake index 6376193c4e..a9474f0038 100644 --- a/cmake/configs/nuttx_tap-v1_default.cmake +++ b/cmake/configs/nuttx_tap-v1_default.cmake @@ -102,9 +102,4 @@ set(config_module_list lib/terrain_estimation lib/tunes lib/version - platforms/nuttx - - # had to add for cmake, not sure why wasn't in original config - platforms/common - platforms/nuttx/px4_layer ) diff --git a/cmake/configs/posix_bebop_default.cmake b/cmake/configs/posix_bebop_default.cmake index 33c518e17c..cbca184cde 100644 --- a/cmake/configs/posix_bebop_default.cmake +++ b/cmake/configs/posix_bebop_default.cmake @@ -85,13 +85,6 @@ set(config_module_list lib/tailsitter_recovery lib/terrain_estimation lib/version - - # - # POSIX - # - platforms/common - platforms/posix/px4_layer - platforms/posix/work_queue ) set(config_df_driver_list diff --git a/cmake/configs/posix_eagle_hil.cmake b/cmake/configs/posix_eagle_hil.cmake index 65d48e7200..0efec4f183 100644 --- a/cmake/configs/posix_eagle_hil.cmake +++ b/cmake/configs/posix_eagle_hil.cmake @@ -48,9 +48,6 @@ set(config_module_list lib/version lib/DriverFramework/framework - platforms/common - platforms/posix/px4_layer - platforms/posix/work_queue modules/muorb/krait ) diff --git a/cmake/configs/posix_eagle_muorb.cmake b/cmake/configs/posix_eagle_muorb.cmake index cf67730062..51ce40b9bb 100644 --- a/cmake/configs/posix_eagle_muorb.cmake +++ b/cmake/configs/posix_eagle_muorb.cmake @@ -19,9 +19,6 @@ set(config_module_list lib/DriverFramework/framework - platforms/posix/px4_layer - platforms/posix/work_queue - modules/muorb/krait ) diff --git a/cmake/configs/posix_ocpoc_cross.cmake b/cmake/configs/posix_ocpoc_cross.cmake index f1a07260cc..47ae19d24e 100644 --- a/cmake/configs/posix_ocpoc_cross.cmake +++ b/cmake/configs/posix_ocpoc_cross.cmake @@ -95,13 +95,6 @@ set(config_module_list lib/tailsitter_recovery lib/terrain_estimation lib/version - - # - # POSIX - # - platforms/common - platforms/posix/px4_layer - platforms/posix/work_queue examples/px4_simple_app ) diff --git a/cmake/configs/posix_ocpoc_ubuntu.cmake b/cmake/configs/posix_ocpoc_ubuntu.cmake index 20432e55dc..a148295752 100644 --- a/cmake/configs/posix_ocpoc_ubuntu.cmake +++ b/cmake/configs/posix_ocpoc_ubuntu.cmake @@ -94,13 +94,6 @@ set(config_module_list lib/tailsitter_recovery lib/terrain_estimation lib/version - - # - # POSIX - # - platforms/common - platforms/posix/px4_layer - platforms/posix/work_queue examples/px4_simple_app ) diff --git a/cmake/configs/posix_rpi_common.cmake b/cmake/configs/posix_rpi_common.cmake index cab5991d23..54023e3cb8 100644 --- a/cmake/configs/posix_rpi_common.cmake +++ b/cmake/configs/posix_rpi_common.cmake @@ -107,13 +107,6 @@ set(config_module_list lib/terrain_estimation lib/tunes lib/version - - # - # POSIX - # - platforms/common - platforms/posix/px4_layer - platforms/posix/work_queue ) # diff --git a/cmake/configs/posix_sdflight_default.cmake b/cmake/configs/posix_sdflight_default.cmake index 2994d6342a..657f7eea36 100644 --- a/cmake/configs/posix_sdflight_default.cmake +++ b/cmake/configs/posix_sdflight_default.cmake @@ -83,8 +83,4 @@ set(config_module_list lib/terrain_estimation lib/tunes lib/version - - platforms/common - platforms/posix/px4_layer - platforms/posix/work_queue - ) +) diff --git a/cmake/configs/posix_sdflight_legacy.cmake b/cmake/configs/posix_sdflight_legacy.cmake index f7b05b7d74..f2c9ff3474 100644 --- a/cmake/configs/posix_sdflight_legacy.cmake +++ b/cmake/configs/posix_sdflight_legacy.cmake @@ -75,8 +75,4 @@ set(config_module_list lib/terrain_estimation lib/tunes lib/version - - platforms/common - platforms/posix/px4_layer - platforms/posix/work_queue ) diff --git a/cmake/configs/posix_sitl_default.cmake b/cmake/configs/posix_sitl_default.cmake index 164357ac3b..e0122ec3cb 100644 --- a/cmake/configs/posix_sitl_default.cmake +++ b/cmake/configs/posix_sitl_default.cmake @@ -64,7 +64,6 @@ set(config_module_list platforms/posix/tests/hrt_test platforms/posix/tests/muorb platforms/posix/tests/vcdev_test - platforms/posix/tests/wqueue # # General system control @@ -135,13 +134,6 @@ set(config_module_list lib/tunes lib/version - # - # Platform - # - platforms/common - platforms/posix/px4_layer - platforms/posix/work_queue - # # OBC challenge # diff --git a/cmake/configs/posix_sitl_replay.cmake b/cmake/configs/posix_sitl_replay.cmake index c61c95f0b4..275dccb33e 100644 --- a/cmake/configs/posix_sitl_replay.cmake +++ b/cmake/configs/posix_sitl_replay.cmake @@ -4,9 +4,6 @@ set(CMAKE_TOOLCHAIN_FILE ${PX4_SOURCE_DIR}/cmake/toolchains/Toolchain-native.cma set(config_module_list drivers/device drivers/boards/sitl - platforms/common - platforms/posix/px4_layer - platforms/posix/work_queue systemcmds/param systemcmds/ver systemcmds/perf diff --git a/cmake/configs/qurt_eagle_hello.cmake b/cmake/configs/qurt_eagle_hello.cmake index 741d9ee28d..aac80873b9 100644 --- a/cmake/configs/qurt_eagle_hello.cmake +++ b/cmake/configs/qurt_eagle_hello.cmake @@ -33,13 +33,5 @@ set(config_module_list modules/systemlib/param modules/systemlib modules/uORB - - # - # QuRT port - # - platforms/common - platforms/qurt/px4_layer - platforms/posix/work_queue - platforms/qurt/tests/hello ) diff --git a/cmake/configs/qurt_eagle_hil.cmake b/cmake/configs/qurt_eagle_hil.cmake index 4756b13620..0000d44997 100644 --- a/cmake/configs/qurt_eagle_hil.cmake +++ b/cmake/configs/qurt_eagle_hil.cmake @@ -73,13 +73,6 @@ set(config_module_list lib/terrain_estimation lib/version - # - # QuRT port - # - platforms/common - platforms/qurt/px4_layer - platforms/posix/work_queue - # # sources for muorb over fastrpc # diff --git a/cmake/configs/qurt_eagle_muorb.cmake b/cmake/configs/qurt_eagle_muorb.cmake index 1089d9dab0..059c7e545f 100644 --- a/cmake/configs/qurt_eagle_muorb.cmake +++ b/cmake/configs/qurt_eagle_muorb.cmake @@ -45,14 +45,6 @@ set(config_module_list lib/version lib/DriverFramework/framework - # - # QuRT port - # - platforms/common - platforms/qurt/px4_layer - platforms/posix/work_queue - platforms/qurt/tests/muorb - # # sources for muorb over fastrpc # diff --git a/cmake/configs/qurt_eagle_test.cmake b/cmake/configs/qurt_eagle_test.cmake index 5ede3b3188..9757bec3f3 100644 --- a/cmake/configs/qurt_eagle_test.cmake +++ b/cmake/configs/qurt_eagle_test.cmake @@ -42,16 +42,5 @@ set(config_module_list lib/mathlib lib/mathlib/math/filter lib/mixer - - # - # QuRT port - # - platforms/common - platforms/qurt/px4_layer - platforms/posix/work_queue - platforms/qurt/tests/hello - platforms/posix/tests/vcdev_test - platforms/posix/tests/hrt_test - platforms/posix/tests/wqueue ) diff --git a/cmake/configs/qurt_eagle_travis.cmake b/cmake/configs/qurt_eagle_travis.cmake index 6b58ff2174..987d7a6f29 100644 --- a/cmake/configs/qurt_eagle_travis.cmake +++ b/cmake/configs/qurt_eagle_travis.cmake @@ -79,13 +79,6 @@ set(config_module_list lib/terrain_estimation lib/version - # - # QuRT port - # - platforms/common - platforms/qurt/px4_layer - platforms/posix/work_queue - # # sources for muorb over fastrpc # diff --git a/cmake/configs/qurt_sdflight_default.cmake b/cmake/configs/qurt_sdflight_default.cmake index bd85d98215..9d004b21d1 100644 --- a/cmake/configs/qurt_sdflight_default.cmake +++ b/cmake/configs/qurt_sdflight_default.cmake @@ -97,13 +97,6 @@ set(config_module_list lib/terrain_estimation lib/version - # - # QuRT port - # - platforms/common - platforms/qurt/px4_layer - platforms/posix/work_queue - # # sources for muorb over fastrpc # diff --git a/cmake/configs/qurt_sdflight_legacy.cmake b/cmake/configs/qurt_sdflight_legacy.cmake index 14c3530f45..c2229947fa 100644 --- a/cmake/configs/qurt_sdflight_legacy.cmake +++ b/cmake/configs/qurt_sdflight_legacy.cmake @@ -96,13 +96,6 @@ set(config_module_list lib/terrain_estimation lib/version - # - # QuRT port - # - platforms/common - platforms/qurt/px4_layer - platforms/posix/work_queue - # # sources for muorb over fastrpc # diff --git a/platforms/nuttx/CMakeLists.txt b/platforms/nuttx/CMakeLists.txt index 647ee8f936..b876adcfb5 100644 --- a/platforms/nuttx/CMakeLists.txt +++ b/platforms/nuttx/CMakeLists.txt @@ -1,6 +1,41 @@ +############################################################################ +# +# 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. +# +############################################################################ + include(common/px4_upload) include(cygwin_cygpath) +add_subdirectory(src) + if (NOT FW_NAME) set(FW_NAME ${CONFIG}.elf) endif() diff --git a/platforms/nuttx/cmake/px4_impl_os.cmake b/platforms/nuttx/cmake/px4_impl_os.cmake index e3b2fba3c8..a9877bce38 100644 --- a/platforms/nuttx/cmake/px4_impl_os.cmake +++ b/platforms/nuttx/cmake/px4_impl_os.cmake @@ -175,13 +175,17 @@ function(px4_os_add_flags) LINK_DIRS ${LINK_DIRS} DEFINITIONS ${DEFINITIONS}) - set(added_include_dirs + include_directories(BEFORE SYSTEM + ${PX4_BINARY_DIR}/NuttX/nuttx/include + ${PX4_BINARY_DIR}/NuttX/nuttx/include/cxx + ) + + include_directories( ${PX4_BINARY_DIR}/NuttX/nuttx/arch/arm/src/armv7-m ${PX4_BINARY_DIR}/NuttX/nuttx/arch/arm/src/chip ${PX4_BINARY_DIR}/NuttX/nuttx/arch/arm/src/common - ${PX4_BINARY_DIR}/NuttX/nuttx/include - ${PX4_BINARY_DIR}/NuttX/nuttx/include/cxx - ${PX4_SOURCE_DIR}/platforms/nuttx/NuttX/apps/include + + ${PX4_BINARY_DIR}/NuttX/apps/include ) #set(added_exe_linker_flags) diff --git a/src/platforms/nuttx/px4_layer/CMakeLists.txt b/platforms/nuttx/src/CMakeLists.txt similarity index 85% rename from src/platforms/nuttx/px4_layer/CMakeLists.txt rename to platforms/nuttx/src/CMakeLists.txt index fd11e6e598..602b1b7107 100644 --- a/src/platforms/nuttx/px4_layer/CMakeLists.txt +++ b/platforms/nuttx/src/CMakeLists.txt @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# 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 @@ -30,13 +30,5 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ -px4_add_module( - MODULE platforms__nuttx__px4_layer - COMPILE_FLAGS - SRCS - px4_nuttx_tasks.c - ../../posix/px4_layer/px4_log.c - DEPENDS - platforms__common - ) -# vim: set noet ft=cmake fenc=utf-8 ff=unix : + +add_subdirectory(px4_layer) diff --git a/src/platforms/nuttx/CMakeLists.txt b/platforms/nuttx/src/px4_layer/CMakeLists.txt similarity index 88% rename from src/platforms/nuttx/CMakeLists.txt rename to platforms/nuttx/src/px4_layer/CMakeLists.txt index bd7e75c0aa..cda2c1fbca 100644 --- a/src/platforms/nuttx/CMakeLists.txt +++ b/platforms/nuttx/src/px4_layer/CMakeLists.txt @@ -30,12 +30,16 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ -px4_add_module( - MODULE platforms__nuttx - COMPILE_FLAGS - SRCS - px4_nuttx_impl.cpp - DEPENDS - platforms__common - ) -# vim: set noet ft=cmake fenc=utf-8 ff=unix : + +# skip for px4_layer support on an IO board +if (NOT ${BOARD} MATCHES "px4io") + + px4_add_module( + MODULE platform_px4_layer + SRCS + px4_nuttx_tasks.c + px4_nuttx_impl.cpp + DEPENDS + prebuild_targets + ) +endif() diff --git a/src/platforms/nuttx/px4_nuttx_impl.cpp b/platforms/nuttx/src/px4_layer/px4_nuttx_impl.cpp similarity index 99% rename from src/platforms/nuttx/px4_nuttx_impl.cpp rename to platforms/nuttx/src/px4_layer/px4_nuttx_impl.cpp index b51303274d..7495b030cc 100644 --- a/src/platforms/nuttx/px4_nuttx_impl.cpp +++ b/platforms/nuttx/src/px4_layer/px4_nuttx_impl.cpp @@ -41,7 +41,6 @@ #include #include - namespace px4 { diff --git a/src/platforms/nuttx/px4_layer/px4_nuttx_tasks.c b/platforms/nuttx/src/px4_layer/px4_nuttx_tasks.c similarity index 96% rename from src/platforms/nuttx/px4_layer/px4_nuttx_tasks.c rename to platforms/nuttx/src/px4_layer/px4_nuttx_tasks.c index 1bf359d617..1f149d1a09 100644 --- a/src/platforms/nuttx/px4_layer/px4_nuttx_tasks.c +++ b/platforms/nuttx/src/px4_layer/px4_nuttx_tasks.c @@ -37,24 +37,22 @@ * Implementation of existing task API for NuttX */ -#include -#include -#include +#include + +#include +#include #include -#include -#include -#include +#include #include -#include +#include #include +#include +#include +#include -#include -#include - - +#include #include -#include - +#include void px4_systemreset(bool to_bootloader) @@ -115,4 +113,3 @@ const char *px4_get_taskname(void) return "app"; #endif } - diff --git a/platforms/posix/CMakeLists.txt b/platforms/posix/CMakeLists.txt index 3d2b365365..bd0263a246 100644 --- a/platforms/posix/CMakeLists.txt +++ b/platforms/posix/CMakeLists.txt @@ -1,5 +1,7 @@ include (common/px4_upload) +add_subdirectory(src) + include_directories(${CMAKE_CURRENT_BINARY_DIR}) get_property(module_libraries GLOBAL PROPERTY PX4_LIBRARIES) @@ -10,7 +12,7 @@ px4_posix_generate_builtin_commands( # Define build target set(APP_NAME px4) -set(MAIN_SRC ${PX4_SOURCE_DIR}/src/platforms/posix/main.cpp) +set(MAIN_SRC src/main.cpp) set(UPLOAD_NAME upload) if ("${BOARD}" STREQUAL "eagle" OR ("${BOARD}" STREQUAL "excelsior")) diff --git a/platforms/posix/cmake/px4_impl_os.cmake b/platforms/posix/cmake/px4_impl_os.cmake index d4d8479f6f..b33acb225d 100644 --- a/platforms/posix/cmake/px4_impl_os.cmake +++ b/platforms/posix/cmake/px4_impl_os.cmake @@ -165,9 +165,7 @@ function(px4_os_add_flags) DEFINITIONS ${DEFINITIONS}) set(added_include_dirs - src/modules/systemlib - src/platforms/posix/include - mavlink/include/mavlink + platforms/posix/include ) # This block sets added_definitions and added_cxx_flags. diff --git a/platforms/posix/cmake/sitl_target.cmake b/platforms/posix/cmake/sitl_target.cmake index ca116e8399..bc772b0730 100644 --- a/platforms/posix/cmake/sitl_target.cmake +++ b/platforms/posix/cmake/sitl_target.cmake @@ -32,7 +32,7 @@ endfunction() # sitl run targets # -set(SITL_RUNNER_MAIN_CPP ${PX4_SOURCE_DIR}/src/platforms/posix/main.cpp) +set(SITL_RUNNER_MAIN_CPP src/main.cpp) px4_add_sitl_app(APP_NAME px4 UPLOAD_NAME upload MAIN_SRC ${SITL_RUNNER_MAIN_CPP} @@ -111,7 +111,7 @@ foreach(viewer ${viewers}) 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) + 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} diff --git a/src/platforms/posix/include/arch/board/board.h b/platforms/posix/include/arch/board/board.h similarity index 100% rename from src/platforms/posix/include/arch/board/board.h rename to platforms/posix/include/arch/board/board.h diff --git a/src/platforms/posix/include/crc32.h b/platforms/posix/include/crc32.h similarity index 100% rename from src/platforms/posix/include/crc32.h rename to platforms/posix/include/crc32.h diff --git a/src/platforms/posix/include/hrt_work.h b/platforms/posix/include/hrt_work.h similarity index 100% rename from src/platforms/posix/include/hrt_work.h rename to platforms/posix/include/hrt_work.h diff --git a/src/platforms/posix/include/px4_platform_types.h b/platforms/posix/include/px4_platform_types.h similarity index 100% rename from src/platforms/posix/include/px4_platform_types.h rename to platforms/posix/include/px4_platform_types.h diff --git a/src/platforms/posix/include/queue.h b/platforms/posix/include/queue.h similarity index 100% rename from src/platforms/posix/include/queue.h rename to platforms/posix/include/queue.h diff --git a/src/platforms/posix/include/system_config.h b/platforms/posix/include/system_config.h similarity index 100% rename from src/platforms/posix/include/system_config.h rename to platforms/posix/include/system_config.h diff --git a/platforms/posix/src/CMakeLists.txt b/platforms/posix/src/CMakeLists.txt new file mode 100644 index 0000000000..602b1b7107 --- /dev/null +++ b/platforms/posix/src/CMakeLists.txt @@ -0,0 +1,34 @@ +############################################################################ +# +# 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. +# +############################################################################ + +add_subdirectory(px4_layer) diff --git a/src/platforms/posix/main.cpp b/platforms/posix/src/main.cpp similarity index 100% rename from src/platforms/posix/main.cpp rename to platforms/posix/src/main.cpp diff --git a/src/platforms/posix/px4_layer/CMakeLists.txt b/platforms/posix/src/px4_layer/CMakeLists.txt similarity index 99% rename from src/platforms/posix/px4_layer/CMakeLists.txt rename to platforms/posix/src/px4_layer/CMakeLists.txt index b0eaad3b4e..6dadaa1e74 100644 --- a/src/platforms/posix/px4_layer/CMakeLists.txt +++ b/platforms/posix/src/px4_layer/CMakeLists.txt @@ -54,7 +54,6 @@ px4_add_module( px4_sem.cpp lib_crc32.c drv_hrt.c - px4_log.c ${SHMEM_SRCS} DEPENDS platforms__common diff --git a/src/platforms/posix/px4_layer/drv_hrt.c b/platforms/posix/src/px4_layer/drv_hrt.c similarity index 100% rename from src/platforms/posix/px4_layer/drv_hrt.c rename to platforms/posix/src/px4_layer/drv_hrt.c diff --git a/src/platforms/posix/px4_layer/lib_crc32.c b/platforms/posix/src/px4_layer/lib_crc32.c similarity index 100% rename from src/platforms/posix/px4_layer/lib_crc32.c rename to platforms/posix/src/px4_layer/lib_crc32.c diff --git a/src/platforms/posix/px4_layer/px4_posix_impl.cpp b/platforms/posix/src/px4_layer/px4_posix_impl.cpp similarity index 100% rename from src/platforms/posix/px4_layer/px4_posix_impl.cpp rename to platforms/posix/src/px4_layer/px4_posix_impl.cpp diff --git a/src/platforms/posix/px4_layer/px4_posix_tasks.cpp b/platforms/posix/src/px4_layer/px4_posix_tasks.cpp similarity index 100% rename from src/platforms/posix/px4_layer/px4_posix_tasks.cpp rename to platforms/posix/src/px4_layer/px4_posix_tasks.cpp diff --git a/src/platforms/posix/px4_layer/px4_sem.cpp b/platforms/posix/src/px4_layer/px4_sem.cpp similarity index 100% rename from src/platforms/posix/px4_layer/px4_sem.cpp rename to platforms/posix/src/px4_layer/px4_sem.cpp diff --git a/src/platforms/posix/px4_layer/shmem_posix.c b/platforms/posix/src/px4_layer/shmem_posix.c similarity index 100% rename from src/platforms/posix/px4_layer/shmem_posix.c rename to platforms/posix/src/px4_layer/shmem_posix.c diff --git a/src/platforms/posix/sitl_runner_main.cpp.in b/platforms/posix/src/sitl_runner_main.cpp.in similarity index 100% rename from src/platforms/posix/sitl_runner_main.cpp.in rename to platforms/posix/src/sitl_runner_main.cpp.in diff --git a/platforms/qurt/CMakeLists.txt b/platforms/qurt/CMakeLists.txt index b9923e4940..6af56aef71 100644 --- a/platforms/qurt/CMakeLists.txt +++ b/platforms/qurt/CMakeLists.txt @@ -5,6 +5,8 @@ include(fastrpc) include(qurt_lib) include(qurt_flags) +add_subdirectory(src) + include_directories(${CMAKE_CURRENT_BINARY_DIR}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-prototypes") diff --git a/platforms/qurt/cmake/px4_impl_os.cmake b/platforms/qurt/cmake/px4_impl_os.cmake index 06ce660f0b..47754c3120 100644 --- a/platforms/qurt/cmake/px4_impl_os.cmake +++ b/platforms/qurt/cmake/px4_impl_os.cmake @@ -168,8 +168,9 @@ function(px4_os_add_flags) ${DSPAL_ROOT}/sys ${DSPAL_ROOT}/sys/sys ${DSPAL_ROOT}/uart_esc/inc - src/platforms/posix/include - src/platforms/qurt/include + + platforms/posix/include + platforms/qurt/include ) set(added_definitions diff --git a/src/platforms/qurt/include/arch/board/board.h b/platforms/qurt/include/arch/board/board.h similarity index 100% rename from src/platforms/qurt/include/arch/board/board.h rename to platforms/qurt/include/arch/board/board.h diff --git a/src/platforms/qurt/include/board_config.h b/platforms/qurt/include/board_config.h similarity index 100% rename from src/platforms/qurt/include/board_config.h rename to platforms/qurt/include/board_config.h diff --git a/src/platforms/qurt/include/crc32.h b/platforms/qurt/include/crc32.h similarity index 100% rename from src/platforms/qurt/include/crc32.h rename to platforms/qurt/include/crc32.h diff --git a/src/platforms/qurt/include/hrt_work.h b/platforms/qurt/include/hrt_work.h similarity index 100% rename from src/platforms/qurt/include/hrt_work.h rename to platforms/qurt/include/hrt_work.h diff --git a/src/platforms/qurt/include/i2c.h b/platforms/qurt/include/i2c.h similarity index 100% rename from src/platforms/qurt/include/i2c.h rename to platforms/qurt/include/i2c.h diff --git a/src/platforms/qurt/include/poll.h b/platforms/qurt/include/poll.h similarity index 100% rename from src/platforms/qurt/include/poll.h rename to platforms/qurt/include/poll.h diff --git a/src/platforms/qurt/include/queue.h b/platforms/qurt/include/queue.h similarity index 100% rename from src/platforms/qurt/include/queue.h rename to platforms/qurt/include/queue.h diff --git a/src/platforms/qurt/include/qurt_log.h b/platforms/qurt/include/qurt_log.h similarity index 100% rename from src/platforms/qurt/include/qurt_log.h rename to platforms/qurt/include/qurt_log.h diff --git a/src/platforms/qurt/include/sys/ioctl.h b/platforms/qurt/include/sys/ioctl.h similarity index 100% rename from src/platforms/qurt/include/sys/ioctl.h rename to platforms/qurt/include/sys/ioctl.h diff --git a/platforms/qurt/src/CMakeLists.txt b/platforms/qurt/src/CMakeLists.txt new file mode 100644 index 0000000000..602b1b7107 --- /dev/null +++ b/platforms/qurt/src/CMakeLists.txt @@ -0,0 +1,34 @@ +############################################################################ +# +# 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. +# +############################################################################ + +add_subdirectory(px4_layer) diff --git a/src/platforms/qurt/px4_layer/CMakeLists.txt b/platforms/qurt/src/px4_layer/CMakeLists.txt similarity index 95% rename from src/platforms/qurt/px4_layer/CMakeLists.txt rename to platforms/qurt/src/px4_layer/CMakeLists.txt index 7b913cfdbf..b7cf471c94 100644 --- a/src/platforms/qurt/px4_layer/CMakeLists.txt +++ b/platforms/qurt/src/px4_layer/CMakeLists.txt @@ -39,11 +39,12 @@ set(QURT_LAYER_SRCS px4_qurt_impl.cpp px4_qurt_tasks.cpp lib_crc32.c - ../../posix/px4_layer/drv_hrt.c + ../../../posix/src/px4_layer/drv_hrt.c qurt_stubs.c main.cpp shmem_qurt.c ) + if ("${QURT_ENABLE_STUBS}" STREQUAL "1") list(APPEND QURT_LAYER_SRCS ../stubs/stubs_posix.c @@ -51,9 +52,8 @@ if ("${QURT_ENABLE_STUBS}" STREQUAL "1") ) endif() - px4_add_module( - MODULE platforms__qurt__px4_layer + MODULE platforms_px4_layer COMPILE_FLAGS SRCS ${QURT_LAYER_SRCS} @@ -61,4 +61,3 @@ px4_add_module( DEPENDS platforms__common ) -# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/platforms/qurt/px4_layer/commands_hil.c b/platforms/qurt/src/px4_layer/commands_hil.c similarity index 100% rename from src/platforms/qurt/px4_layer/commands_hil.c rename to platforms/qurt/src/px4_layer/commands_hil.c diff --git a/src/platforms/qurt/px4_layer/drv_hrt.c b/platforms/qurt/src/px4_layer/drv_hrt.c similarity index 100% rename from src/platforms/qurt/px4_layer/drv_hrt.c rename to platforms/qurt/src/px4_layer/drv_hrt.c diff --git a/src/platforms/qurt/px4_layer/get_commands.h b/platforms/qurt/src/px4_layer/get_commands.h similarity index 100% rename from src/platforms/qurt/px4_layer/get_commands.h rename to platforms/qurt/src/px4_layer/get_commands.h diff --git a/src/platforms/qurt/px4_layer/lib_crc32.c b/platforms/qurt/src/px4_layer/lib_crc32.c similarity index 100% rename from src/platforms/qurt/px4_layer/lib_crc32.c rename to platforms/qurt/src/px4_layer/lib_crc32.c diff --git a/src/platforms/qurt/px4_layer/main.cpp b/platforms/qurt/src/px4_layer/main.cpp similarity index 100% rename from src/platforms/qurt/px4_layer/main.cpp rename to platforms/qurt/src/px4_layer/main.cpp diff --git a/src/platforms/qurt/px4_layer/px4_qurt_impl.cpp b/platforms/qurt/src/px4_layer/px4_qurt_impl.cpp similarity index 100% rename from src/platforms/qurt/px4_layer/px4_qurt_impl.cpp rename to platforms/qurt/src/px4_layer/px4_qurt_impl.cpp diff --git a/src/platforms/qurt/px4_layer/px4_qurt_tasks.cpp b/platforms/qurt/src/px4_layer/px4_qurt_tasks.cpp similarity index 100% rename from src/platforms/qurt/px4_layer/px4_qurt_tasks.cpp rename to platforms/qurt/src/px4_layer/px4_qurt_tasks.cpp diff --git a/src/platforms/qurt/px4_layer/qurt_stubs.c b/platforms/qurt/src/px4_layer/qurt_stubs.c similarity index 100% rename from src/platforms/qurt/px4_layer/qurt_stubs.c rename to platforms/qurt/src/px4_layer/qurt_stubs.c diff --git a/src/platforms/qurt/px4_layer/shmem_qurt.c b/platforms/qurt/src/px4_layer/shmem_qurt.c similarity index 100% rename from src/platforms/qurt/px4_layer/shmem_qurt.c rename to platforms/qurt/src/px4_layer/shmem_qurt.c diff --git a/src/drivers/snapdragon_pwm_out/CMakeLists.txt b/src/drivers/snapdragon_pwm_out/CMakeLists.txt index 74b2ba9b84..ed7a2111c7 100644 --- a/src/drivers/snapdragon_pwm_out/CMakeLists.txt +++ b/src/drivers/snapdragon_pwm_out/CMakeLists.txt @@ -38,5 +38,5 @@ px4_add_module( snapdragon_pwm_out.cpp DEPENDS platforms__common + mixer_gen ) -# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/lib/DriverFramework b/src/lib/DriverFramework index 843ad727f2..29f386628a 160000 --- a/src/lib/DriverFramework +++ b/src/lib/DriverFramework @@ -1 +1 @@ -Subproject commit 843ad727f2e9c310563dcd70173d6c859a246c07 +Subproject commit 29f386628af2c9dd6a95cb873d0624c0c0c58381 diff --git a/src/modules/uavcanesc/CMakeLists.txt b/src/modules/uavcanesc/CMakeLists.txt index 695e425d6a..e9e0efff3c 100644 --- a/src/modules/uavcanesc/CMakeLists.txt +++ b/src/modules/uavcanesc/CMakeLists.txt @@ -53,7 +53,7 @@ add_definitions( set(LIBUAVCAN_DIR ${PX4_SOURCE_DIR}/src/modules/uavcan/libuavcan) add_subdirectory(${LIBUAVCAN_DIR} uavcanesc_libuavcan) -add_dependencies(uavcan platforms__nuttx) +add_dependencies(uavcan prebuild_targets) include_directories(${PX4_SOURCE_DIR}/src/modules/systemlib/flashparams) include_directories(${LIBUAVCAN_DIR}/libuavcan/include) diff --git a/src/modules/uavcannode/CMakeLists.txt b/src/modules/uavcannode/CMakeLists.txt index c4fae3be5b..933a23fb80 100644 --- a/src/modules/uavcannode/CMakeLists.txt +++ b/src/modules/uavcannode/CMakeLists.txt @@ -53,7 +53,7 @@ add_definitions( set(LIBUAVCAN_DIR ${PX4_SOURCE_DIR}/src/modules/uavcan/libuavcan) add_subdirectory(${LIBUAVCAN_DIR} uavcannode_libuavcan) -add_dependencies(uavcan platforms__nuttx) +add_dependencies(uavcan prebuild_targets) include_directories(${LIBUAVCAN_DIR}/libuavcan/include) include_directories(${LIBUAVCAN_DIR}/libuavcan/include/dsdlc_generated) @@ -79,7 +79,7 @@ px4_add_module( uavcannode_params.c DEPENDS - platforms__common + prebuild_targets uavcan ) diff --git a/src/platforms/common/CMakeLists.txt b/src/platforms/common/CMakeLists.txt index 837f27bec6..9e061c7285 100644 --- a/src/platforms/common/CMakeLists.txt +++ b/src/platforms/common/CMakeLists.txt @@ -31,15 +31,25 @@ # ############################################################################ +set(SRCS) + +if (NOT "${OS}" MATCHES "qurt") + list(APPEND SRCS + px4_log.c + ) +endif() + px4_add_module( MODULE platforms__common SRCS module.cpp px4_getopt.c shutdown.cpp + ${SRCS} DEPENDS prebuild_targets uorb_headers uorb_msgs ) -# vim: set noet ft=cmake fenc=utf-8 ff=unix : + +add_subdirectory(work_queue) \ No newline at end of file diff --git a/src/platforms/posix/px4_layer/px4_log.c b/src/platforms/common/px4_log.c similarity index 61% rename from src/platforms/posix/px4_layer/px4_log.c rename to src/platforms/common/px4_log.c index cf1599a01f..0e1d50d4ad 100644 --- a/src/platforms/posix/px4_layer/px4_log.c +++ b/src/platforms/common/px4_log.c @@ -1,9 +1,45 @@ +/**************************************************************************** + * + * 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. + * + ****************************************************************************/ + +#include + #include #include -#include + #if defined(__PX4_POSIX) && !defined(__PX4_CYGWIN) #include #endif + #include #include #include @@ -92,7 +128,5 @@ __EXPORT void px4_log_modulename(int level, const char *moduleName, const char * log_message.text[max_length - 1] = 0; //ensure 0-termination orb_publish(ORB_ID(log_message), orb_log_message_pub, &log_message); - } } - diff --git a/src/platforms/posix/work_queue/CMakeLists.txt b/src/platforms/common/work_queue/CMakeLists.txt similarity index 80% rename from src/platforms/posix/work_queue/CMakeLists.txt rename to src/platforms/common/work_queue/CMakeLists.txt index 76d303e4c2..6a6dd1b735 100644 --- a/src/platforms/posix/work_queue/CMakeLists.txt +++ b/src/platforms/common/work_queue/CMakeLists.txt @@ -30,25 +30,28 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ -px4_add_module( - MODULE platforms__posix__work_queue - COMPILE_FLAGS - SRCS - hrt_thread.c - hrt_queue.c - hrt_work_cancel.c - work_thread.c - work_lock.c - work_queue.c - work_cancel.c - queue.c - dq_addlast.c - dq_remfirst.c - sq_addlast.c - sq_remfirst.c - sq_addafter.c - dq_rem.c - DEPENDS - platforms__common - ) -# vim: set noet ft=cmake fenc=utf-8 ff=unix : + +# nuttx uses internal work queue currently +if (NOT "${OS}" MATCHES "nuttx") + px4_add_module( + MODULE platforms__posix__work_queue + COMPILE_FLAGS + SRCS + hrt_thread.c + hrt_queue.c + hrt_work_cancel.c + work_thread.c + work_lock.c + work_queue.c + work_cancel.c + queue.c + dq_addlast.c + dq_remfirst.c + sq_addlast.c + sq_remfirst.c + sq_addafter.c + dq_rem.c + DEPENDS + platforms__common + ) +endif() diff --git a/src/platforms/posix/work_queue/dq_addlast.c b/src/platforms/common/work_queue/dq_addlast.c similarity index 100% rename from src/platforms/posix/work_queue/dq_addlast.c rename to src/platforms/common/work_queue/dq_addlast.c diff --git a/src/platforms/posix/work_queue/dq_rem.c b/src/platforms/common/work_queue/dq_rem.c similarity index 100% rename from src/platforms/posix/work_queue/dq_rem.c rename to src/platforms/common/work_queue/dq_rem.c diff --git a/src/platforms/posix/work_queue/dq_remfirst.c b/src/platforms/common/work_queue/dq_remfirst.c similarity index 100% rename from src/platforms/posix/work_queue/dq_remfirst.c rename to src/platforms/common/work_queue/dq_remfirst.c diff --git a/src/platforms/posix/work_queue/hrt_queue.c b/src/platforms/common/work_queue/hrt_queue.c similarity index 100% rename from src/platforms/posix/work_queue/hrt_queue.c rename to src/platforms/common/work_queue/hrt_queue.c diff --git a/src/platforms/posix/work_queue/hrt_thread.c b/src/platforms/common/work_queue/hrt_thread.c similarity index 100% rename from src/platforms/posix/work_queue/hrt_thread.c rename to src/platforms/common/work_queue/hrt_thread.c diff --git a/src/platforms/posix/work_queue/hrt_work_cancel.c b/src/platforms/common/work_queue/hrt_work_cancel.c similarity index 100% rename from src/platforms/posix/work_queue/hrt_work_cancel.c rename to src/platforms/common/work_queue/hrt_work_cancel.c diff --git a/src/platforms/posix/work_queue/queue.c b/src/platforms/common/work_queue/queue.c similarity index 98% rename from src/platforms/posix/work_queue/queue.c rename to src/platforms/common/work_queue/queue.c index 6f9d5b7bde..1b0d73c990 100644 --- a/src/platforms/posix/work_queue/queue.c +++ b/src/platforms/common/work_queue/queue.c @@ -35,7 +35,7 @@ ************************************************************************/ // FIXME - need px4_queue -#include +#include #include __EXPORT void sq_rem(sq_entry_t *node, sq_queue_t *queue); diff --git a/src/platforms/posix/work_queue/sq_addafter.c b/src/platforms/common/work_queue/sq_addafter.c similarity index 100% rename from src/platforms/posix/work_queue/sq_addafter.c rename to src/platforms/common/work_queue/sq_addafter.c diff --git a/src/platforms/posix/work_queue/sq_addlast.c b/src/platforms/common/work_queue/sq_addlast.c similarity index 100% rename from src/platforms/posix/work_queue/sq_addlast.c rename to src/platforms/common/work_queue/sq_addlast.c diff --git a/src/platforms/posix/work_queue/sq_remfirst.c b/src/platforms/common/work_queue/sq_remfirst.c similarity index 100% rename from src/platforms/posix/work_queue/sq_remfirst.c rename to src/platforms/common/work_queue/sq_remfirst.c diff --git a/src/platforms/posix/work_queue/work_cancel.c b/src/platforms/common/work_queue/work_cancel.c similarity index 100% rename from src/platforms/posix/work_queue/work_cancel.c rename to src/platforms/common/work_queue/work_cancel.c diff --git a/src/platforms/posix/work_queue/work_lock.c b/src/platforms/common/work_queue/work_lock.c similarity index 100% rename from src/platforms/posix/work_queue/work_lock.c rename to src/platforms/common/work_queue/work_lock.c diff --git a/src/platforms/posix/work_queue/work_lock.h b/src/platforms/common/work_queue/work_lock.h similarity index 100% rename from src/platforms/posix/work_queue/work_lock.h rename to src/platforms/common/work_queue/work_lock.h diff --git a/src/platforms/posix/work_queue/work_queue.c b/src/platforms/common/work_queue/work_queue.c similarity index 100% rename from src/platforms/posix/work_queue/work_queue.c rename to src/platforms/common/work_queue/work_queue.c diff --git a/src/platforms/posix/work_queue/work_thread.c b/src/platforms/common/work_queue/work_thread.c similarity index 100% rename from src/platforms/posix/work_queue/work_thread.c rename to src/platforms/common/work_queue/work_thread.c diff --git a/src/platforms/posix/tests/wqueue/CMakeLists.txt b/src/platforms/common/work_queue/wqueue_test/CMakeLists.txt similarity index 100% rename from src/platforms/posix/tests/wqueue/CMakeLists.txt rename to src/platforms/common/work_queue/wqueue_test/CMakeLists.txt diff --git a/src/platforms/posix/tests/wqueue/wqueue_main.cpp b/src/platforms/common/work_queue/wqueue_test/wqueue_main.cpp similarity index 99% rename from src/platforms/posix/tests/wqueue/wqueue_main.cpp rename to src/platforms/common/work_queue/wqueue_test/wqueue_main.cpp index 8dd5cc9707..9f693c62a9 100644 --- a/src/platforms/posix/tests/wqueue/wqueue_main.cpp +++ b/src/platforms/common/work_queue/wqueue_test/wqueue_main.cpp @@ -37,10 +37,11 @@ * * @author Mark Charlebois */ +#include "wqueue_test.h" + #include #include #include -#include "wqueue_test.h" #include int PX4_MAIN(int argc, char **argv) diff --git a/src/platforms/posix/tests/wqueue/wqueue_start_posix.cpp b/src/platforms/common/work_queue/wqueue_test/wqueue_start_posix.cpp similarity index 99% rename from src/platforms/posix/tests/wqueue/wqueue_start_posix.cpp rename to src/platforms/common/work_queue/wqueue_test/wqueue_start_posix.cpp index 126a57fbc9..d428e67ba7 100644 --- a/src/platforms/posix/tests/wqueue/wqueue_start_posix.cpp +++ b/src/platforms/common/work_queue/wqueue_test/wqueue_start_posix.cpp @@ -38,6 +38,7 @@ * @author Mark Charlebois */ #include "wqueue_test.h" + #include #include #include diff --git a/src/platforms/posix/tests/wqueue/wqueue_test.cpp b/src/platforms/common/work_queue/wqueue_test/wqueue_test.cpp similarity index 99% rename from src/platforms/posix/tests/wqueue/wqueue_test.cpp rename to src/platforms/common/work_queue/wqueue_test/wqueue_test.cpp index aec10269b8..6f1ec62b2c 100644 --- a/src/platforms/posix/tests/wqueue/wqueue_test.cpp +++ b/src/platforms/common/work_queue/wqueue_test/wqueue_test.cpp @@ -39,9 +39,10 @@ * @author Mark Charlebois */ +#include "wqueue_test.h" + #include #include -#include "wqueue_test.h" #include #include diff --git a/src/platforms/posix/tests/wqueue/wqueue_test.h b/src/platforms/common/work_queue/wqueue_test/wqueue_test.h similarity index 100% rename from src/platforms/posix/tests/wqueue/wqueue_test.h rename to src/platforms/common/work_queue/wqueue_test/wqueue_test.h diff --git a/src/platforms/px4_tasks.h b/src/platforms/px4_tasks.h index 104593735b..e2e9d5f7a3 100644 --- a/src/platforms/px4_tasks.h +++ b/src/platforms/px4_tasks.h @@ -64,19 +64,25 @@ typedef int px4_task_t; #define px4_task_exit(x) _exit(x) #elif defined(__PX4_POSIX) || defined(__PX4_QURT) + #include #include /** Default scheduler type */ #define SCHED_DEFAULT SCHED_FIFO + #if defined(__PX4_LINUX) || defined(__PX4_DARWIN) || defined(__PX4_CYGWIN) + #define SCHED_PRIORITY_MAX sched_get_priority_max(SCHED_FIFO) #define SCHED_PRIORITY_MIN sched_get_priority_min(SCHED_FIFO) #define SCHED_PRIORITY_DEFAULT (((sched_get_priority_max(SCHED_FIFO) - sched_get_priority_min(SCHED_FIFO)) / 2) + sched_get_priority_min(SCHED_FIFO)) + #elif defined(__PX4_QURT) + #define SCHED_PRIORITY_MAX 255 #define SCHED_PRIORITY_MIN 0 #define SCHED_PRIORITY_DEFAULT 20 + #else #error "No target OS defined" #endif @@ -93,6 +99,7 @@ typedef struct { int argc; char **argv; } px4_task_args_t; + #else #error "No target OS defined" #endif