diff --git a/platforms/nuttx/CMakeLists.txt b/platforms/nuttx/CMakeLists.txt index 5af9eee16f..7830199188 100644 --- a/platforms/nuttx/CMakeLists.txt +++ b/platforms/nuttx/CMakeLists.txt @@ -79,7 +79,6 @@ target_link_libraries(nuttx_arch INTERFACE drivers_board drivers_boards_common - drivers_boards_common_arch arch_hrt ) @@ -102,7 +101,6 @@ target_link_libraries(px4 PRIVATE -Wl,--gc-sections -Wl,--start-group - drivers_boards_common_arch ${nuttx_libs} -Wl,--end-group diff --git a/platforms/nuttx/src/px4/common/CMakeLists.txt b/platforms/nuttx/src/px4/common/CMakeLists.txt index 2c37ee6a84..9e12110814 100644 --- a/platforms/nuttx/src/px4/common/CMakeLists.txt +++ b/platforms/nuttx/src/px4/common/CMakeLists.txt @@ -43,10 +43,11 @@ if (NOT ${PX4_BOARD} MATCHES "px4_io") ) target_link_libraries(px4_layer PRIVATE + arch_board_reset + arch_board_critmon arch_version nuttx_apps # up_cxxinitialize nuttx_sched - drivers_boards_common_arch px4_work_queue ) else() diff --git a/platforms/nuttx/src/px4/nxp/k66/CMakeLists.txt b/platforms/nuttx/src/px4/nxp/k66/CMakeLists.txt index 638cb798e9..2b96e342f8 100644 --- a/platforms/nuttx/src/px4/nxp/k66/CMakeLists.txt +++ b/platforms/nuttx/src/px4/nxp/k66/CMakeLists.txt @@ -33,6 +33,8 @@ add_subdirectory(../kinetis/adc adc) +add_subdirectory(../kinetis/board_reset board_reset) +add_subdirectory(../kinetis/board_critmon board_critmon) add_subdirectory(../kinetis/led_pwm led_pwm) add_subdirectory(../kinetis/hrt hrt) add_subdirectory(../kinetis/io_pins io_pins) diff --git a/src/drivers/boards/common/stm32/CMakeLists.txt b/platforms/nuttx/src/px4/nxp/kinetis/board_critmon/CMakeLists.txt similarity index 82% rename from src/drivers/boards/common/stm32/CMakeLists.txt rename to platforms/nuttx/src/px4/nxp/kinetis/board_critmon/CMakeLists.txt index e0343acb39..26cdb4bbc2 100644 --- a/src/drivers/boards/common/stm32/CMakeLists.txt +++ b/platforms/nuttx/src/px4/nxp/kinetis/board_critmon/CMakeLists.txt @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (c) 2017 PX4 Development Team. All rights reserved. +# Copyright (c) 2019 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,10 +31,6 @@ # ############################################################################ -add_library(drivers_boards_common_arch - board_reset.c +px4_add_library(arch_board_critmon board_critmon.c ) -add_dependencies(drivers_boards_common_arch prebuild_targets) -target_compile_options(drivers_boards_common_arch PRIVATE -Wno-cast-align) # TODO: fix and enable -target_link_libraries(drivers_boards_common_arch PRIVATE nuttx_arch) diff --git a/platforms/nuttx/src/px4/nxp/kinetis/board_critmon/board_critmon.c b/platforms/nuttx/src/px4/nxp/kinetis/board_critmon/board_critmon.c new file mode 100644 index 0000000000..14e7a3bb3b --- /dev/null +++ b/platforms/nuttx/src/px4/nxp/kinetis/board_critmon/board_critmon.c @@ -0,0 +1,66 @@ +/************************************************************************************ + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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 NuttX 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. + * + ************************************************************************************/ + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include +#include + +#if defined(CONFIG_SCHED_CRITMONITOR) || defined(CONFIG_SCHED_IRQMONITOR) + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#error "missing implementation for up_critmon_gettime() and up_critmon_convert()" + +/************************************************************************************ + * Name: up_critmon_gettime + ************************************************************************************/ + +// uint32_t up_critmon_gettime(void) +// { +// } + +/************************************************************************************ + * Name: up_critmon_convert + ************************************************************************************/ + +// void up_critmon_convert(uint32_t elapsed, FAR struct timespec *ts) +// { +// } + +#endif /* CONFIG_SCHED_CRITMONITOR */ diff --git a/src/drivers/boards/common/kinetis/CMakeLists.txt b/platforms/nuttx/src/px4/nxp/kinetis/board_reset/CMakeLists.txt similarity index 83% rename from src/drivers/boards/common/kinetis/CMakeLists.txt rename to platforms/nuttx/src/px4/nxp/kinetis/board_reset/CMakeLists.txt index 301ecd1243..e818a47336 100644 --- a/src/drivers/boards/common/kinetis/CMakeLists.txt +++ b/platforms/nuttx/src/px4/nxp/kinetis/board_reset/CMakeLists.txt @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (c) 2017 PX4 Development Team. All rights reserved. +# Copyright (c) 2019 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,9 +31,6 @@ # ############################################################################ -add_library(drivers_boards_common_arch +px4_add_library(arch_board_reset board_reset.c - ) -add_dependencies(drivers_boards_common_arch prebuild_targets) -target_compile_options(drivers_boards_common_arch PRIVATE -Wno-cast-align) # TODO: fix and enable -target_link_libraries(drivers_boards_common_arch PRIVATE nuttx_arch) +) diff --git a/src/drivers/boards/common/kinetis/board_reset.c b/platforms/nuttx/src/px4/nxp/kinetis/board_reset/board_reset.c similarity index 100% rename from src/drivers/boards/common/kinetis/board_reset.c rename to platforms/nuttx/src/px4/nxp/kinetis/board_reset/board_reset.c diff --git a/platforms/nuttx/src/px4/stm/stm32_common/board_critmon/CMakeLists.txt b/platforms/nuttx/src/px4/stm/stm32_common/board_critmon/CMakeLists.txt new file mode 100644 index 0000000000..26cdb4bbc2 --- /dev/null +++ b/platforms/nuttx/src/px4/stm/stm32_common/board_critmon/CMakeLists.txt @@ -0,0 +1,36 @@ +############################################################################ +# +# Copyright (c) 2019 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. +# +############################################################################ + +px4_add_library(arch_board_critmon + board_critmon.c +) diff --git a/src/drivers/boards/common/stm32/board_critmon.c b/platforms/nuttx/src/px4/stm/stm32_common/board_critmon/board_critmon.c similarity index 99% rename from src/drivers/boards/common/stm32/board_critmon.c rename to platforms/nuttx/src/px4/stm/stm32_common/board_critmon/board_critmon.c index 590b37a502..e57031d94d 100644 --- a/src/drivers/boards/common/stm32/board_critmon.c +++ b/platforms/nuttx/src/px4/stm/stm32_common/board_critmon/board_critmon.c @@ -64,7 +64,7 @@ uint32_t up_critmon_gettime(void) } /************************************************************************************ - * Name: up_critmon_gettime + * Name: up_critmon_convert ************************************************************************************/ void up_critmon_convert(uint32_t elapsed, FAR struct timespec *ts) diff --git a/platforms/nuttx/src/px4/stm/stm32_common/board_reset/CMakeLists.txt b/platforms/nuttx/src/px4/stm/stm32_common/board_reset/CMakeLists.txt new file mode 100644 index 0000000000..e818a47336 --- /dev/null +++ b/platforms/nuttx/src/px4/stm/stm32_common/board_reset/CMakeLists.txt @@ -0,0 +1,36 @@ +############################################################################ +# +# Copyright (c) 2019 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. +# +############################################################################ + +px4_add_library(arch_board_reset + board_reset.c +) diff --git a/src/drivers/boards/common/stm32/board_reset.c b/platforms/nuttx/src/px4/stm/stm32_common/board_reset/board_reset.c similarity index 100% rename from src/drivers/boards/common/stm32/board_reset.c rename to platforms/nuttx/src/px4/stm/stm32_common/board_reset/board_reset.c diff --git a/platforms/nuttx/src/px4/stm/stm32f4/CMakeLists.txt b/platforms/nuttx/src/px4/stm/stm32f4/CMakeLists.txt index 88b3ebd935..f783ddde20 100644 --- a/platforms/nuttx/src/px4/stm/stm32f4/CMakeLists.txt +++ b/platforms/nuttx/src/px4/stm/stm32f4/CMakeLists.txt @@ -33,6 +33,8 @@ add_subdirectory(../stm32_common/adc adc) +add_subdirectory(../stm32_common/board_critmon board_critmon) +add_subdirectory(../stm32_common/board_reset board_reset) add_subdirectory(../stm32_common/dshot dshot) add_subdirectory(../stm32_common/hrt hrt) add_subdirectory(../stm32_common/led_pwm led_pwm) diff --git a/platforms/nuttx/src/px4/stm/stm32f7/CMakeLists.txt b/platforms/nuttx/src/px4/stm/stm32f7/CMakeLists.txt index 282db7a0c8..14f071bb48 100644 --- a/platforms/nuttx/src/px4/stm/stm32f7/CMakeLists.txt +++ b/platforms/nuttx/src/px4/stm/stm32f7/CMakeLists.txt @@ -33,7 +33,9 @@ add_subdirectory(../stm32_common/adc adc) +add_subdirectory(../stm32_common/board_critmon board_critmon) add_subdirectory(../stm32_common/board_hw_info board_hw_info) +add_subdirectory(../stm32_common/board_reset board_reset) add_subdirectory(../stm32_common/dshot dshot) add_subdirectory(../stm32_common/hrt hrt) add_subdirectory(../stm32_common/led_pwm led_pwm) diff --git a/src/drivers/boards/common/CMakeLists.txt b/src/drivers/boards/common/CMakeLists.txt index ec690dd036..907d0d327d 100644 --- a/src/drivers/boards/common/CMakeLists.txt +++ b/src/drivers/boards/common/CMakeLists.txt @@ -40,15 +40,8 @@ if ((${PX4_PLATFORM} MATCHES "nuttx") AND NOT ${PX4_BOARD} MATCHES "px4_io") board_fat_dma_alloc.c ) - if (${CONFIG_ARCH_CHIP} MATCHES "kinetis") - add_subdirectory(kinetis) - elseif (${CONFIG_ARCH_CHIP} MATCHES "stm32") - add_subdirectory(stm32) - endif() - target_link_libraries(drivers_boards_common PRIVATE - drivers_boards_common_arch nuttx_arch # bbsram nuttx_mm # dma gran alloc systemlib @@ -56,5 +49,4 @@ if ((${PX4_PLATFORM} MATCHES "nuttx") AND NOT ${PX4_BOARD} MATCHES "px4_io") else() add_library(drivers_boards_common INTERFACE) - add_library(drivers_boards_common_arch INTERFACE) endif()