Critical: Fixes Snapdragon Flight parameter synchronization problem (#6910)

* cmake: Fixes problem caused when the generated parameters.xml differs for the ARM and DSP builds.

* fix px4_getopt.h: add accidentally removed file
This commit is contained in:
Beat Küng
2017-03-28 16:10:17 +02:00
committed by ChristophTobler
parent 7ef3b92109
commit d7703173b2
15 changed files with 58 additions and 76 deletions
+25 -10
View File
@@ -1032,12 +1032,16 @@ function(px4_generate_parameters_xml)
if (NOT OVERRIDES)
set(OVERRIDES "{}")
endif()
# get full path for each module
set(module_list)
foreach(module ${MODULES})
list(APPEND module_list ${PX4_SOURCE_DIR}/src/${module})
endforeach()
if(DISABLE_PARAMS_MODULE_SCOPING)
set(module_list ${path})
else()
foreach(module ${MODULES})
list(APPEND module_list ${PX4_SOURCE_DIR}/src/${module})
endforeach()
endif()
add_custom_command(OUTPUT ${OUT}
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/px_process_params.py
@@ -1046,7 +1050,8 @@ function(px4_generate_parameters_xml)
--overrides ${OVERRIDES}
DEPENDS ${param_src_files} ${PX4_SOURCE_DIR}/Tools/px_process_params.py
${PX4_SOURCE_DIR}/Tools/px_generate_params.py
)
)
set(${OUT} ${${OUT}} PARENT_SCOPE)
endfunction()
@@ -1082,12 +1087,22 @@ function(px4_generate_parameters_source)
${CMAKE_CURRENT_BINARY_DIR}/px4_parameters.c)
set_source_files_properties(${generated_files}
PROPERTIES GENERATED TRUE)
px4_join(OUT module_list LIST ${MODULES} GLUE ",")
add_custom_command(OUTPUT ${generated_files}
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/px_generate_params.py
--xml ${XML} --modules ${module_list} --dest ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${XML} ${DEPS}
if(DISABLE_PARAMS_MODULE_SCOPING)
add_custom_command(OUTPUT ${generated_files}
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/px_generate_params.py
--xml ${XML} --dest ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${XML} ${DEPS}
)
else()
px4_join(OUT module_list LIST ${MODULES} GLUE ",")
add_custom_command(OUTPUT ${generated_files}
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/px_generate_params.py
--xml ${XML} --modules ${module_list} --dest ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${XML} ${DEPS}
)
endif()
set(${OUT} ${generated_files} PARENT_SCOPE)
endfunction()
+1 -1
View File
@@ -9,7 +9,7 @@ endif()
set(CMAKE_TOOLCHAIN_FILE ${PX4_SOURCE_DIR}/cmake/cmake_hexagon/toolchain/Toolchain-arm-linux-gnueabihf.cmake)
set(config_generate_parameters_scope ALL)
set(DISABLE_PARAMS_MODULE_SCOPING TRUE)
# Get $QC_SOC_TARGET from environment if existing.
if (DEFINED ENV{QC_SOC_TARGET})
+1 -1
View File
@@ -4,7 +4,7 @@ set(CMAKE_TOOLCHAIN_FILE ${PX4_SOURCE_DIR}/cmake/cmake_hexagon/toolchain/Toolcha
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PX4_SOURCE_DIR}/cmake/cmake_hexagon")
set(config_generate_parameters_scope ALL)
set(DISABLE_PARAMS_MODULE_SCOPING TRUE)
# Get $QC_SOC_TARGET from environment if existing.
if (DEFINED ENV{QC_SOC_TARGET})
+6 -1
View File
@@ -11,7 +11,12 @@ set(CMAKE_TOOLCHAIN_FILE ${PX4_SOURCE_DIR}/cmake/cmake_hexagon/toolchain/Toolcha
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PX4_SOURCE_DIR}/cmake/cmake_hexagon")
set(config_generate_parameters_scope ALL)
# Disable the creation of the parameters.xml file by scanning individual
# source files, and scan all source files. This will create a parameters.xml
# file that contains all possible parameters, even if the associated module
# is not used. This is necessary for parameter synchronization between the
# ARM and DSP processors.
set(DISABLE_PARAMS_MODULE_SCOPING TRUE)
# Get $QC_SOC_TARGET from environment if existing.
if (DEFINED ENV{QC_SOC_TARGET})
+6 -1
View File
@@ -2,7 +2,12 @@ include(posix/px4_impl_posix)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PX4_SOURCE_DIR}/cmake/cmake_hexagon")
set(config_generate_parameters_scope ALL)
# Disable the creation of the parameters.xml file by scanning individual
# source files, and scan all source files. This will create a parameters.xml
# file that contains all possible parameters, even if the associated module
# is not used. This is necessary for parameter synchronization between the
# ARM and DSP processors.
set(DISABLE_PARAMS_MODULE_SCOPING TRUE)
# Get $QC_SOC_TARGET from environment if existing.
if (DEFINED ENV{QC_SOC_TARGET})
+1 -1
View File
@@ -6,7 +6,7 @@ else()
set(HEXAGON_SDK_ROOT $ENV{HEXAGON_SDK_ROOT})
endif()
set(config_generate_parameters_scope ALL)
set(DISABLE_PARAMS_MODULE_SCOPING TRUE)
# Get $QC_SOC_TARGET from environment if existing.
if (DEFINED ENV{QC_SOC_TARGET})
+1 -1
View File
@@ -6,7 +6,7 @@ else()
set(HEXAGON_SDK_ROOT $ENV{HEXAGON_SDK_ROOT})
endif()
set(config_generate_parameters_scope ALL)
set(DISABLE_PARAMS_MODULE_SCOPING TRUE)
# Get $QC_SOC_TARGET from environment if existing.
if (DEFINED ENV{QC_SOC_TARGET})
+1 -1
View File
@@ -6,7 +6,7 @@ else()
set(HEXAGON_SDK_ROOT $ENV{HEXAGON_SDK_ROOT})
endif()
set(config_generate_parameters_scope ALL)
set(DISABLE_PARAMS_MODULE_SCOPING TRUE)
# Get $QC_SOC_TARGET from environment if existing.
if (DEFINED ENV{QC_SOC_TARGET})
+1 -1
View File
@@ -6,7 +6,7 @@ else()
set(HEXAGON_SDK_ROOT $ENV{HEXAGON_SDK_ROOT})
endif()
set(config_generate_parameters_scope ALL)
set(DISABLE_PARAMS_MODULE_SCOPING TRUE)
# Get $QC_SOC_TARGET from environment if existing.
if (DEFINED ENV{QC_SOC_TARGET})
+1 -1
View File
@@ -11,7 +11,7 @@ else()
set(HEXAGON_SDK_ROOT $ENV{HEXAGON_SDK_ROOT})
endif()
set(config_generate_parameters_scope ALL)
set(DISABLE_PARAMS_MODULE_SCOPING TRUE)
# Get $QC_SOC_TARGET from environment if existing.
if (DEFINED ENV{QC_SOC_TARGET})
+7 -2
View File
@@ -8,8 +8,6 @@ endif()
set(CONFIG_SHMEM "1")
set(config_generate_parameters_scope ALL)
# Get $QC_SOC_TARGET from environment if existing.
if (DEFINED ENV{QC_SOC_TARGET})
set(QC_SOC_TARGET $ENV{QC_SOC_TARGET})
@@ -17,6 +15,13 @@ else()
set(QC_SOC_TARGET "APQ8074")
endif()
# Disable the creation of the parameters.xml file by scanning individual
# source files, and scan all source files. This will create a parameters.xml
# file that contains all possible parameters, even if the associated module
# is not used. This is necessary for parameter synchronization between the
# ARM and DSP processors.
set(DISABLE_PARAMS_MODULE_SCOPING TRUE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PX4_SOURCE_DIR}/cmake/cmake_hexagon")
include(toolchain/Toolchain-qurt)
include(qurt_flags)
+7 -2
View File
@@ -8,8 +8,6 @@ endif()
set(CONFIG_SHMEM "1")
set(config_generate_parameters_scope ALL)
# Get $QC_SOC_TARGET from environment if existing.
if (DEFINED ENV{QC_SOC_TARGET})
set(QC_SOC_TARGET $ENV{QC_SOC_TARGET})
@@ -17,6 +15,13 @@ else()
set(QC_SOC_TARGET "APQ8074")
endif()
# Disable the creation of the parameters.xml file by scanning individual
# source files, and scan all source files. This will create a parameters.xml
# file that contains all possible parameters, even if the associated module
# is not used. This is necessary for parameter synchronization between the
# ARM and DSP processors.
set(DISABLE_PARAMS_MODULE_SCOPING TRUE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PX4_SOURCE_DIR}/cmake/cmake_hexagon")
include(toolchain/Toolchain-qurt)
include(qurt_flags)
@@ -137,11 +137,3 @@ PARAM_DEFINE_INT32(UART_ESC_MOTOR3, 1);
* @group Snapdragon UART ESC
*/
PARAM_DEFINE_INT32(UART_ESC_MOTOR4, 3);
/**
* TODO-JYW: Temporary change until the reason can be determined why this
* same parameters is not read from src/platforms/px4_layer/params.c
*
* @group Snapdragon UART ESC
*/
PARAM_DEFINE_INT32(MAV_TYPE, 2);
@@ -42,7 +42,6 @@ set(QURT_LAYER_SRCS
../../posix/px4_layer/drv_hrt.c
qurt_stubs.c
main.cpp
params.c
shmem_qurt.c
)
if ("${QURT_ENABLE_STUBS}" STREQUAL "1")
-44
View File
@@ -1,44 +0,0 @@
/****************************************************************************
* Copyright (C) 2015 Mark Charlebois. 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.
*
****************************************************************************/
#include <systemlib/param/param.h>
// This is added because it is a parameter used by commander, yet created by mavlink. Since mavlink is not
// running on QURT, we need to manually define it so it is available to commander. "2" is for quadrotor.
// Following is hack to prevent duplicate parameter definition error in param parser
/**
* @board QuRT_App
*/
// TODO-JYW: Temporarily removed to remove duplicate definition.
// PARAM_DEFINE_INT32(MAV_TYPE, 2);