mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 07:33:34 +08:00
cmake remove circular linking and reorganize
- px4_add_module now requires MAIN - px4_add_library doesn't automatically link
This commit is contained in:
@@ -39,3 +39,11 @@ px4_add_library(drivers_board
|
||||
timer_config.c
|
||||
usb.c
|
||||
)
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
drivers__led # drv_led_start
|
||||
nuttx_apps # up_cxxinitialize
|
||||
nuttx_arch # sdio
|
||||
nuttx_drivers # sdio
|
||||
parameters # param_init
|
||||
)
|
||||
|
||||
@@ -69,10 +69,10 @@
|
||||
#include <drivers/drv_board_led.h>
|
||||
|
||||
#include <systemlib/cpuload.h>
|
||||
#include <systemlib/perf_counter.h>
|
||||
#include <perf/perf_counter.h>
|
||||
#include <systemlib/err.h>
|
||||
|
||||
#include <systemlib/param/param.h>
|
||||
#include <parameters/param.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
|
||||
@@ -38,3 +38,10 @@ px4_add_library(drivers_board
|
||||
spi.c
|
||||
timer_config.c
|
||||
)
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
drivers__led # drv_led_start
|
||||
nuttx_apps # up_cxxinitialize
|
||||
parameters # param_init
|
||||
modules__dataman # dm_flash_sector_description_set
|
||||
)
|
||||
|
||||
@@ -74,10 +74,10 @@
|
||||
#include <systemlib/err.h>
|
||||
#include <systemlib/hardfault_log.h>
|
||||
#include <systemlib/systemlib.h>
|
||||
#include <systemlib/param/param.h>
|
||||
#include <parameters/param.h>
|
||||
|
||||
# if defined(FLASH_BASED_PARAMS)
|
||||
# include <systemlib/flashparams/flashfs.h>
|
||||
# include <parameters/flashparams/flashfs.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -39,3 +39,11 @@ px4_add_library(drivers_board
|
||||
timer_config.c
|
||||
usb.c
|
||||
)
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
drivers__led # drv_led_start
|
||||
nuttx_apps # up_cxxinitialize
|
||||
nuttx_arch # sdio
|
||||
nuttx_drivers # sdio
|
||||
parameters # param_init
|
||||
)
|
||||
|
||||
@@ -73,13 +73,13 @@
|
||||
|
||||
#include <systemlib/px4_macros.h>
|
||||
#include <systemlib/cpuload.h>
|
||||
#include <systemlib/perf_counter.h>
|
||||
#include <perf/perf_counter.h>
|
||||
#include <systemlib/err.h>
|
||||
|
||||
#include <systemlib/hardfault_log.h>
|
||||
|
||||
#include <systemlib/systemlib.h>
|
||||
#include <systemlib/param/param.h>
|
||||
#include <parameters/param.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
|
||||
@@ -31,13 +31,14 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
if (${OS} MATCHES "nuttx")
|
||||
px4_add_library(boards_common
|
||||
# common board drivers (currently only for nuttx fmu boards)
|
||||
if (${OS} MATCHES "nuttx" AND NOT ${BOARD} MATCHES "io")
|
||||
|
||||
px4_add_library(drivers_boards_common
|
||||
board_crashdump.c
|
||||
board_dma_alloc.c
|
||||
board_gpio_init.c
|
||||
)
|
||||
add_dependencies(boards_common nuttx_build)
|
||||
|
||||
if (${CONFIG_ARCH_CHIP} MATCHES "kinetis")
|
||||
add_subdirectory(kinetis)
|
||||
@@ -46,4 +47,16 @@ if (${OS} MATCHES "nuttx")
|
||||
elseif (${CONFIG_ARCH_CHIP} MATCHES "stm32")
|
||||
add_subdirectory(stm32)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_link_libraries(drivers_boards_common
|
||||
PRIVATE
|
||||
drivers_boards_common_arch
|
||||
nuttx_arch # bbsram
|
||||
nuttx_mm # dma gran alloc
|
||||
systemlib
|
||||
)
|
||||
|
||||
else()
|
||||
add_library(drivers_boards_common INTERFACE)
|
||||
add_library(drivers_boards_common_arch INTERFACE)
|
||||
endif()
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#include <errno.h>
|
||||
#include <nuttx/mm/gran.h>
|
||||
|
||||
#include <systemlib/perf_counter.h>
|
||||
#include <perf/perf_counter.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
|
||||
@@ -31,9 +31,10 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
px4_add_library(board_kinetis
|
||||
add_library(drivers_boards_common_arch
|
||||
board_identity.c
|
||||
board_mcu_version.c
|
||||
board_reset.c
|
||||
)
|
||||
add_dependencies(board_kinetis nuttx_build)
|
||||
add_dependencies(drivers_boards_common_arch prebuild_targets)
|
||||
target_link_libraries(drivers_boards_common_arch PRIVATE nuttx_arch)
|
||||
|
||||
@@ -31,9 +31,10 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
px4_add_library(board_samv7
|
||||
add_library(drivers_boards_common_arch
|
||||
board_identity.c
|
||||
board_mcu_version.c
|
||||
board_reset.c
|
||||
)
|
||||
add_dependencies(board_samv7 nuttx_build)
|
||||
)
|
||||
add_dependencies(drivers_boards_common_arch prebuild_targets)
|
||||
target_link_libraries(drivers_boards_common_arch PRIVATE nuttx_arch)
|
||||
|
||||
@@ -43,5 +43,6 @@ if (NOT ${LABEL} STREQUAL "bootloader")
|
||||
)
|
||||
endif()
|
||||
|
||||
px4_add_library(board_stm32 ${SRCS})
|
||||
add_dependencies(board_stm32 nuttx_build)
|
||||
add_library(drivers_boards_common_arch ${SRCS})
|
||||
add_dependencies(drivers_boards_common_arch prebuild_targets)
|
||||
target_link_libraries(drivers_boards_common_arch PRIVATE nuttx_arch)
|
||||
|
||||
@@ -79,7 +79,10 @@ void board_system_reset(int status)
|
||||
#if defined(BOARD_HAS_ON_RESET)
|
||||
board_on_reset(status);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BOARDCTL_RESET
|
||||
board_reset(status);
|
||||
#endif
|
||||
|
||||
while (1);
|
||||
}
|
||||
|
||||
@@ -37,3 +37,9 @@ px4_add_library(drivers_board
|
||||
timer_config.c
|
||||
usb.c
|
||||
)
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
drivers__led # drv_led_start
|
||||
nuttx_apps # up_cxxinitialize
|
||||
parameters # param_init
|
||||
)
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
#include <systemlib/err.h>
|
||||
#include <systemlib/hardfault_log.h>
|
||||
#include <systemlib/systemlib.h>
|
||||
#include <systemlib/param/param.h>
|
||||
#include <parameters/param.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
|
||||
@@ -30,12 +30,5 @@
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
px4_add_module(
|
||||
MODULE drivers__boards__sitl
|
||||
COMPILE_FLAGS
|
||||
SRCS
|
||||
sitl_led.c
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
|
||||
px4_add_library(drivers_board sitl_led.c)
|
||||
|
||||
@@ -40,3 +40,8 @@ px4_add_library(drivers_board
|
||||
led.c
|
||||
usb.c
|
||||
)
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
nuttx_apps # up_cxxinitialize
|
||||
parameters # param_init
|
||||
)
|
||||
|
||||
@@ -69,14 +69,14 @@
|
||||
#include <drivers/drv_board_led.h>
|
||||
|
||||
#include <systemlib/cpuload.h>
|
||||
#include <systemlib/param/param.h>
|
||||
#include <parameters/param.h>
|
||||
|
||||
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
|
||||
#include <systemlib/systemlib.h>
|
||||
#endif
|
||||
|
||||
#if defined(FLASH_BASED_PARAMS)
|
||||
# include <systemlib/flashparams/flashfs.h>
|
||||
# if defined(FLASH_BASED_PARAMS)
|
||||
# include <parameters/flashparams/flashfs.h>
|
||||
#endif
|
||||
|
||||
#include "board_config.h"
|
||||
|
||||
@@ -39,3 +39,12 @@ px4_add_library(drivers_board
|
||||
timer_config.c
|
||||
usb.c
|
||||
)
|
||||
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
drivers__led # drv_led_start
|
||||
nuttx_apps # up_cxxinitialize
|
||||
nuttx_arch # sdio
|
||||
nuttx_drivers # sdio
|
||||
parameters # param_init
|
||||
)
|
||||
|
||||
@@ -74,12 +74,12 @@
|
||||
|
||||
#include <systemlib/px4_macros.h>
|
||||
#include <systemlib/cpuload.h>
|
||||
#include <systemlib/perf_counter.h>
|
||||
#include <perf/perf_counter.h>
|
||||
|
||||
#include <systemlib/hardfault_log.h>
|
||||
|
||||
#include <systemlib/systemlib.h>
|
||||
#include <systemlib/param/param.h>
|
||||
#include <parameters/param.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
|
||||
@@ -42,3 +42,12 @@ px4_add_library(drivers_board
|
||||
timer_config.c
|
||||
usb.c
|
||||
)
|
||||
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
nuttx_apps # up_cxxinitialize
|
||||
nuttx_arch # sdio
|
||||
nuttx_drivers # sdio
|
||||
drivers__led # drv_led_start
|
||||
parameters # param_init
|
||||
)
|
||||
@@ -73,7 +73,7 @@
|
||||
|
||||
#include <systemlib/px4_macros.h>
|
||||
#include <systemlib/cpuload.h>
|
||||
#include <systemlib/perf_counter.h>
|
||||
#include <perf/perf_counter.h>
|
||||
#include <systemlib/err.h>
|
||||
|
||||
#if defined(CONFIG_KINETIS_BBSRAM) //fixme:Need BBSRAM
|
||||
|
||||
@@ -40,3 +40,12 @@ px4_add_library(drivers_board
|
||||
timer_config.c
|
||||
usb.c
|
||||
)
|
||||
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
drivers__led # drv_led_start
|
||||
nuttx_apps # up_cxxinitialize
|
||||
nuttx_arch # sdio
|
||||
nuttx_drivers # sdio
|
||||
parameters # param_init
|
||||
)
|
||||
|
||||
@@ -75,13 +75,13 @@
|
||||
|
||||
#include <systemlib/px4_macros.h>
|
||||
#include <systemlib/cpuload.h>
|
||||
#include <systemlib/perf_counter.h>
|
||||
#include <perf/perf_counter.h>
|
||||
#include <systemlib/err.h>
|
||||
|
||||
#include <systemlib/hardfault_log.h>
|
||||
|
||||
#include <systemlib/systemlib.h>
|
||||
#include <systemlib/param/param.h>
|
||||
#include <parameters/param.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
|
||||
@@ -36,3 +36,12 @@ px4_add_library(drivers_board
|
||||
led.c
|
||||
usb.c
|
||||
)
|
||||
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
nuttx_apps # up_cxxinitialize
|
||||
nuttx_arch # sdio
|
||||
nuttx_drivers # sdio
|
||||
drivers__led # drv_led_start
|
||||
parameters # param_init
|
||||
)
|
||||
|
||||
@@ -71,8 +71,8 @@
|
||||
#include <drivers/drv_board_led.h>
|
||||
|
||||
#include <systemlib/cpuload.h>
|
||||
#include <systemlib/perf_counter.h>
|
||||
#include <systemlib/param/param.h>
|
||||
#include <perf/perf_counter.h>
|
||||
#include <parameters/param.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
|
||||
@@ -38,3 +38,12 @@ px4_add_library(drivers_board
|
||||
led.c
|
||||
spi.c
|
||||
)
|
||||
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
nuttx_apps # up_cxxinitialize
|
||||
nuttx_arch # sdio
|
||||
nuttx_drivers # sdio
|
||||
drivers__led # drv_led_start
|
||||
parameters # param_init
|
||||
)
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
#include <drivers/drv_board_led.h>
|
||||
|
||||
#include <systemlib/cpuload.h>
|
||||
#include <systemlib/param/param.h>
|
||||
#include <parameters/param.h>
|
||||
|
||||
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
|
||||
#include <systemlib/systemlib.h>
|
||||
|
||||
@@ -36,3 +36,10 @@ px4_add_library(drivers_board
|
||||
led.c
|
||||
usb.c
|
||||
)
|
||||
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
nuttx_apps # up_cxxinitialize
|
||||
drivers__led # drv_led_start
|
||||
parameters # param_init
|
||||
)
|
||||
|
||||
@@ -69,14 +69,14 @@
|
||||
#include <drivers/drv_board_led.h>
|
||||
|
||||
#include <systemlib/cpuload.h>
|
||||
#include <systemlib/param/param.h>
|
||||
#include <parameters/param.h>
|
||||
|
||||
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
|
||||
#include <systemlib/systemlib.h>
|
||||
#endif
|
||||
|
||||
#if defined(FLASH_BASED_PARAMS)
|
||||
# include <systemlib/flashparams/flashfs.h>
|
||||
# if defined(FLASH_BASED_PARAMS)
|
||||
# include <parameters/flashparams/flashfs.h>
|
||||
#endif
|
||||
|
||||
#include "board_config.h"
|
||||
|
||||
@@ -40,3 +40,12 @@ px4_add_library(drivers_board
|
||||
timer_config.c
|
||||
usb.c
|
||||
)
|
||||
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
drivers__led # drv_led_start
|
||||
nuttx_apps # up_cxxinitialize
|
||||
nuttx_arch # sdio
|
||||
nuttx_drivers # sdio
|
||||
parameters # param_init
|
||||
)
|
||||
|
||||
@@ -73,13 +73,13 @@
|
||||
|
||||
#include <systemlib/px4_macros.h>
|
||||
#include <systemlib/cpuload.h>
|
||||
#include <systemlib/perf_counter.h>
|
||||
#include <perf/perf_counter.h>
|
||||
#include <systemlib/err.h>
|
||||
|
||||
#include <systemlib/hardfault_log.h>
|
||||
|
||||
#include <systemlib/systemlib.h>
|
||||
#include <systemlib/param/param.h>
|
||||
#include <parameters/param.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
|
||||
@@ -39,3 +39,12 @@ px4_add_library(drivers_board
|
||||
timer_config.c
|
||||
usb.c
|
||||
)
|
||||
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
drivers__led # drv_led_start
|
||||
nuttx_apps # up_cxxinitialize
|
||||
nuttx_arch # sdio
|
||||
nuttx_drivers # sdio
|
||||
parameters # param_init
|
||||
)
|
||||
|
||||
@@ -74,13 +74,13 @@
|
||||
|
||||
#include <systemlib/px4_macros.h>
|
||||
#include <systemlib/cpuload.h>
|
||||
#include <systemlib/perf_counter.h>
|
||||
#include <perf/perf_counter.h>
|
||||
#include <systemlib/err.h>
|
||||
|
||||
#include <systemlib/hardfault_log.h>
|
||||
|
||||
#include <systemlib/systemlib.h>
|
||||
#include <systemlib/param/param.h>
|
||||
#include <parameters/param.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
|
||||
@@ -39,3 +39,11 @@ px4_add_library(drivers_board
|
||||
timer_config.c
|
||||
usb.c
|
||||
)
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
drivers__led # drv_led_start
|
||||
nuttx_apps # up_cxxinitialize
|
||||
nuttx_arch # sdio
|
||||
nuttx_drivers # sdio
|
||||
parameters # param_init
|
||||
)
|
||||
|
||||
@@ -74,13 +74,13 @@
|
||||
|
||||
#include <systemlib/px4_macros.h>
|
||||
#include <systemlib/cpuload.h>
|
||||
#include <systemlib/perf_counter.h>
|
||||
#include <perf/perf_counter.h>
|
||||
#include <systemlib/err.h>
|
||||
|
||||
#include <systemlib/hardfault_log.h>
|
||||
|
||||
#include <systemlib/systemlib.h>
|
||||
#include <systemlib/param/param.h>
|
||||
#include <parameters/param.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
|
||||
@@ -40,3 +40,11 @@ px4_add_library(drivers_board
|
||||
timer_config.c
|
||||
usb.c
|
||||
)
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
drivers__led # drv_led_start
|
||||
nuttx_apps # up_cxxinitialize
|
||||
nuttx_arch # sdio
|
||||
nuttx_drivers # sdio
|
||||
parameters # param_init
|
||||
)
|
||||
|
||||
@@ -76,13 +76,13 @@
|
||||
|
||||
#include <systemlib/px4_macros.h>
|
||||
#include <systemlib/cpuload.h>
|
||||
#include <systemlib/perf_counter.h>
|
||||
#include <perf/perf_counter.h>
|
||||
#include <systemlib/err.h>
|
||||
|
||||
#include <systemlib/hardfault_log.h>
|
||||
|
||||
#include <systemlib/systemlib.h>
|
||||
#include <systemlib/param/param.h>
|
||||
#include <parameters/param.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
/****************************************************************************
|
||||
|
||||
@@ -40,3 +40,12 @@ px4_add_library(drivers_board
|
||||
timer_config.c
|
||||
usb.c
|
||||
)
|
||||
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
nuttx_apps # up_cxxinitialize
|
||||
nuttx_arch # sdio
|
||||
nuttx_drivers # sdio
|
||||
drivers__led # drv_led_start
|
||||
parameters # param_init
|
||||
)
|
||||
|
||||
@@ -74,13 +74,13 @@
|
||||
|
||||
#include <systemlib/px4_macros.h>
|
||||
#include <systemlib/cpuload.h>
|
||||
#include <systemlib/perf_counter.h>
|
||||
#include <perf/perf_counter.h>
|
||||
#include <systemlib/err.h>
|
||||
|
||||
#include <systemlib/hardfault_log.h>
|
||||
|
||||
#include <systemlib/systemlib.h>
|
||||
#include <systemlib/param/param.h>
|
||||
#include <parameters/param.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
/****************************************************************************
|
||||
|
||||
@@ -39,3 +39,9 @@ px4_add_library(drivers_board
|
||||
can.c
|
||||
init.c
|
||||
)
|
||||
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
nuttx_apps # up_cxxinitialize
|
||||
drivers_arch
|
||||
)
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
#include <drivers/drv_board_led.h>
|
||||
|
||||
#include <systemlib/cpuload.h>
|
||||
#include <systemlib/param/param.h>
|
||||
#include <parameters/param.h>
|
||||
|
||||
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
|
||||
#include <systemlib/systemlib.h>
|
||||
|
||||
@@ -30,12 +30,5 @@
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
px4_add_module(
|
||||
MODULE drivers__boards__sitl
|
||||
COMPILE_FLAGS
|
||||
SRCS
|
||||
sitl_led.c
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
|
||||
px4_add_library(drivers_board sitl_led.c)
|
||||
|
||||
@@ -41,3 +41,12 @@ px4_add_library(drivers_board
|
||||
timer_config.c
|
||||
usb.c
|
||||
)
|
||||
|
||||
target_link_libraries(drivers_board
|
||||
PRIVATE
|
||||
nuttx_apps # up_cxxinitialize
|
||||
nuttx_arch # sdio
|
||||
nuttx_drivers # sdio
|
||||
drivers__led # drv_led_start
|
||||
parameters # param_init
|
||||
)
|
||||
|
||||
@@ -72,13 +72,12 @@
|
||||
#include <systemlib/err.h>
|
||||
#include <systemlib/hardfault_log.h>
|
||||
#include <systemlib/systemlib.h>
|
||||
#include <systemlib/param/param.h>
|
||||
#include <parameters/param.h>
|
||||
|
||||
# if defined(FLASH_BASED_PARAMS)
|
||||
# include <systemlib/flashparams/flashfs.h>
|
||||
# include <parameters/flashparams/flashfs.h>
|
||||
#endif
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user