mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Working on param xml gen. Haven't updated qurt config yet.
This commit is contained in:
parent
2bd0c2479e
commit
6966331a88
@ -130,7 +130,7 @@ endif()
|
||||
set(px4_required_functions
|
||||
px4_os_prebuild_targets
|
||||
px4_os_add_flags
|
||||
px4_set_config_modules
|
||||
px4_get_config
|
||||
)
|
||||
foreach(cmd ${px4_required_functions})
|
||||
if(NOT COMMAND ${cmd})
|
||||
@ -235,7 +235,7 @@ px4_generate_messages(TARGET msg_gen
|
||||
#=============================================================================
|
||||
# subdirectories
|
||||
#
|
||||
px4_set_config_modules(config_modules)
|
||||
px4_get_config(OUT_MODULES config_modules)
|
||||
set(module_libraries)
|
||||
foreach(module ${config_modules})
|
||||
add_subdirectory(src/${module})
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
include(nuttx/px4_impl_nuttx)
|
||||
|
||||
function(px4_set_config_modules out_module_list)
|
||||
function(px4_get_config)
|
||||
|
||||
px4_parse_function_args(
|
||||
NAME px4_set_config_modules
|
||||
ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS
|
||||
ARGN ${ARGN})
|
||||
|
||||
set(config_module_list
|
||||
|
||||
#
|
||||
# Board support modules
|
||||
#
|
||||
@ -161,25 +165,39 @@ function(px4_set_config_modules out_module_list)
|
||||
#examples/hwtest
|
||||
)
|
||||
|
||||
# TODO convert rest of makefile config below
|
||||
set(firmware_options
|
||||
PARAM_XML # generate param xml
|
||||
)
|
||||
|
||||
# Generate parameter XML file
|
||||
#GEN_PARAM_XML = 1
|
||||
set(extra_cmds serdis_main sercon_main)
|
||||
|
||||
set(${out_module_list} ${config_module_list} PARENT_SCOPE)
|
||||
# output
|
||||
if(OUT_MODULES)
|
||||
set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
if (OUT_FW_OPTS)
|
||||
set(${OUT_FW_OPTS} ${fw_opts} PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
function(px4_nuttx_builtin_extra_commands out)
|
||||
function(px4_add_extra_builtin_cmds)
|
||||
|
||||
add_custom_target(sercon_main)
|
||||
set_target_properties(sercon_main PROPERTIES
|
||||
px4_parse_function_args(
|
||||
NAME px4_add_extra_builtin_cmds
|
||||
ONE_VALUE OUT
|
||||
REQUIRED OUT
|
||||
ARGN ${ARGN})
|
||||
|
||||
add_custom_target(sercon)
|
||||
set_target_properties(sercon PROPERTIES
|
||||
MAIN "sercon" STACK "2048")
|
||||
|
||||
add_custom_target(serdis_main)
|
||||
set_target_properties(serdis_main PROPERTIES
|
||||
add_custom_target(serdis)
|
||||
set_target_properties(serdis PROPERTIES
|
||||
MAIN "serdis" STACK "2048")
|
||||
|
||||
set(${out} sercon_main serdis_main PARENT_SCOPE)
|
||||
set(${OUT} sercon serdis PARENT_SCOPE)
|
||||
|
||||
endfunction()
|
||||
|
||||
@ -1,6 +1,11 @@
|
||||
include(nuttx/px4_impl_nuttx)
|
||||
|
||||
function(px4_set_config_modules out_module_list)
|
||||
function(px4_get_config)
|
||||
|
||||
px4_parse_function_args(
|
||||
NAME px4_set_config_modules
|
||||
ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS
|
||||
ARGN ${ARGN})
|
||||
|
||||
set(config_module_list
|
||||
|
||||
@ -117,25 +122,39 @@ function(px4_set_config_modules out_module_list)
|
||||
examples/hwtest
|
||||
)
|
||||
|
||||
# TODO convert rest of makefile config below
|
||||
set(firmware_options
|
||||
PARAM_XML # generate param xml
|
||||
)
|
||||
|
||||
# Generate parameter XML file
|
||||
#GEN_PARAM_XML = 1
|
||||
set(extra_cmds serdis_main sercon_main)
|
||||
|
||||
set(${out_module_list} ${config_module_list} PARENT_SCOPE)
|
||||
# output
|
||||
if(OUT_MODULES)
|
||||
set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
if (OUT_FW_OPTS)
|
||||
set(${OUT_FW_OPTS} ${fw_opts} PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
function(px4_nuttx_builtin_extra_commands out)
|
||||
function(px4_add_extra_builtin_cmds)
|
||||
|
||||
add_custom_target(sercon_main)
|
||||
set_target_properties(sercon_main PROPERTIES
|
||||
px4_parse_function_args(
|
||||
NAME px4_add_extra_builtin_cmds
|
||||
ONE_VALUE OUT
|
||||
REQUIRED OUT
|
||||
ARGN ${ARGN})
|
||||
|
||||
add_custom_target(sercon)
|
||||
set_target_properties(sercon PROPERTIES
|
||||
MAIN "sercon" STACK "2048")
|
||||
|
||||
add_custom_target(serdis_main)
|
||||
set_target_properties(serdis_main PROPERTIES
|
||||
add_custom_target(serdis)
|
||||
set_target_properties(serdis PROPERTIES
|
||||
MAIN "serdis" STACK "2048")
|
||||
|
||||
set(${out} sercon_main serdis_main PARENT_SCOPE)
|
||||
set(${OUT} sercon serdis PARENT_SCOPE)
|
||||
|
||||
endfunction()
|
||||
|
||||
@ -1,6 +1,11 @@
|
||||
include(posix/px4_impl_posix)
|
||||
|
||||
function(px4_set_config_modules out_module_list)
|
||||
function(px4_get_config)
|
||||
|
||||
px4_parse_function_args(
|
||||
NAME px4_set_config_modules
|
||||
ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS
|
||||
ARGN ${ARGN})
|
||||
|
||||
set(config_module_list
|
||||
drivers/led
|
||||
@ -54,7 +59,39 @@ function(px4_set_config_modules out_module_list)
|
||||
lib/launchdetection
|
||||
)
|
||||
|
||||
set(${out_module_list} ${config_module_list} PARENT_SCOPE)
|
||||
set(firmware_options
|
||||
PARAM_XML # generate param xml
|
||||
)
|
||||
|
||||
set(extra_cmds serdis_main sercon_main)
|
||||
|
||||
# output
|
||||
if(OUT_MODULES)
|
||||
set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
if (OUT_FW_OPTS)
|
||||
set(${OUT_FW_OPTS} ${fw_opts} PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
function(px4_add_extra_builtin_cmds)
|
||||
|
||||
px4_parse_function_args(
|
||||
NAME px4_add_extra_builtin_cmds
|
||||
ONE_VALUE OUT
|
||||
REQUIRED OUT
|
||||
ARGN ${ARGN})
|
||||
|
||||
add_custom_target(sercon)
|
||||
set_target_properties(sercon PROPERTIES
|
||||
MAIN "sercon" STACK "2048")
|
||||
|
||||
add_custom_target(serdis)
|
||||
set_target_properties(serdis PROPERTIES
|
||||
MAIN "serdis" STACK "2048")
|
||||
|
||||
set(${OUT} sercon serdis PARENT_SCOPE)
|
||||
|
||||
endfunction()
|
||||
|
||||
@ -79,16 +79,40 @@ function(px4_nuttx_add_firmware)
|
||||
REQUIRED EXE
|
||||
ARGN ${ARGN})
|
||||
|
||||
set(process_params ${CMAKE_SOURCE_DIR}/Tools/px_process_params.py)
|
||||
set(process_airframes ${CMAKE_SOURCE_DIR}/Tools/px_process_airframes.py)
|
||||
|
||||
|
||||
#TODO handle param_xml
|
||||
add_custom_command(OUTPUT ${OUT}
|
||||
COMMAND ${OBJCOPY} -O binary ${EXE} ${EXE}.bin
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_mkfw.py
|
||||
--prototype ${CMAKE_SOURCE_DIR}/Images/${BOARD}.prototype
|
||||
--git_identity ${CMAKE_SOURCE_DIR}
|
||||
--image ${EXE}.bin > ${OUT}
|
||||
DEPENDS ${EXE}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
if(PARAM_XML)
|
||||
add_custom_command(OUTPUT ${OUT}
|
||||
COMMAND ${process_params}
|
||||
--src-path ${CMAKE_SOURCE_DIR}/src
|
||||
--board CONFIG_ARCH_BOARD_${BOARD} --xml
|
||||
COMMAND ${process_airframes}
|
||||
-a ${CMAKE_SOURCE_DIR}/ROMFS/px4fmu_common/init.d
|
||||
--board CONFIG_ARCH_BOARD_${BOARD} --xml
|
||||
COMMAND ${OBJCOPY} -O binary ${EXE} ${EXE}.bin
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_mkfw.py
|
||||
--prototype ${CMAKE_SOURCE_DIR}/Images/${BOARD}.prototype
|
||||
--git_identity ${CMAKE_SOURCE_DIR}
|
||||
--parameter_xml parameters.xml
|
||||
--airframe_xml airframe.xml
|
||||
--image ${EXE}.bin > ${OUT}
|
||||
DEPENDS ${EXE}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
else()
|
||||
add_custom_command(OUTPUT ${OUT}
|
||||
COMMAND ${OBJCOPY} -O binary ${EXE} ${EXE}.bin
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/px_mkfw.py
|
||||
--prototype ${CMAKE_SOURCE_DIR}/Images/${BOARD}.prototype
|
||||
--git_identity ${CMAKE_SOURCE_DIR}
|
||||
--image ${EXE}.bin > ${OUT}
|
||||
DEPENDS ${EXE}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
#=============================================================================
|
||||
|
||||
@ -1,38 +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
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
@ -1,9 +1,9 @@
|
||||
px4_nuttx_builtin_extra_commands(builtin_extra_cmds)
|
||||
message(STATUS "builtin extra: ${builtin_extra_cmds}")
|
||||
px4_add_extra_builtin_cmds(OUT extra_builtins)
|
||||
|
||||
px4_nuttx_generate_builtin_commands(
|
||||
OUT builtin_commands.c
|
||||
MODULE_LIST ${module_libraries} ${builtin_extra_cmds})
|
||||
MODULE_LIST ${module_libraries} ${extra_builtins}
|
||||
)
|
||||
|
||||
px4_nuttx_generate_romfs(OUT romfs.o
|
||||
ROOT ROMFS/px4fmu_common)
|
||||
@ -27,8 +27,11 @@ target_link_libraries(firmware_nuttx
|
||||
apps nuttx nosys m gcc
|
||||
-Wl,--end-group)
|
||||
|
||||
px4_get_config(OUT_FW_OPTS fw_opts)
|
||||
px4_nuttx_add_firmware(OUT ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4
|
||||
EXE ${CMAKE_CURRENT_BINARY_DIR}/firmware_nuttx)
|
||||
EXE ${CMAKE_CURRENT_BINARY_DIR}/firmware_nuttx
|
||||
${fw_opts}
|
||||
)
|
||||
|
||||
px4_add_upload(OUT upload OS ${OS} BOARD ${BOARD}
|
||||
BUNDLE ${CMAKE_CURRENT_BINARY_DIR}/fw_main.px4)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user