From fa8165a1c3d82c4efaae85e2262fb625443da0f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Tue, 27 Aug 2019 10:07:14 +0200 Subject: [PATCH] platforms/posix/src: move to platforms/posix/src/px4/common --- platforms/posix/CMakeLists.txt | 6 +- platforms/posix/cmake/px4_impl_os.cmake | 2 +- platforms/posix/src/CMakeLists.txt | 38 ----------- platforms/posix/src/px4/common/CMakeLists.txt | 41 ++++++++++- .../src/{px4_layer => px4/common}/drv_hrt.cpp | 0 .../src/{px4_layer => px4/common}/lib_crc32.c | 0 .../common}/lockstep_scheduler/.gitignore | 0 .../common}/lockstep_scheduler/CMakeLists.txt | 0 .../lockstep_scheduler/build-and-test.sh | 0 .../lockstep_scheduler/lockstep_scheduler.h | 0 .../src/lockstep_scheduler.cpp | 0 .../lockstep_scheduler/test/CMakeLists.txt | 0 .../test/src/lockstep_scheduler_test.cpp | 0 platforms/posix/src/{ => px4/common}/main.cpp | 0 .../src/{ => px4/common}/px4-alias.sh_in | 0 .../common}/px4_daemon/CMakeLists.txt | 0 .../{ => px4/common}/px4_daemon/client.cpp | 0 .../src/{ => px4/common}/px4_daemon/client.h | 0 .../{ => px4/common}/px4_daemon/history.cpp | 0 .../src/{ => px4/common}/px4_daemon/history.h | 0 .../src/{ => px4/common}/px4_daemon/pxh.cpp | 0 .../src/{ => px4/common}/px4_daemon/pxh.h | 0 .../{ => px4/common}/px4_daemon/server.cpp | 0 .../src/{ => px4/common}/px4_daemon/server.h | 0 .../{ => px4/common}/px4_daemon/server_io.cpp | 0 .../common}/px4_daemon/sock_protocol.cpp | 0 .../common}/px4_daemon/sock_protocol.h | 0 .../{px4_layer => px4/common}/px4_init.cpp | 0 .../common}/px4_posix_impl.cpp | 0 .../common}/px4_posix_tasks.cpp | 0 .../src/{px4_layer => px4/common}/px4_sem.cpp | 0 .../{px4_layer => px4/common}/shmem_posix.cpp | 0 platforms/posix/src/px4_layer/CMakeLists.txt | 68 ------------------- 33 files changed, 43 insertions(+), 112 deletions(-) delete mode 100644 platforms/posix/src/CMakeLists.txt rename platforms/posix/src/{px4_layer => px4/common}/drv_hrt.cpp (100%) rename platforms/posix/src/{px4_layer => px4/common}/lib_crc32.c (100%) rename platforms/posix/src/{ => px4/common}/lockstep_scheduler/.gitignore (100%) rename platforms/posix/src/{ => px4/common}/lockstep_scheduler/CMakeLists.txt (100%) rename platforms/posix/src/{ => px4/common}/lockstep_scheduler/build-and-test.sh (100%) rename platforms/posix/src/{ => px4/common}/lockstep_scheduler/include/lockstep_scheduler/lockstep_scheduler.h (100%) rename platforms/posix/src/{ => px4/common}/lockstep_scheduler/src/lockstep_scheduler.cpp (100%) rename platforms/posix/src/{ => px4/common}/lockstep_scheduler/test/CMakeLists.txt (100%) rename platforms/posix/src/{ => px4/common}/lockstep_scheduler/test/src/lockstep_scheduler_test.cpp (100%) rename platforms/posix/src/{ => px4/common}/main.cpp (100%) rename platforms/posix/src/{ => px4/common}/px4-alias.sh_in (100%) rename platforms/posix/src/{ => px4/common}/px4_daemon/CMakeLists.txt (100%) rename platforms/posix/src/{ => px4/common}/px4_daemon/client.cpp (100%) rename platforms/posix/src/{ => px4/common}/px4_daemon/client.h (100%) rename platforms/posix/src/{ => px4/common}/px4_daemon/history.cpp (100%) rename platforms/posix/src/{ => px4/common}/px4_daemon/history.h (100%) rename platforms/posix/src/{ => px4/common}/px4_daemon/pxh.cpp (100%) rename platforms/posix/src/{ => px4/common}/px4_daemon/pxh.h (100%) rename platforms/posix/src/{ => px4/common}/px4_daemon/server.cpp (100%) rename platforms/posix/src/{ => px4/common}/px4_daemon/server.h (100%) rename platforms/posix/src/{ => px4/common}/px4_daemon/server_io.cpp (100%) rename platforms/posix/src/{ => px4/common}/px4_daemon/sock_protocol.cpp (100%) rename platforms/posix/src/{ => px4/common}/px4_daemon/sock_protocol.h (100%) rename platforms/posix/src/{px4_layer => px4/common}/px4_init.cpp (100%) rename platforms/posix/src/{px4_layer => px4/common}/px4_posix_impl.cpp (100%) rename platforms/posix/src/{px4_layer => px4/common}/px4_posix_tasks.cpp (100%) rename platforms/posix/src/{px4_layer => px4/common}/px4_sem.cpp (100%) rename platforms/posix/src/{px4_layer => px4/common}/shmem_posix.cpp (100%) delete mode 100644 platforms/posix/src/px4_layer/CMakeLists.txt diff --git a/platforms/posix/CMakeLists.txt b/platforms/posix/CMakeLists.txt index 3ba23f6123ea..131bbb305c4d 100644 --- a/platforms/posix/CMakeLists.txt +++ b/platforms/posix/CMakeLists.txt @@ -1,6 +1,4 @@ -add_subdirectory(src) - include_directories(${CMAKE_CURRENT_BINARY_DIR}) get_property(module_libraries GLOBAL PROPERTY PX4_MODULE_LIBRARIES) @@ -37,7 +35,7 @@ if (("${PX4_BOARD}" MATCHES "atlflight_eagle") OR ("${PX4_BOARD}" MATCHES "atlfl APPS_DEST "/home/linaro" SOURCES px4muorb_stub.c - src/main.cpp + src/px4/common/main.cpp apps.cpp LINK_LIBS -Wl,--start-group @@ -52,7 +50,7 @@ if (("${PX4_BOARD}" MATCHES "atlflight_eagle") OR ("${PX4_BOARD}" MATCHES "atlfl else() add_executable(px4 - src/main.cpp + src/px4/common/main.cpp apps.cpp ) diff --git a/platforms/posix/cmake/px4_impl_os.cmake b/platforms/posix/cmake/px4_impl_os.cmake index ed650df2a885..08437bda7734 100644 --- a/platforms/posix/cmake/px4_impl_os.cmake +++ b/platforms/posix/cmake/px4_impl_os.cmake @@ -150,7 +150,7 @@ function(px4_posix_generate_alias) ) endif() endforeach() - configure_file(${PX4_SOURCE_DIR}/platforms/posix/src/px4-alias.sh_in ${OUT}) + configure_file(${PX4_SOURCE_DIR}/platforms/posix/src/px4/common/px4-alias.sh_in ${OUT}) endfunction() diff --git a/platforms/posix/src/CMakeLists.txt b/platforms/posix/src/CMakeLists.txt deleted file mode 100644 index c46e436e8e7b..000000000000 --- a/platforms/posix/src/CMakeLists.txt +++ /dev/null @@ -1,38 +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. -# -############################################################################ - - -add_subdirectory(px4_daemon) -add_subdirectory(px4_layer) - -add_subdirectory(lockstep_scheduler) diff --git a/platforms/posix/src/px4/common/CMakeLists.txt b/platforms/posix/src/px4/common/CMakeLists.txt index ae8401900e86..e3ab861cf680 100644 --- a/platforms/posix/src/px4/common/CMakeLists.txt +++ b/platforms/posix/src/px4/common/CMakeLists.txt @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (c) 2019 PX4 Development Team. All rights reserved. +# Copyright (c) 2015 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 @@ -31,3 +31,42 @@ # ############################################################################ + +add_subdirectory(px4_daemon) +add_subdirectory(lockstep_scheduler) + +set(EXTRA_DEPENDS) +if("${CONFIG_SHMEM}" STREQUAL "1") + list(APPEND CMAKE_MODULE_PATH "${PX4_SOURCE_DIR}/boards/atlflight/cmake_hexagon") + include(hexagon_sdk) + include_directories(${HEXAGON_SDK_INCLUDES}) + include_directories(${PX4_BINARY_DIR}/platforms/posix) + list(APPEND SHMEM_SRCS + shmem_posix.cpp + ) + add_definitions(-DCONFIG_SHMEM=1) + set(EXTRA_DEPENDS generate_px4muorb_stubs) +endif() + +add_library(px4_layer + px4_posix_impl.cpp + px4_posix_tasks.cpp + px4_sem.cpp + px4_init.cpp + lib_crc32.c + drv_hrt.cpp + ${SHMEM_SRCS} +) +target_compile_definitions(px4_layer PRIVATE MODULE_NAME="px4") +target_compile_options(px4_layer PRIVATE -Wno-cast-align) # TODO: fix and enable +target_link_libraries(px4_layer PRIVATE work_queue px4_work_queue) +target_link_libraries(px4_layer PRIVATE px4_daemon drivers_board) + +if(ENABLE_LOCKSTEP_SCHEDULER) + target_link_libraries(px4_layer PRIVATE lockstep_scheduler) +endif() + + +if (EXTRA_DEPENDS) + add_dependencies(px4_layer ${EXTRA_DEPENDS}) +endif() diff --git a/platforms/posix/src/px4_layer/drv_hrt.cpp b/platforms/posix/src/px4/common/drv_hrt.cpp similarity index 100% rename from platforms/posix/src/px4_layer/drv_hrt.cpp rename to platforms/posix/src/px4/common/drv_hrt.cpp diff --git a/platforms/posix/src/px4_layer/lib_crc32.c b/platforms/posix/src/px4/common/lib_crc32.c similarity index 100% rename from platforms/posix/src/px4_layer/lib_crc32.c rename to platforms/posix/src/px4/common/lib_crc32.c diff --git a/platforms/posix/src/lockstep_scheduler/.gitignore b/platforms/posix/src/px4/common/lockstep_scheduler/.gitignore similarity index 100% rename from platforms/posix/src/lockstep_scheduler/.gitignore rename to platforms/posix/src/px4/common/lockstep_scheduler/.gitignore diff --git a/platforms/posix/src/lockstep_scheduler/CMakeLists.txt b/platforms/posix/src/px4/common/lockstep_scheduler/CMakeLists.txt similarity index 100% rename from platforms/posix/src/lockstep_scheduler/CMakeLists.txt rename to platforms/posix/src/px4/common/lockstep_scheduler/CMakeLists.txt diff --git a/platforms/posix/src/lockstep_scheduler/build-and-test.sh b/platforms/posix/src/px4/common/lockstep_scheduler/build-and-test.sh similarity index 100% rename from platforms/posix/src/lockstep_scheduler/build-and-test.sh rename to platforms/posix/src/px4/common/lockstep_scheduler/build-and-test.sh diff --git a/platforms/posix/src/lockstep_scheduler/include/lockstep_scheduler/lockstep_scheduler.h b/platforms/posix/src/px4/common/lockstep_scheduler/include/lockstep_scheduler/lockstep_scheduler.h similarity index 100% rename from platforms/posix/src/lockstep_scheduler/include/lockstep_scheduler/lockstep_scheduler.h rename to platforms/posix/src/px4/common/lockstep_scheduler/include/lockstep_scheduler/lockstep_scheduler.h diff --git a/platforms/posix/src/lockstep_scheduler/src/lockstep_scheduler.cpp b/platforms/posix/src/px4/common/lockstep_scheduler/src/lockstep_scheduler.cpp similarity index 100% rename from platforms/posix/src/lockstep_scheduler/src/lockstep_scheduler.cpp rename to platforms/posix/src/px4/common/lockstep_scheduler/src/lockstep_scheduler.cpp diff --git a/platforms/posix/src/lockstep_scheduler/test/CMakeLists.txt b/platforms/posix/src/px4/common/lockstep_scheduler/test/CMakeLists.txt similarity index 100% rename from platforms/posix/src/lockstep_scheduler/test/CMakeLists.txt rename to platforms/posix/src/px4/common/lockstep_scheduler/test/CMakeLists.txt diff --git a/platforms/posix/src/lockstep_scheduler/test/src/lockstep_scheduler_test.cpp b/platforms/posix/src/px4/common/lockstep_scheduler/test/src/lockstep_scheduler_test.cpp similarity index 100% rename from platforms/posix/src/lockstep_scheduler/test/src/lockstep_scheduler_test.cpp rename to platforms/posix/src/px4/common/lockstep_scheduler/test/src/lockstep_scheduler_test.cpp diff --git a/platforms/posix/src/main.cpp b/platforms/posix/src/px4/common/main.cpp similarity index 100% rename from platforms/posix/src/main.cpp rename to platforms/posix/src/px4/common/main.cpp diff --git a/platforms/posix/src/px4-alias.sh_in b/platforms/posix/src/px4/common/px4-alias.sh_in similarity index 100% rename from platforms/posix/src/px4-alias.sh_in rename to platforms/posix/src/px4/common/px4-alias.sh_in diff --git a/platforms/posix/src/px4_daemon/CMakeLists.txt b/platforms/posix/src/px4/common/px4_daemon/CMakeLists.txt similarity index 100% rename from platforms/posix/src/px4_daemon/CMakeLists.txt rename to platforms/posix/src/px4/common/px4_daemon/CMakeLists.txt diff --git a/platforms/posix/src/px4_daemon/client.cpp b/platforms/posix/src/px4/common/px4_daemon/client.cpp similarity index 100% rename from platforms/posix/src/px4_daemon/client.cpp rename to platforms/posix/src/px4/common/px4_daemon/client.cpp diff --git a/platforms/posix/src/px4_daemon/client.h b/platforms/posix/src/px4/common/px4_daemon/client.h similarity index 100% rename from platforms/posix/src/px4_daemon/client.h rename to platforms/posix/src/px4/common/px4_daemon/client.h diff --git a/platforms/posix/src/px4_daemon/history.cpp b/platforms/posix/src/px4/common/px4_daemon/history.cpp similarity index 100% rename from platforms/posix/src/px4_daemon/history.cpp rename to platforms/posix/src/px4/common/px4_daemon/history.cpp diff --git a/platforms/posix/src/px4_daemon/history.h b/platforms/posix/src/px4/common/px4_daemon/history.h similarity index 100% rename from platforms/posix/src/px4_daemon/history.h rename to platforms/posix/src/px4/common/px4_daemon/history.h diff --git a/platforms/posix/src/px4_daemon/pxh.cpp b/platforms/posix/src/px4/common/px4_daemon/pxh.cpp similarity index 100% rename from platforms/posix/src/px4_daemon/pxh.cpp rename to platforms/posix/src/px4/common/px4_daemon/pxh.cpp diff --git a/platforms/posix/src/px4_daemon/pxh.h b/platforms/posix/src/px4/common/px4_daemon/pxh.h similarity index 100% rename from platforms/posix/src/px4_daemon/pxh.h rename to platforms/posix/src/px4/common/px4_daemon/pxh.h diff --git a/platforms/posix/src/px4_daemon/server.cpp b/platforms/posix/src/px4/common/px4_daemon/server.cpp similarity index 100% rename from platforms/posix/src/px4_daemon/server.cpp rename to platforms/posix/src/px4/common/px4_daemon/server.cpp diff --git a/platforms/posix/src/px4_daemon/server.h b/platforms/posix/src/px4/common/px4_daemon/server.h similarity index 100% rename from platforms/posix/src/px4_daemon/server.h rename to platforms/posix/src/px4/common/px4_daemon/server.h diff --git a/platforms/posix/src/px4_daemon/server_io.cpp b/platforms/posix/src/px4/common/px4_daemon/server_io.cpp similarity index 100% rename from platforms/posix/src/px4_daemon/server_io.cpp rename to platforms/posix/src/px4/common/px4_daemon/server_io.cpp diff --git a/platforms/posix/src/px4_daemon/sock_protocol.cpp b/platforms/posix/src/px4/common/px4_daemon/sock_protocol.cpp similarity index 100% rename from platforms/posix/src/px4_daemon/sock_protocol.cpp rename to platforms/posix/src/px4/common/px4_daemon/sock_protocol.cpp diff --git a/platforms/posix/src/px4_daemon/sock_protocol.h b/platforms/posix/src/px4/common/px4_daemon/sock_protocol.h similarity index 100% rename from platforms/posix/src/px4_daemon/sock_protocol.h rename to platforms/posix/src/px4/common/px4_daemon/sock_protocol.h diff --git a/platforms/posix/src/px4_layer/px4_init.cpp b/platforms/posix/src/px4/common/px4_init.cpp similarity index 100% rename from platforms/posix/src/px4_layer/px4_init.cpp rename to platforms/posix/src/px4/common/px4_init.cpp diff --git a/platforms/posix/src/px4_layer/px4_posix_impl.cpp b/platforms/posix/src/px4/common/px4_posix_impl.cpp similarity index 100% rename from platforms/posix/src/px4_layer/px4_posix_impl.cpp rename to platforms/posix/src/px4/common/px4_posix_impl.cpp diff --git a/platforms/posix/src/px4_layer/px4_posix_tasks.cpp b/platforms/posix/src/px4/common/px4_posix_tasks.cpp similarity index 100% rename from platforms/posix/src/px4_layer/px4_posix_tasks.cpp rename to platforms/posix/src/px4/common/px4_posix_tasks.cpp diff --git a/platforms/posix/src/px4_layer/px4_sem.cpp b/platforms/posix/src/px4/common/px4_sem.cpp similarity index 100% rename from platforms/posix/src/px4_layer/px4_sem.cpp rename to platforms/posix/src/px4/common/px4_sem.cpp diff --git a/platforms/posix/src/px4_layer/shmem_posix.cpp b/platforms/posix/src/px4/common/shmem_posix.cpp similarity index 100% rename from platforms/posix/src/px4_layer/shmem_posix.cpp rename to platforms/posix/src/px4/common/shmem_posix.cpp diff --git a/platforms/posix/src/px4_layer/CMakeLists.txt b/platforms/posix/src/px4_layer/CMakeLists.txt deleted file mode 100644 index a7024ce972e2..000000000000 --- a/platforms/posix/src/px4_layer/CMakeLists.txt +++ /dev/null @@ -1,68 +0,0 @@ -############################################################################ -# -# Copyright (c) 2015 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. -# -############################################################################ - -set(EXTRA_DEPENDS) -if("${CONFIG_SHMEM}" STREQUAL "1") - list(APPEND CMAKE_MODULE_PATH "${PX4_SOURCE_DIR}/boards/atlflight/cmake_hexagon") - include(hexagon_sdk) - include_directories(${HEXAGON_SDK_INCLUDES}) - include_directories(${PX4_BINARY_DIR}/platforms/posix) - list(APPEND SHMEM_SRCS - shmem_posix.cpp - ) - add_definitions(-DCONFIG_SHMEM=1) - set(EXTRA_DEPENDS generate_px4muorb_stubs) -endif() - -add_library(px4_layer - px4_posix_impl.cpp - px4_posix_tasks.cpp - px4_sem.cpp - px4_init.cpp - lib_crc32.c - drv_hrt.cpp - ${SHMEM_SRCS} -) -target_compile_definitions(px4_layer PRIVATE MODULE_NAME="px4") -target_compile_options(px4_layer PRIVATE -Wno-cast-align) # TODO: fix and enable -target_link_libraries(px4_layer PRIVATE work_queue px4_work_queue) -target_link_libraries(px4_layer PRIVATE px4_daemon drivers_board) - -if(ENABLE_LOCKSTEP_SCHEDULER) - target_link_libraries(px4_layer PRIVATE lockstep_scheduler) -endif() - - -if (EXTRA_DEPENDS) - add_dependencies(px4_layer ${EXTRA_DEPENDS}) -endif()