diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 06e5ff4b53..647a552203 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -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() diff --git a/cmake/configs/posix_eagle_hil.cmake b/cmake/configs/posix_eagle_hil.cmake index 14f4cdae03..ceda98b0fe 100644 --- a/cmake/configs/posix_eagle_hil.cmake +++ b/cmake/configs/posix_eagle_hil.cmake @@ -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}) diff --git a/cmake/configs/posix_eagle_muorb.cmake b/cmake/configs/posix_eagle_muorb.cmake index baf9137c8f..a04d645e0f 100644 --- a/cmake/configs/posix_eagle_muorb.cmake +++ b/cmake/configs/posix_eagle_muorb.cmake @@ -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}) diff --git a/cmake/configs/posix_sdflight_default.cmake b/cmake/configs/posix_sdflight_default.cmake index 959d579441..256bb0968e 100644 --- a/cmake/configs/posix_sdflight_default.cmake +++ b/cmake/configs/posix_sdflight_default.cmake @@ -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}) diff --git a/cmake/configs/posix_sdflight_legacy.cmake b/cmake/configs/posix_sdflight_legacy.cmake index 68df5caf90..3185da6800 100644 --- a/cmake/configs/posix_sdflight_legacy.cmake +++ b/cmake/configs/posix_sdflight_legacy.cmake @@ -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}) diff --git a/cmake/configs/qurt_eagle_hello.cmake b/cmake/configs/qurt_eagle_hello.cmake index 44dc067417..33c43356da 100644 --- a/cmake/configs/qurt_eagle_hello.cmake +++ b/cmake/configs/qurt_eagle_hello.cmake @@ -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}) diff --git a/cmake/configs/qurt_eagle_hil.cmake b/cmake/configs/qurt_eagle_hil.cmake index 2896a6833f..3736c79a15 100644 --- a/cmake/configs/qurt_eagle_hil.cmake +++ b/cmake/configs/qurt_eagle_hil.cmake @@ -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}) diff --git a/cmake/configs/qurt_eagle_muorb.cmake b/cmake/configs/qurt_eagle_muorb.cmake index 0e0152ab1e..3bb2dfd561 100644 --- a/cmake/configs/qurt_eagle_muorb.cmake +++ b/cmake/configs/qurt_eagle_muorb.cmake @@ -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}) diff --git a/cmake/configs/qurt_eagle_test.cmake b/cmake/configs/qurt_eagle_test.cmake index 55cf116349..78a059d14f 100644 --- a/cmake/configs/qurt_eagle_test.cmake +++ b/cmake/configs/qurt_eagle_test.cmake @@ -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}) diff --git a/cmake/configs/qurt_eagle_travis.cmake b/cmake/configs/qurt_eagle_travis.cmake index e3c6a85733..a4d4d2bc33 100644 --- a/cmake/configs/qurt_eagle_travis.cmake +++ b/cmake/configs/qurt_eagle_travis.cmake @@ -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}) diff --git a/cmake/configs/qurt_sdflight_default.cmake b/cmake/configs/qurt_sdflight_default.cmake index b8e111d3fe..172289a8ad 100644 --- a/cmake/configs/qurt_sdflight_default.cmake +++ b/cmake/configs/qurt_sdflight_default.cmake @@ -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) diff --git a/cmake/configs/qurt_sdflight_legacy.cmake b/cmake/configs/qurt_sdflight_legacy.cmake index 6523fd58e5..6ab749204b 100644 --- a/cmake/configs/qurt_sdflight_legacy.cmake +++ b/cmake/configs/qurt_sdflight_legacy.cmake @@ -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) diff --git a/src/platforms/qurt/fc_addon/uart_esc/uart_esc_params.c b/src/platforms/qurt/fc_addon/uart_esc/uart_esc_params.c index ea39c3c199..ca1ca273b7 100644 --- a/src/platforms/qurt/fc_addon/uart_esc/uart_esc_params.c +++ b/src/platforms/qurt/fc_addon/uart_esc/uart_esc_params.c @@ -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); diff --git a/src/platforms/qurt/px4_layer/CMakeLists.txt b/src/platforms/qurt/px4_layer/CMakeLists.txt index 2c34d35dc5..7b913cfdbf 100644 --- a/src/platforms/qurt/px4_layer/CMakeLists.txt +++ b/src/platforms/qurt/px4_layer/CMakeLists.txt @@ -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") diff --git a/src/platforms/qurt/px4_layer/params.c b/src/platforms/qurt/px4_layer/params.c deleted file mode 100644 index 78fcbb5327..0000000000 --- a/src/platforms/qurt/px4_layer/params.c +++ /dev/null @@ -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 - -// 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); -