mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-01 05:31:35 +08:00
NuttX improve apps builtins dependencies
This commit is contained in:
committed by
David Sidrane
parent
ed9e798f86
commit
8d07c647f7
@@ -107,17 +107,6 @@ else
|
|||||||
BUILD_DIR_SUFFIX :=
|
BUILD_DIR_SUFFIX :=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# NuttX verbose output
|
|
||||||
ifdef VN
|
|
||||||
export PX4_NUTTX_BUILD_VERBOSE=1
|
|
||||||
export V=1
|
|
||||||
endif
|
|
||||||
|
|
||||||
# NuttX verbose patches output
|
|
||||||
ifdef VNP
|
|
||||||
export PX4_NUTTX_PATCHES_VERBOSE=1
|
|
||||||
endif
|
|
||||||
|
|
||||||
# additional config parameters passed to cmake
|
# additional config parameters passed to cmake
|
||||||
CMAKE_ARGS := -Wno-deprecated
|
CMAKE_ARGS := -Wno-deprecated
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ add_custom_command(OUTPUT apps_copy.stamp
|
|||||||
DEPENDS ${copy_apps_files}
|
DEPENDS ${copy_apps_files}
|
||||||
COMMENT "Copying NuttX/apps to ${CMAKE_CURRENT_BINARY_DIR}"
|
COMMENT "Copying NuttX/apps to ${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
)
|
)
|
||||||
set(APPS_DIR ${CMAKE_CURRENT_BINARY_DIR}/apps)
|
set(APPS_DIR ${PX4_BINARY_DIR}/NuttX/apps)
|
||||||
|
|
||||||
# copy PX4 board config into nuttx
|
# copy PX4 board config into nuttx
|
||||||
file(GLOB_RECURSE board_config_files ${NUTTX_CONFIG_DIR}/${BOARD})
|
file(GLOB_RECURSE board_config_files ${NUTTX_CONFIG_DIR}/${BOARD})
|
||||||
@@ -74,7 +74,8 @@ add_custom_command(OUTPUT
|
|||||||
${NUTTX_CONFIG_DIR}/${BOARD}/${nuttx_config_type}/defconfig
|
${NUTTX_CONFIG_DIR}/${BOARD}/${nuttx_config_type}/defconfig
|
||||||
${NUTTX_CONFIG_DIR}/${BOARD}/${nuttx_config_type}/Make.defs
|
${NUTTX_CONFIG_DIR}/${BOARD}/${nuttx_config_type}/Make.defs
|
||||||
${board_config_files}
|
${board_config_files}
|
||||||
nuttx_copy.stamp apps_copy.stamp
|
nuttx_copy.stamp
|
||||||
|
apps_copy.stamp
|
||||||
WORKING_DIRECTORY ${NUTTX_DIR}/tools
|
WORKING_DIRECTORY ${NUTTX_DIR}/tools
|
||||||
COMMENT "Copying NuttX config ${BOARD} and configuring"
|
COMMENT "Copying NuttX config ${BOARD} and configuring"
|
||||||
)
|
)
|
||||||
@@ -109,12 +110,11 @@ add_custom_target(nuttx_context DEPENDS ${NUTTX_DIR}/include/nuttx/version.h)
|
|||||||
|
|
||||||
# library of NuttX libraries
|
# library of NuttX libraries
|
||||||
add_library(nuttx_build INTERFACE)
|
add_library(nuttx_build INTERFACE)
|
||||||
|
add_dependencies(nuttx_build nuttx_context)
|
||||||
|
|
||||||
# builtins
|
# builtins
|
||||||
set(nuttx_builtin_list)
|
add_custom_target(nuttx_builtins)
|
||||||
if ("${BOARD}" MATCHES "px4io")
|
if (CONFIG_NSH_LIBRARY)
|
||||||
# no apps for px4io
|
|
||||||
else()
|
|
||||||
# add additional commands to nuttx builtins
|
# add additional commands to nuttx builtins
|
||||||
set(builtin_registry ${APPS_DIR}/builtin/registry)
|
set(builtin_registry ${APPS_DIR}/builtin/registry)
|
||||||
foreach(module ${module_libraries})
|
foreach(module ${module_libraries})
|
||||||
@@ -125,26 +125,30 @@ else()
|
|||||||
if(MAIN)
|
if(MAIN)
|
||||||
add_custom_command(OUTPUT ${builtin_registry}/${MAIN}_main.bdat
|
add_custom_command(OUTPUT ${builtin_registry}/${MAIN}_main.bdat
|
||||||
COMMAND echo "{ \"${MAIN}\", ${PRIORITY}, ${STACK_MAIN}, ${MAIN}_main }," > ${builtin_registry}/${MAIN}_main.bdat
|
COMMAND echo "{ \"${MAIN}\", ${PRIORITY}, ${STACK_MAIN}, ${MAIN}_main }," > ${builtin_registry}/${MAIN}_main.bdat
|
||||||
|
DEPENDS nuttx_context
|
||||||
VERBATIM
|
VERBATIM
|
||||||
)
|
)
|
||||||
list(APPEND nuttx_builtin_list ${builtin_registry}/${MAIN}_main.bdat)
|
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${builtin_registry}/${MAIN}_main.pdat
|
add_custom_command(OUTPUT ${builtin_registry}/${MAIN}_main.pdat
|
||||||
COMMAND echo "int ${MAIN}_main(int argc, char *argv[]);" > ${builtin_registry}/${MAIN}_main.pdat
|
COMMAND echo "int ${MAIN}_main(int argc, char *argv[]);" > ${builtin_registry}/${MAIN}_main.pdat
|
||||||
|
DEPENDS nuttx_context
|
||||||
VERBATIM
|
VERBATIM
|
||||||
)
|
)
|
||||||
list(APPEND nuttx_builtin_list ${builtin_registry}/${MAIN}_main.pdat)
|
|
||||||
|
add_custom_target(nuttx_builtins_${MAIN} DEPENDS ${builtin_registry}/${MAIN}_main.bdat ${builtin_registry}/${MAIN}_main.pdat)
|
||||||
|
add_dependencies(nuttx_builtins nuttx_builtins_${MAIN})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
add_dependencies(nuttx_build nuttx_builtins)
|
||||||
|
|
||||||
# APPS
|
# APPS
|
||||||
|
|
||||||
# libapps.a
|
# libapps.a
|
||||||
add_custom_command(OUTPUT ${APPS_DIR}/libapps.a ${APPS_DIR}/platform/.built
|
add_custom_command(OUTPUT ${APPS_DIR}/libapps.a ${APPS_DIR}/platform/.built
|
||||||
COMMAND find ${APPS_DIR} -name \*.o -o -name \*.built -delete
|
COMMAND find ${APPS_DIR} -name \*.o -delete
|
||||||
COMMAND make ${nuttx_build_options} --no-print-directory -C ../apps TOPDIR="${NUTTX_DIR}" libapps.a ${nuttx_build_output}
|
COMMAND make ${nuttx_build_options} --no-print-directory -C ../apps TOPDIR="${NUTTX_DIR}" libapps.a ${nuttx_build_output}
|
||||||
DEPENDS nuttx_context ${nuttx_builtin_list}
|
DEPENDS nuttx_context nuttx_builtins
|
||||||
WORKING_DIRECTORY ${NUTTX_DIR}
|
WORKING_DIRECTORY ${NUTTX_DIR}
|
||||||
${nuttx_build_uses_terminal}
|
${nuttx_build_uses_terminal}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ include(common/px4_upload)
|
|||||||
# add executable
|
# add executable
|
||||||
set(fw_name ${CONFIG}.elf)
|
set(fw_name ${CONFIG}.elf)
|
||||||
add_executable(${fw_name} ${PX4_SOURCE_DIR}/src/platforms/empty.c)
|
add_executable(${fw_name} ${PX4_SOURCE_DIR}/src/platforms/empty.c)
|
||||||
add_dependencies(${fw_name} git_nuttx)
|
add_dependencies(${fw_name} git_nuttx nuttx_build)
|
||||||
|
|
||||||
get_property(module_libraries GLOBAL PROPERTY PX4_LIBRARIES)
|
get_property(module_libraries GLOBAL PROPERTY PX4_LIBRARIES)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user