mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-30 13:15:32 +08:00
improve nuttx verbose build
This commit is contained in:
+1
-1
@@ -197,7 +197,7 @@ px4_add_git_submodule(TARGET git_jmavsim PATH "Tools/jMAVSim")
|
|||||||
px4_add_git_submodule(TARGET git_matrix PATH "src/lib/matrix")
|
px4_add_git_submodule(TARGET git_matrix PATH "src/lib/matrix")
|
||||||
px4_add_git_submodule(TARGET git_mavlink PATH "mavlink/include/mavlink/v1.0")
|
px4_add_git_submodule(TARGET git_mavlink PATH "mavlink/include/mavlink/v1.0")
|
||||||
px4_add_git_submodule(TARGET git_mavlink2 PATH "mavlink/include/mavlink/v2.0")
|
px4_add_git_submodule(TARGET git_mavlink2 PATH "mavlink/include/mavlink/v2.0")
|
||||||
px4_add_git_submodule(TARGET git_nuttx PATH "platforms/nuttx/NuttX")
|
px4_add_git_submodule(TARGET git_nuttx PATH "platforms/nuttx/NuttX/nuttx")
|
||||||
px4_add_git_submodule(TARGET git_uavcan PATH "src/modules/uavcan/libuavcan")
|
px4_add_git_submodule(TARGET git_uavcan PATH "src/modules/uavcan/libuavcan")
|
||||||
px4_add_git_submodule(TARGET git_micro_cdr PATH "src/lib/micro-CDR")
|
px4_add_git_submodule(TARGET git_micro_cdr PATH "src/lib/micro-CDR")
|
||||||
|
|
||||||
|
|||||||
@@ -72,10 +72,11 @@ function(px4_add_git_submodule)
|
|||||||
string(REPLACE "/" "_" NAME ${PATH})
|
string(REPLACE "/" "_" NAME ${PATH})
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${PX4_BINARY_DIR}/git_init_${NAME}.stamp
|
add_custom_command(OUTPUT ${PX4_BINARY_DIR}/git_init_${NAME}.stamp
|
||||||
COMMAND Tools/check_submodules.sh ${PATH}
|
COMMAND bash ${PX4_SOURCE_DIR}/Tools/check_submodules.sh ${PATH}
|
||||||
COMMAND cmake -E touch ${PX4_BINARY_DIR}/git_init_${NAME}.stamp
|
COMMAND cmake -E touch ${PX4_BINARY_DIR}/git_init_${NAME}.stamp
|
||||||
DEPENDS ${PX4_SOURCE_DIR}/.gitmodules
|
DEPENDS ${PX4_SOURCE_DIR}/.gitmodules ${PATH}/.git
|
||||||
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
|
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
|
||||||
|
COMMENT "git submodule ${PATH}"
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(${TARGET} DEPENDS ${PX4_BINARY_DIR}/git_init_${NAME}.stamp)
|
add_custom_target(${TARGET} DEPENDS ${PX4_BINARY_DIR}/git_init_${NAME}.stamp)
|
||||||
|
|||||||
@@ -1,73 +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.
|
|
||||||
#
|
|
||||||
############################################################################
|
|
||||||
px4_add_module(
|
|
||||||
MODULE {{data.module}}
|
|
||||||
{%- if data.command != '' %}
|
|
||||||
MAIN {{data.command}}
|
|
||||||
{%- endif %}
|
|
||||||
{%- if data.priority != '' %}
|
|
||||||
PRIORITY {{data.priority}}
|
|
||||||
{%- endif %}
|
|
||||||
{%- if data.stacksize != '' %}
|
|
||||||
STACK {{data.stacksize}}
|
|
||||||
{%- endif %}
|
|
||||||
{%- if (data.extracxxflags|length > 0) or (data.extracflags|length > 0) or (data.maxoptimization != '') %}
|
|
||||||
COMPILE_FLAGS
|
|
||||||
{%- for flag in data.extracxxflags %}
|
|
||||||
{{flag}}
|
|
||||||
{%- endfor %}
|
|
||||||
{%- for flag in data.extracflags %}
|
|
||||||
{{flag}}
|
|
||||||
{%- endfor %}
|
|
||||||
{{data.maxoptimization}}
|
|
||||||
{%- endif %}
|
|
||||||
{%- if data.srcs|length > 0 %}
|
|
||||||
SRCS
|
|
||||||
{%- for src in data.srcs %}
|
|
||||||
{{src}}
|
|
||||||
{%- endfor %}
|
|
||||||
{%- endif %}
|
|
||||||
DEPENDS
|
|
||||||
{%- if data.module != 'platforms__common' %}
|
|
||||||
platforms__common
|
|
||||||
{%- else %}
|
|
||||||
msg_gen
|
|
||||||
{%- endif %}
|
|
||||||
{%- if data.includes|length > 0 %}
|
|
||||||
INCLUDES {%- for include in data.includes %}
|
|
||||||
{{include}}
|
|
||||||
{%- endfor %}
|
|
||||||
{%- endif %}
|
|
||||||
)
|
|
||||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
|
||||||
{# vim: set noet list ft=jinja fenc=utf-8 ff=unix : #}
|
|
||||||
@@ -62,13 +62,12 @@ add_custom_command(OUTPUT
|
|||||||
${NUTTX_DIR}/PX4_Warnings.mk
|
${NUTTX_DIR}/PX4_Warnings.mk
|
||||||
${NUTTX_DIR}/.config
|
${NUTTX_DIR}/.config
|
||||||
${NUTTX_DIR}/Make.defs
|
${NUTTX_DIR}/Make.defs
|
||||||
${NUTTX_DIR}/configs/${BOARD}/${nuttx_config_type}/defconfig
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${NUTTX_CONFIG_DIR}/PX4_Config.mk ${NUTTX_DIR}/PX4_Config.mk
|
COMMAND ${CMAKE_COMMAND} -E copy ${NUTTX_CONFIG_DIR}/PX4_Config.mk ${NUTTX_DIR}/PX4_Config.mk
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${NUTTX_CONFIG_DIR}/PX4_Warnings.mk ${NUTTX_DIR}/PX4_Warnings.mk
|
COMMAND ${CMAKE_COMMAND} -E copy ${NUTTX_CONFIG_DIR}/PX4_Warnings.mk ${NUTTX_DIR}/PX4_Warnings.mk
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${NUTTX_CONFIG_DIR}/${BOARD}/${nuttx_config_type}/defconfig ${NUTTX_DIR}/.config
|
COMMAND ${CMAKE_COMMAND} -E copy ${NUTTX_CONFIG_DIR}/${BOARD}/${nuttx_config_type}/defconfig ${NUTTX_DIR}/.config
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove -f ${NUTTX_DIR}/include/nuttx/config.h
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${NUTTX_CONFIG_DIR}/${BOARD}/${nuttx_config_type}/Make.defs ${NUTTX_DIR}/Make.defs
|
COMMAND ${CMAKE_COMMAND} -E copy ${NUTTX_CONFIG_DIR}/${BOARD}/${nuttx_config_type}/Make.defs ${NUTTX_DIR}/Make.defs
|
||||||
COMMAND ${cp_cmd} ${cp_opts} ${NUTTX_CONFIG_DIR}/${BOARD} ${NUTTX_DIR}/configs/
|
COMMAND ${cp_cmd} ${cp_opts} ${NUTTX_CONFIG_DIR}/${BOARD} ${NUTTX_DIR}/configs/
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E remove -f ${NUTTX_DIR}/include/nuttx/config.h
|
||||||
DEPENDS
|
DEPENDS
|
||||||
${NUTTX_CONFIG_DIR}/PX4_Config.mk
|
${NUTTX_CONFIG_DIR}/PX4_Config.mk
|
||||||
${NUTTX_CONFIG_DIR}/PX4_Warnings.mk
|
${NUTTX_CONFIG_DIR}/PX4_Warnings.mk
|
||||||
@@ -81,11 +80,30 @@ add_custom_command(OUTPUT
|
|||||||
)
|
)
|
||||||
add_custom_target(nuttx_configure DEPENDS ${NUTTX_DIR}/.config)
|
add_custom_target(nuttx_configure DEPENDS ${NUTTX_DIR}/.config)
|
||||||
|
|
||||||
|
# verbose build settings (V=1 or VERBOSE=1)
|
||||||
|
option(PX4_NUTTX_VERBOSE "PX4 NuttX verbose build" off)
|
||||||
|
|
||||||
|
if (($ENV{V} MATCHES "1") OR ($ENV{VERBOSE} MATCHES "1"))
|
||||||
|
message(STATUS "NuttX verbose build enabled")
|
||||||
|
set(PX4_NUTTX_VERBOSE on)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (PX4_NUTTX_VERBOSE)
|
||||||
|
set(nuttx_build_options)
|
||||||
|
set(nuttx_build_output)
|
||||||
|
set(nuttx_build_uses_terminal "USES_TERMINAL")
|
||||||
|
else()
|
||||||
|
set(nuttx_build_options "--quiet")
|
||||||
|
set(nuttx_build_output ">nuttx_build.log")
|
||||||
|
set(nuttx_build_uses_terminal)
|
||||||
|
endif()
|
||||||
|
|
||||||
# context
|
# context
|
||||||
add_custom_command(OUTPUT ${NUTTX_DIR}/include/nuttx/version.h ${NUTTX_DIR}/include/nuttx/config.h
|
add_custom_command(OUTPUT ${NUTTX_DIR}/include/nuttx/version.h ${NUTTX_DIR}/include/nuttx/config.h
|
||||||
COMMAND make --no-print-directory --silent context > /dev/null
|
COMMAND make ${nuttx_build_options} --no-print-directory context ${nuttx_build_output}
|
||||||
DEPENDS nuttx_configure ${NUTTX_DIR}/.config
|
DEPENDS nuttx_configure ${NUTTX_DIR}/.config
|
||||||
WORKING_DIRECTORY ${NUTTX_DIR}
|
WORKING_DIRECTORY ${NUTTX_DIR}
|
||||||
|
${nuttx_build_uses_terminal}
|
||||||
)
|
)
|
||||||
add_custom_target(nuttx_context DEPENDS ${NUTTX_DIR}/include/nuttx/version.h)
|
add_custom_target(nuttx_context DEPENDS ${NUTTX_DIR}/include/nuttx/version.h)
|
||||||
|
|
||||||
@@ -123,12 +141,12 @@ endif()
|
|||||||
# APPS
|
# APPS
|
||||||
|
|
||||||
# libapps.a
|
# libapps.a
|
||||||
add_custom_command(OUTPUT ${APPS_DIR}/libapps.a
|
add_custom_command(OUTPUT ${APPS_DIR}/libapps.a ${APPS_DIR}/platform/.built
|
||||||
${APPS_DIR}/platform/.built
|
|
||||||
COMMAND find ${APPS_DIR} -name \*.o -o -name \*.built -delete
|
COMMAND find ${APPS_DIR} -name \*.o -o -name \*.built -delete
|
||||||
COMMAND make --silent --no-print-directory -C ../apps TOPDIR="${NUTTX_DIR}" libapps.a > /dev/null
|
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_builtin_list}
|
||||||
WORKING_DIRECTORY ${NUTTX_DIR}
|
WORKING_DIRECTORY ${NUTTX_DIR}
|
||||||
|
${nuttx_build_uses_terminal}
|
||||||
)
|
)
|
||||||
add_custom_target(nuttx_apps_build DEPENDS ${APPS_DIR}/libapps.a)
|
add_custom_target(nuttx_apps_build DEPENDS ${APPS_DIR}/libapps.a)
|
||||||
add_library(nuttx_apps STATIC IMPORTED GLOBAL)
|
add_library(nuttx_apps STATIC IMPORTED GLOBAL)
|
||||||
@@ -138,9 +156,10 @@ target_link_libraries(nuttx_build INTERFACE nuttx_apps)
|
|||||||
|
|
||||||
# libboard.a
|
# libboard.a
|
||||||
add_custom_command(OUTPUT ${NUTTX_DIR}/arch/arm/src/board/libboard.a
|
add_custom_command(OUTPUT ${NUTTX_DIR}/arch/arm/src/board/libboard.a
|
||||||
COMMAND make --silent --no-print-directory -C board TOPDIR="${NUTTX_DIR}" libboard.a EXTRADEFINES=-D__KERNEL__ > /dev/null
|
COMMAND make ${nuttx_build_options} -j2 --no-print-directory -C board TOPDIR="${NUTTX_DIR}" libboard.a EXTRADEFINES=-D__KERNEL__ ${nuttx_build_output}
|
||||||
DEPENDS nuttx_context
|
DEPENDS nuttx_context
|
||||||
WORKING_DIRECTORY ${NUTTX_DIR}/arch/arm/src
|
WORKING_DIRECTORY ${NUTTX_DIR}/arch/arm/src
|
||||||
|
${nuttx_build_uses_terminal}
|
||||||
)
|
)
|
||||||
add_custom_target(nuttx_board_build DEPENDS ${NUTTX_DIR}/arch/arm/src/board/libboard.a)
|
add_custom_target(nuttx_board_build DEPENDS ${NUTTX_DIR}/arch/arm/src/board/libboard.a)
|
||||||
add_library(nuttx_board STATIC IMPORTED GLOBAL)
|
add_library(nuttx_board STATIC IMPORTED GLOBAL)
|
||||||
@@ -155,10 +174,11 @@ function(add_nuttx_dir nuttx_lib nuttx_lib_dir kernel extra)
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/nuttx/${nuttx_lib_dir}/*)
|
${CMAKE_CURRENT_SOURCE_DIR}/nuttx/${nuttx_lib_dir}/*)
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${NUTTX_DIR}/${nuttx_lib_dir}/lib${nuttx_lib}.a
|
add_custom_command(OUTPUT ${NUTTX_DIR}/${nuttx_lib_dir}/lib${nuttx_lib}.a
|
||||||
COMMAND find ${nuttx_lib_dir} -type f -name *.o -o -name .built -delete
|
COMMAND find ${nuttx_lib_dir} -type f -name *.o -delete
|
||||||
COMMAND make -C ${nuttx_lib_dir} -j2 --silent --no-print-directory lib${nuttx_lib}.a TOPDIR="${NUTTX_DIR}" KERNEL=${kernel} EXTRADEFINES=${extra} > /dev/null
|
COMMAND make -C ${nuttx_lib_dir} ${nuttx_build_options} -j2 --no-print-directory lib${nuttx_lib}.a TOPDIR=${NUTTX_DIR} KERNEL=${kernel} EXTRADEFINES=${extra} ${nuttx_build_output}
|
||||||
DEPENDS ${nuttx_lib_files} nuttx_context
|
DEPENDS ${nuttx_lib_files} nuttx_context
|
||||||
WORKING_DIRECTORY ${NUTTX_DIR}
|
WORKING_DIRECTORY ${NUTTX_DIR}
|
||||||
|
${nuttx_build_uses_terminal}
|
||||||
)
|
)
|
||||||
add_custom_target(nuttx_${nuttx_lib}_build DEPENDS ${NUTTX_DIR}/${nuttx_lib_dir}/lib${nuttx_lib}.a)
|
add_custom_target(nuttx_${nuttx_lib}_build DEPENDS ${NUTTX_DIR}/${nuttx_lib_dir}/lib${nuttx_lib}.a)
|
||||||
add_library(nuttx_${nuttx_lib} STATIC IMPORTED GLOBAL)
|
add_library(nuttx_${nuttx_lib} STATIC IMPORTED GLOBAL)
|
||||||
@@ -168,19 +188,16 @@ function(add_nuttx_dir nuttx_lib nuttx_lib_dir kernel extra)
|
|||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# add_nuttx_dir(NAME DIRECTORY KERNEL EXTRA)
|
# add_nuttx_dir(NAME DIRECTORY KERNEL EXTRA)
|
||||||
|
|
||||||
add_nuttx_dir(arch arch/arm/src y -D__KERNEL__)
|
add_nuttx_dir(arch arch/arm/src y -D__KERNEL__)
|
||||||
add_nuttx_dir(binfmt binfmt y -D__KERNEL__)
|
add_nuttx_dir(binfmt binfmt y -D__KERNEL__)
|
||||||
add_nuttx_dir(configs configs y -D__KERNEL__)
|
add_nuttx_dir(configs configs y -D__KERNEL__)
|
||||||
add_nuttx_dir(drivers drivers y -D__KERNEL__)
|
add_nuttx_dir(drivers drivers y -D__KERNEL__)
|
||||||
add_nuttx_dir(fs fs y -D__KERNEL__)
|
add_nuttx_dir(fs fs y -D__KERNEL__)
|
||||||
add_nuttx_dir(sched sched y -D__KERNEL__)
|
add_nuttx_dir(sched sched y -D__KERNEL__)
|
||||||
|
|
||||||
add_nuttx_dir(c libc n "")
|
add_nuttx_dir(c libc n "")
|
||||||
add_nuttx_dir(cxx libxx n "")
|
add_nuttx_dir(cxx libxx n "")
|
||||||
add_nuttx_dir(mm mm n "")
|
add_nuttx_dir(mm mm n "")
|
||||||
|
|
||||||
|
|
||||||
# oldconfig helper
|
# oldconfig helper
|
||||||
add_custom_target(oldconfig
|
add_custom_target(oldconfig
|
||||||
COMMAND make --no-print-directory --silent -C ${NUTTX_DIR} CONFIG_ARCH_BOARD=${BOARD} oldconfig
|
COMMAND make --no-print-directory --silent -C ${NUTTX_DIR} CONFIG_ARCH_BOARD=${BOARD} oldconfig
|
||||||
|
|||||||
@@ -3,6 +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}/nuttx-configs/${BOARD}/src/empty.c)
|
add_executable(${fw_name} ${PX4_SOURCE_DIR}/nuttx-configs/${BOARD}/src/empty.c)
|
||||||
|
add_dependencies(${fw_name} git_nuttx)
|
||||||
|
|
||||||
get_property(module_libraries GLOBAL PROPERTY PX4_LIBRARIES)
|
get_property(module_libraries GLOBAL PROPERTY PX4_LIBRARIES)
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ add_custom_command(OUTPUT ${parameters_xml}
|
|||||||
--overrides ${PARAM_DEFAULT_OVERRIDES}
|
--overrides ${PARAM_DEFAULT_OVERRIDES}
|
||||||
DEPENDS ${param_src_files} ${PX4_SOURCE_DIR}/Tools/px_process_params.py
|
DEPENDS ${param_src_files} ${PX4_SOURCE_DIR}/Tools/px_process_params.py
|
||||||
WORKING_DIRECTORY ${PX4_BINARY_DIR}
|
WORKING_DIRECTORY ${PX4_BINARY_DIR}
|
||||||
|
COMMENT "Generating parameters.xml"
|
||||||
)
|
)
|
||||||
add_custom_target(parameters_xml DEPENDS ${parameters_xml})
|
add_custom_target(parameters_xml DEPENDS ${parameters_xml})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user