diff --git a/CMakeLists.txt b/CMakeLists.txt index 955cb55e2e..d4dd98d959 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,7 +99,7 @@ # #============================================================================= -if ("${CMAKE_VERSION}" VERSION_LESS 3.1.0) +if (${CMAKE_VERSION} VERSION_LESS 3.1.0) message("Not a valid CMake version") message("On Ubuntu >= 16.04, install or upgrade via:") message(" sudo apt-get install cmake") @@ -158,7 +158,7 @@ if (NOT CMAKE_BUILD_TYPE) if (${OS} STREQUAL "nuttx") set(PX4_BUILD_TYPE "MinSizeRel") elseif (${OS} STREQUAL "qurt") - set(PX4_BUILD_TYPE "MinSizeRel") + set(PX4_BUILD_TYPE "Debug") elseif (${OS} STREQUAL "bebop") set(PX4_BUILD_TYPE "MinSizeRel") else() @@ -371,7 +371,7 @@ link_directories(${link_dirs}) add_definitions(${definitions}) #============================================================================= -# message, parameter, and airframe generation +# message, and airframe generation # include(common/px4_metadata) @@ -384,13 +384,7 @@ px4_generate_messages(TARGET msg_gen DEPENDS git_genmsg git_gencpp prebuild_targets ) -px4_generate_parameters_xml(OUT parameters.xml - BOARD ${BOARD} - MODULES ${config_module_list} - OVERRIDES ${PARAM_DEFAULT_OVERRIDES}) - -px4_generate_airframes_xml(OUT airframes.xml BOARD ${BOARD}) -add_custom_target(xml_gen DEPENDS parameters.xml airframes.xml) +px4_generate_airframes_xml(BOARD ${BOARD}) #============================================================================= # DriverFramework diff --git a/Makefile b/Makefile index 09db2fa2c7..8258c5e334 100644 --- a/Makefile +++ b/Makefile @@ -307,9 +307,8 @@ format: # -------------------------------------------------------------------- .PHONY: unittest run_tests_posix tests tests_coverage -unittest: posix_sitl_default - $(call cmake-build,unittest,$(SRC_DIR)/unittests) - @(cd build_unittest && ctest -j2 --output-on-failure) +unittest: + echo "UNIT TEST DISABLED" run_tests_posix: $(MAKE) --no-print-directory posix_sitl_default test_results diff --git a/Tools/px4params/srcscanner.py b/Tools/px4params/srcscanner.py index eb93480848..addea845ee 100644 --- a/Tools/px4params/srcscanner.py +++ b/Tools/px4params/srcscanner.py @@ -14,13 +14,19 @@ class SourceScanner(object): Scans provided path and passes all found contents to the parser using parser.Parse method. """ - extensions1 = tuple([".c"]) + extensions1 = tuple([".h"]) + extensions2 = tuple([".c"]) for srcdir in srcdirs: for filename in os.listdir(srcdir): if filename.endswith(extensions1): path = os.path.join(srcdir, filename) if not self.ScanFile(path, parser): return False + for filename in os.listdir(srcdir): + if filename.endswith(extensions2): + path = os.path.join(srcdir, filename) + if not self.ScanFile(path, parser): + return False return True def ScanFile(self, path, parser): diff --git a/Tools/px_generate_params.py b/Tools/px_generate_params.py index 770469ac72..103e0c3bce 100755 --- a/Tools/px_generate_params.py +++ b/Tools/px_generate_params.py @@ -9,13 +9,12 @@ import argparse from jinja2 import Environment, FileSystemLoader import os -def generate(xml_file, dest='.', modules=None): +def generate(xml_file, dest='.'): """ Generate px4 param source from xml. @param xml_file: input parameter xml file @param dest: Destination directory for generated files - @param modules: The list of px4 modules to search for params. None means to scan everything. """ # pylint: disable=broad-except @@ -26,9 +25,6 @@ def generate(xml_file, dest='.', modules=None): for group in root: if group.tag == "group" and "no_code_generation" not in group.attrib: for param in group: - scope_ = param.find('scope').text - if (modules is not None) and (not scope_ in modules): - continue params.append(param) params = sorted(params, key=lambda name: name.attrib["name"]) @@ -55,9 +51,8 @@ def generate(xml_file, dest='.', modules=None): if __name__ == "__main__": arg_parser = argparse.ArgumentParser() arg_parser.add_argument("--xml", help="parameter xml file") - arg_parser.add_argument("--modules", help="px4 module list", default=None) arg_parser.add_argument("--dest", help="destination path", default=os.path.curdir) args = arg_parser.parse_args() - generate(xml_file=args.xml, modules=args.modules, dest=args.dest) + generate(xml_file=args.xml, dest=args.dest) # vim: set et fenc=utf-8 ff=unix sts=4 sw=4 ts=4 : diff --git a/Tools/px_generate_xml.sh b/Tools/px_generate_xml.sh deleted file mode 100755 index 65f0c95dab..0000000000 --- a/Tools/px_generate_xml.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -python px_process_params.py --xml diff --git a/Tools/px_process_params.py b/Tools/px_process_params.py index 841edebb48..76eb02b4be 100755 --- a/Tools/px_process_params.py +++ b/Tools/px_process_params.py @@ -77,10 +77,10 @@ def main(): help="Inject additional param XML file" " (default FILENAME: ../Tools/parameters_injected.xml)") parser.add_argument("-b", "--board", - nargs='?', - const="", - metavar="BOARD", - help="Board to create xml parameter xml for") + nargs='?', + const="", + metavar="BOARD", + help="Board to create xml parameter xml for") parser.add_argument("-m", "--markdown", nargs='?', const="parameters.md", @@ -118,13 +118,14 @@ def main(): metavar="SUMMARY", default="Automagically updated parameter documentation from code.", help="DokuWiki page edit summary") - parser.add_argument('-v', '--verbose', action='store_true', help="verbose output") + parser.add_argument('-v', '--verbose', + action='store_true', + help="verbose output") parser.add_argument("-o", "--overrides", default="{}", metavar="OVERRIDES", help="a dict of overrides in the form of a json string") - args = parser.parse_args() # Check for valid command @@ -138,8 +139,9 @@ def main(): parser = srcparser.SourceParser() # Scan directories, and parse the files - if (args.verbose): print("Scanning source path " + str(args.src_path)) - + if (args.verbose): + print("Scanning source path " + str(args.src_path)) + if not scanner.ScanDir(args.src_path, parser): sys.exit(1) @@ -162,7 +164,8 @@ def main(): # Output to XML file if args.xml: - if args.verbose: print("Creating XML file " + args.xml) + if args.verbose: + print("Creating XML file " + args.xml) cur_dir = os.path.dirname(os.path.realpath(__file__)) out = xmlout.XMLOutput(param_groups, args.board, os.path.join(cur_dir, args.inject_xml)) diff --git a/Tools/px_update_wiki.sh b/Tools/px_update_wiki.sh deleted file mode 100755 index d66bb9e10b..0000000000 --- a/Tools/px_update_wiki.sh +++ /dev/null @@ -1,2 +0,0 @@ -# Remember to set the XMLRPCUSER and XMLRPCPASS environment variables -python px_process_params.py --wiki-update diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 4ecd019182..450b1ec10e 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -212,7 +212,7 @@ function(px4_add_module) # default stack max to stack main if(NOT STACK_MAIN AND STACK) set(STACK_MAIN ${STACK}) - message(AUTHOR_WARNING "STACK deprecated, USE STACK_MAIN instead!!!!!!!!!!!!") + message(AUTHOR_WARNING "STACK deprecated, USE STACK_MAIN instead!") endif() foreach(property MAIN STACK_MAIN PRIORITY) @@ -245,7 +245,7 @@ function(px4_add_module) endif() if(INCLUDES) - target_include_directories(${MODULE} ${INCLUDES}) + target_include_directories(${MODULE} PRIVATE ${INCLUDES}) endif() if(DEPENDS) diff --git a/cmake/common/px4_metadata.cmake b/cmake/common/px4_metadata.cmake index f5dcc224da..ae8ffa7a36 100644 --- a/cmake/common/px4_metadata.cmake +++ b/cmake/common/px4_metadata.cmake @@ -38,8 +38,6 @@ # utility functions # # * px4_generate_messages -# * px4_generate_parameters_xml -# * px4_generate_parameters_source # * px4_generate_airframes_xml # @@ -167,116 +165,6 @@ function(px4_generate_messages) endif() endfunction() -#============================================================================= -# -# px4_generate_parameters_xml -# -# Generates a parameters.xml file. -# -# Usage: -# px4_generate_parameters_xml(OUT ) -# -# Input: -# BOARD : the board -# MODULES : a list of px4 modules used to limit scope of the paramaters -# OVERRIDES : A json dict with param names as keys and param default -# overrides as values -# -# Output: -# OUT : the generated xml file -# -# Example: -# px4_generate_parameters_xml(OUT parameters.xml) -# -function(px4_generate_parameters_xml) - px4_parse_function_args( - NAME px4_generate_parameters_xml - ONE_VALUE OUT BOARD OVERRIDES - MULTI_VALUE MODULES - REQUIRED MODULES OUT BOARD - ARGN ${ARGN}) - set(path ${PX4_SOURCE_DIR}/src) - file(GLOB_RECURSE param_src_files - ${PX4_SOURCE_DIR}/src/*params.c - ) - if (NOT OVERRIDES) - set(OVERRIDES "{}") - endif() - - # get full path for each module - set(module_list) - 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 - -s ${module_list} ${EXTERNAL_MODULES_LOCATION} - --board CONFIG_ARCH_${BOARD} --xml --inject-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() - -#============================================================================= -# -# px4_generate_parameters_source -# -# Generates a source file with all parameters. -# -# Usage: -# px4_generate_parameters_source(OUT XML MODULES px4 module list) -# -# Input: -# XML : the parameters.xml file -# MODULES : a list of px4 modules used to limit scope of the paramaters -# DEPS : target dependencies -# -# Output: -# OUT : the generated source files -# -# Example: -# px4_generate_parameters_source(OUT param_files XML parameters.xml MODULES lib/controllib modules/ekf2) -# -function(px4_generate_parameters_source) - px4_parse_function_args( - NAME px4_generate_parameters_source - ONE_VALUE OUT XML DEPS - MULTI_VALUE MODULES - REQUIRED MODULES OUT XML - ARGN ${ARGN}) - - set(generated_files - ${CMAKE_CURRENT_BINARY_DIR}/px4_parameters.h - ${CMAKE_CURRENT_BINARY_DIR}/px4_parameters.c) - - set_source_files_properties(${generated_files} PROPERTIES GENERATED TRUE) - - 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() - #============================================================================= # # px4_generate_airframes_xml @@ -299,14 +187,15 @@ endfunction() function(px4_generate_airframes_xml) px4_parse_function_args( NAME px4_generate_airframes_xml - ONE_VALUE OUT BOARD - REQUIRED OUT BOARD + ONE_VALUE BOARD + REQUIRED BOARD ARGN ${ARGN}) - set(process_airframes ${PX4_SOURCE_DIR}/Tools/px_process_airframes.py) - add_custom_command(OUTPUT ${OUT} - COMMAND ${PYTHON_EXECUTABLE} ${process_airframes} + + add_custom_command(OUTPUT ${PX4_SOURCE_DIR}/airframes.xml + COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/px_process_airframes.py -a ${PX4_SOURCE_DIR}/ROMFS/${config_romfs_root}/init.d --board CONFIG_ARCH_BOARD_${BOARD} --xml + DEPENDS ${PX4_SOURCE_DIR}/Tools/px_process_airframes.py ) - set(${OUT} ${${OUT}} PARENT_SCOPE) + add_custom_target(airframes_xml DEPENDS ${PX4_SOURCE_DIR}/airframes.xml) endfunction() diff --git a/cmake/configs/nuttx_aerocore2_default.cmake b/cmake/configs/nuttx_aerocore2_default.cmake index ea73e86ed1..bf8e8bae0d 100644 --- a/cmake/configs/nuttx_aerocore2_default.cmake +++ b/cmake/configs/nuttx_aerocore2_default.cmake @@ -103,7 +103,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/nuttx_aerofc-v1_default.cmake b/cmake/configs/nuttx_aerofc-v1_default.cmake index 5bdb509015..af13fa6f9a 100644 --- a/cmake/configs/nuttx_aerofc-v1_default.cmake +++ b/cmake/configs/nuttx_aerofc-v1_default.cmake @@ -83,7 +83,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/nuttx_auav-x21_default.cmake b/cmake/configs/nuttx_auav-x21_default.cmake index c60e67f4dc..8fc302dfb8 100644 --- a/cmake/configs/nuttx_auav-x21_default.cmake +++ b/cmake/configs/nuttx_auav-x21_default.cmake @@ -125,7 +125,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/nuttx_crazyflie_default.cmake b/cmake/configs/nuttx_crazyflie_default.cmake index b6886f803f..3d8fcb339e 100644 --- a/cmake/configs/nuttx_crazyflie_default.cmake +++ b/cmake/configs/nuttx_crazyflie_default.cmake @@ -75,7 +75,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/nuttx_esc35-v1_default.cmake b/cmake/configs/nuttx_esc35-v1_default.cmake index 038e1366ac..63eca8132e 100644 --- a/cmake/configs/nuttx_esc35-v1_default.cmake +++ b/cmake/configs/nuttx_esc35-v1_default.cmake @@ -64,7 +64,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib modules/uORB lib/version diff --git a/cmake/configs/nuttx_mindpx-v2_default.cmake b/cmake/configs/nuttx_mindpx-v2_default.cmake index a7d51b4ec4..efd41d3d39 100644 --- a/cmake/configs/nuttx_mindpx-v2_default.cmake +++ b/cmake/configs/nuttx_mindpx-v2_default.cmake @@ -127,7 +127,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/nuttx_px4-stm32f4discovery_default.cmake b/cmake/configs/nuttx_px4-stm32f4discovery_default.cmake index 98be8fc85d..59f352a2eb 100644 --- a/cmake/configs/nuttx_px4-stm32f4discovery_default.cmake +++ b/cmake/configs/nuttx_px4-stm32f4discovery_default.cmake @@ -29,7 +29,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/nuttx_px4cannode-v1_default.cmake b/cmake/configs/nuttx_px4cannode-v1_default.cmake index 5049a8eca8..3df9a3ec90 100644 --- a/cmake/configs/nuttx_px4cannode-v1_default.cmake +++ b/cmake/configs/nuttx_px4cannode-v1_default.cmake @@ -55,7 +55,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib modules/uORB lib/version diff --git a/cmake/configs/nuttx_px4esc-v1_default.cmake b/cmake/configs/nuttx_px4esc-v1_default.cmake index d4ad4e0439..6c146318d2 100644 --- a/cmake/configs/nuttx_px4esc-v1_default.cmake +++ b/cmake/configs/nuttx_px4esc-v1_default.cmake @@ -64,7 +64,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib lib/version diff --git a/cmake/configs/nuttx_px4fmu-v1_default.cmake b/cmake/configs/nuttx_px4fmu-v1_default.cmake index 739dc6ca60..00ac027a6a 100644 --- a/cmake/configs/nuttx_px4fmu-v1_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v1_default.cmake @@ -98,7 +98,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/nuttx_px4fmu-v2_default.cmake b/cmake/configs/nuttx_px4fmu-v2_default.cmake index 5ed26e5a30..cba2cdddda 100644 --- a/cmake/configs/nuttx_px4fmu-v2_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v2_default.cmake @@ -129,7 +129,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/nuttx_px4fmu-v2_test.cmake b/cmake/configs/nuttx_px4fmu-v2_test.cmake index db89ab552d..cb7df79efd 100644 --- a/cmake/configs/nuttx_px4fmu-v2_test.cmake +++ b/cmake/configs/nuttx_px4fmu-v2_test.cmake @@ -123,7 +123,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/nuttx_px4fmu-v3_default.cmake b/cmake/configs/nuttx_px4fmu-v3_default.cmake index d47e21be70..716b0acb4e 100644 --- a/cmake/configs/nuttx_px4fmu-v3_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v3_default.cmake @@ -134,7 +134,7 @@ set(config_module_list # Library modules # modules/dataman - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/nuttx_px4fmu-v4_default.cmake b/cmake/configs/nuttx_px4fmu-v4_default.cmake index 5d1a2939cd..de2238559a 100644 --- a/cmake/configs/nuttx_px4fmu-v4_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v4_default.cmake @@ -133,7 +133,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/nuttx_px4fmu-v4pro_default.cmake b/cmake/configs/nuttx_px4fmu-v4pro_default.cmake index 2775814cb5..24dff87018 100644 --- a/cmake/configs/nuttx_px4fmu-v4pro_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v4pro_default.cmake @@ -135,7 +135,7 @@ set(config_module_list # Library modules # modules/dataman - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/nuttx_px4fmu-v5_default.cmake b/cmake/configs/nuttx_px4fmu-v5_default.cmake index 15ee985b38..e97a0eff5d 100644 --- a/cmake/configs/nuttx_px4fmu-v5_default.cmake +++ b/cmake/configs/nuttx_px4fmu-v5_default.cmake @@ -133,7 +133,7 @@ set(config_module_list # Library modules # modules/dataman - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/nuttx_px4nucleoF767ZI-v1_default.cmake b/cmake/configs/nuttx_px4nucleoF767ZI-v1_default.cmake index f2b4d15c25..3a6017dab4 100644 --- a/cmake/configs/nuttx_px4nucleoF767ZI-v1_default.cmake +++ b/cmake/configs/nuttx_px4nucleoF767ZI-v1_default.cmake @@ -111,7 +111,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/nuttx_s2740vc-v1_default.cmake b/cmake/configs/nuttx_s2740vc-v1_default.cmake index 7823cf1bdc..596a15bad0 100644 --- a/cmake/configs/nuttx_s2740vc-v1_default.cmake +++ b/cmake/configs/nuttx_s2740vc-v1_default.cmake @@ -55,7 +55,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib lib/version diff --git a/cmake/configs/nuttx_tap-v1_default.cmake b/cmake/configs/nuttx_tap-v1_default.cmake index 0c779adc0a..f4334d26a9 100644 --- a/cmake/configs/nuttx_tap-v1_default.cmake +++ b/cmake/configs/nuttx_tap-v1_default.cmake @@ -79,7 +79,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/posix_bebop_default.cmake b/cmake/configs/posix_bebop_default.cmake index 7b2b5f4f0d..a65ed2da79 100644 --- a/cmake/configs/posix_bebop_default.cmake +++ b/cmake/configs/posix_bebop_default.cmake @@ -62,7 +62,7 @@ set(config_module_list modules/sdlog2 modules/logger modules/commander - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/posix_eagle_hil.cmake b/cmake/configs/posix_eagle_hil.cmake index ceda98b0fe..fc08ae92ee 100644 --- a/cmake/configs/posix_eagle_hil.cmake +++ b/cmake/configs/posix_eagle_hil.cmake @@ -28,7 +28,7 @@ set(config_module_list modules/mavlink - modules/param + modules/systemlib/param modules/systemlib modules/uORB modules/sensors diff --git a/cmake/configs/posix_ocpoc_cross.cmake b/cmake/configs/posix_ocpoc_cross.cmake index 21979cbc01..1a5e47bc63 100644 --- a/cmake/configs/posix_ocpoc_cross.cmake +++ b/cmake/configs/posix_ocpoc_cross.cmake @@ -56,7 +56,7 @@ set(config_module_list modules/sdlog2 modules/logger modules/commander - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/posix_rpi_common.cmake b/cmake/configs/posix_rpi_common.cmake index 3dca20173b..9a6e143e68 100644 --- a/cmake/configs/posix_rpi_common.cmake +++ b/cmake/configs/posix_rpi_common.cmake @@ -61,7 +61,7 @@ set(config_module_list modules/sdlog2 modules/logger modules/commander - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/posix_sdflight_default.cmake b/cmake/configs/posix_sdflight_default.cmake index 256bb0968e..3a0969929b 100644 --- a/cmake/configs/posix_sdflight_default.cmake +++ b/cmake/configs/posix_sdflight_default.cmake @@ -52,7 +52,7 @@ set(config_module_list modules/mc_pos_control modules/mc_att_control - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/posix_sdflight_legacy.cmake b/cmake/configs/posix_sdflight_legacy.cmake index 3185da6800..d6685e2123 100644 --- a/cmake/configs/posix_sdflight_legacy.cmake +++ b/cmake/configs/posix_sdflight_legacy.cmake @@ -44,7 +44,7 @@ set(config_module_list modules/mc_pos_control modules/mc_att_control - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/posix_sitl_default.cmake b/cmake/configs/posix_sitl_default.cmake index c7dd8ef2a5..77c1471d09 100644 --- a/cmake/configs/posix_sitl_default.cmake +++ b/cmake/configs/posix_sitl_default.cmake @@ -99,7 +99,7 @@ set(config_module_list # Library modules # modules/dataman - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/posix_sitl_replay.cmake b/cmake/configs/posix_sitl_replay.cmake index a6a3d23d0a..a1878ab068 100644 --- a/cmake/configs/posix_sitl_replay.cmake +++ b/cmake/configs/posix_sitl_replay.cmake @@ -12,7 +12,7 @@ set(config_module_list systemcmds/ver systemcmds/perf modules/uORB - modules/param + modules/systemlib/param modules/systemlib modules/ekf2 modules/ekf2_replay diff --git a/cmake/configs/qurt_eagle_hello.cmake b/cmake/configs/qurt_eagle_hello.cmake index 33c43356da..f8fd30f33b 100644 --- a/cmake/configs/qurt_eagle_hello.cmake +++ b/cmake/configs/qurt_eagle_hello.cmake @@ -31,7 +31,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib modules/uORB diff --git a/cmake/configs/qurt_eagle_hil.cmake b/cmake/configs/qurt_eagle_hil.cmake index 3736c79a15..bc9bfbc124 100644 --- a/cmake/configs/qurt_eagle_hil.cmake +++ b/cmake/configs/qurt_eagle_hil.cmake @@ -52,7 +52,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/qurt_eagle_muorb.cmake b/cmake/configs/qurt_eagle_muorb.cmake index 3bb2dfd561..7f34764a32 100644 --- a/cmake/configs/qurt_eagle_muorb.cmake +++ b/cmake/configs/qurt_eagle_muorb.cmake @@ -31,7 +31,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib modules/uORB diff --git a/cmake/configs/qurt_eagle_test.cmake b/cmake/configs/qurt_eagle_test.cmake index 78a059d14f..c046420a6e 100644 --- a/cmake/configs/qurt_eagle_test.cmake +++ b/cmake/configs/qurt_eagle_test.cmake @@ -31,7 +31,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/qurt_eagle_travis.cmake b/cmake/configs/qurt_eagle_travis.cmake index a4d4d2bc33..09a6538847 100644 --- a/cmake/configs/qurt_eagle_travis.cmake +++ b/cmake/configs/qurt_eagle_travis.cmake @@ -57,7 +57,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/qurt_sdflight_default.cmake b/cmake/configs/qurt_sdflight_default.cmake index 172289a8ad..2fbd8c2946 100644 --- a/cmake/configs/qurt_sdflight_default.cmake +++ b/cmake/configs/qurt_sdflight_default.cmake @@ -62,7 +62,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/configs/qurt_sdflight_legacy.cmake b/cmake/configs/qurt_sdflight_legacy.cmake index 6ab749204b..24e0da9e82 100644 --- a/cmake/configs/qurt_sdflight_legacy.cmake +++ b/cmake/configs/qurt_sdflight_legacy.cmake @@ -58,7 +58,7 @@ set(config_module_list # # Library modules # - modules/param + modules/systemlib/param modules/systemlib modules/systemlib/mixer modules/uORB diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index abaf22e225..562cc6c984 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -81,17 +81,19 @@ function(px4_nuttx_add_firmware) ARGN ${ARGN}) set(extra_args) - + set(dependencies) if (PARAM_XML) list(APPEND extra_args --parameter_xml ${PARAM_XML} ) + list(APPEND dependencies parameters_xml) endif() if (AIRFRAMES_XML) list(APPEND extra_args --airframe_xml ${AIRFRAMES_XML} ) + list(APPEND dependencies airframes_xml) endif() add_custom_command(OUTPUT ${OUT} ${EXE}.bin @@ -101,7 +103,7 @@ function(px4_nuttx_add_firmware) --git_identity ${PX4_SOURCE_DIR} ${extra_args} --image ${EXE}.bin > ${OUT} - DEPENDS ${EXE} + DEPENDS ${EXE} ${dependencies} ) add_custom_target(build_firmware_${BOARD} ALL DEPENDS ${OUT}) endfunction() diff --git a/cmake/qurt/px4_impl_qurt.cmake b/cmake/qurt/px4_impl_qurt.cmake index c7cff74d5e..8186eaf8fe 100644 --- a/cmake/qurt/px4_impl_qurt.cmake +++ b/cmake/qurt/px4_impl_qurt.cmake @@ -95,10 +95,8 @@ function(px4_qurt_generate_builtin_commands) math(EXPR command_count "${command_count}+1") endif() endforeach() - configure_file(${PX4_SOURCE_DIR}/src/platforms/apps.cpp.in - ${OUT}.cpp) - configure_file(${PX4_SOURCE_DIR}/src/platforms/apps.h.in - ${OUT}.h) + configure_file(${PX4_SOURCE_DIR}/src/platforms/apps.cpp.in ${OUT}.cpp) + configure_file(${PX4_SOURCE_DIR}/src/platforms/apps.h.in ${OUT}.h) endfunction() #============================================================================= @@ -181,8 +179,8 @@ function(px4_os_add_flags) ) # Add the toolchain specific flags - set(added_cflags -O0) - set(added_cxx_flags -O0) + set(added_cflags) + set(added_cxx_flags) # Clear -rdynamic flag which fails for hexagon set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") diff --git a/src/firmware/qurt/CMakeLists.txt b/src/firmware/qurt/CMakeLists.txt index 31127b8b04..3909ecb53d 100644 --- a/src/firmware/qurt/CMakeLists.txt +++ b/src/firmware/qurt/CMakeLists.txt @@ -34,10 +34,10 @@ if ("${QURT_ENABLE_STUBS}" STREQUAL "1") -Wl,--end-group ) else() - message("module_libraries = ${module_libraries}") - message("target_libraries = ${target_libraries}") - message("df_driver_libs = ${df_driver_libs}") - message("module_external_libraries = ${module_external_libraries}") + #message("module_libraries = ${module_libraries}") + #message("target_libraries = ${target_libraries}") + #message("df_driver_libs = ${df_driver_libs}") + #message("module_external_libraries = ${module_external_libraries}") # Generate the DSP lib and stubs but not the apps side executable # The Apps side executable is generated via the posix_eagle_xxxx target QURT_LIB(LIB_NAME px4 diff --git a/src/modules/param/CMakeLists.txt b/src/modules/param/CMakeLists.txt deleted file mode 100644 index 8882af7375..0000000000 --- a/src/modules/param/CMakeLists.txt +++ /dev/null @@ -1,49 +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. -# -############################################################################ - -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -px4_generate_parameters_source(OUT param_files - XML ${PX4_BINARY_DIR}/parameters.xml - MODULES ${config_module_list} - DEPS xml_gen - ) - -px4_add_module( - MODULE modules__param - COMPILE_FLAGS - SRCS ${param_files} - DEPENDS - platforms__common - ) -# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/systemlib/CMakeLists.txt b/src/modules/systemlib/CMakeLists.txt index 6aa1e53c64..938024a8f1 100644 --- a/src/modules/systemlib/CMakeLists.txt +++ b/src/modules/systemlib/CMakeLists.txt @@ -31,9 +31,6 @@ # ############################################################################ -# for generated files -include_directories(${PX4_BINARY_DIR}/src/modules/param) - set(SRCS perf_counter.c conversions.c @@ -55,19 +52,16 @@ if(${OS} STREQUAL "nuttx") list(APPEND SRCS err.c printload.c - param/param.c flashparams/flashparams.c flashparams/flashfs.c up_cxxinitialize.c ) elseif ("${CONFIG_SHMEM}" STREQUAL "1") list(APPEND SRCS - param/param_shmem.c print_load_posix.c ) else() list(APPEND SRCS - param/param.c print_load_posix.c ) endif() @@ -85,6 +79,5 @@ px4_add_module( SRCS ${SRCS} DEPENDS platforms__common - modules__param ) # vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/systemlib/flashparams/flashparams.c b/src/modules/systemlib/flashparams/flashparams.c index bea2327656..5f362084c3 100644 --- a/src/modules/systemlib/flashparams/flashparams.c +++ b/src/modules/systemlib/flashparams/flashparams.c @@ -341,8 +341,6 @@ int flash_param_save(void) return param_export_internal(false); } - - int flash_param_load(void) { param_reset_all(); diff --git a/src/modules/systemlib/param/CMakeLists.txt b/src/modules/systemlib/param/CMakeLists.txt new file mode 100644 index 0000000000..1361b109b2 --- /dev/null +++ b/src/modules/systemlib/param/CMakeLists.txt @@ -0,0 +1,101 @@ +############################################################################ +# +# Copyright (c) 2017 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. +# +############################################################################ + +set(SRCS) +if ("${CONFIG_SHMEM}" STREQUAL "1") + message(STATUS "parameters shared memory enabled") + list(APPEND SRCS + param_shmem.c + ) +else() + list(APPEND SRCS + param.c + ) +endif() + +if (NOT PARAM_DEFAULT_OVERRIDES) + set(PARAM_DEFAULT_OVERRIDES "{}") +endif() + +# get full path for each module +set(module_list) +if (DISABLE_PARAMS_MODULE_SCOPING) + # search all directories with .c files (potentially containing parameters) + file(GLOB_RECURSE new_list ${PX4_SOURCE_DIR}/src/*.c) + foreach(file_path ${new_list}) + get_filename_component(dir_path ${file_path} PATH) + list(APPEND module_list "${dir_path}") + endforeach() + list(REMOVE_DUPLICATES module_list) +else() + foreach(module ${config_module_list}) + list(APPEND module_list ${PX4_SOURCE_DIR}/src/${module}) + endforeach() +endif() + +set(parameters_xml ${PX4_BINARY_DIR}/parameters.xml) +file(GLOB_RECURSE param_src_files ${PX4_SOURCE_DIR}/src/*params.c) +add_custom_command(OUTPUT ${parameters_xml} + COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/px_process_params.py + -s ${module_list} ${EXTERNAL_MODULES_LOCATION} + --board CONFIG_ARCH_${BOARD} --xml --inject-xml + --overrides ${PARAM_DEFAULT_OVERRIDES} + DEPENDS ${param_src_files} ${PX4_SOURCE_DIR}/Tools/px_process_params.py + WORKING_DIRECTORY ${PX4_BINARY_DIR} +) +add_custom_target(parameters_xml DEPENDS ${parameters_xml}) + +# generate px4_parameters.c and px4_parameters.h +add_custom_command(OUTPUT px4_parameters.c px4_parameters.h + COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/px_generate_params.py + --xml ${parameters_xml} --dest ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS + ${parameters_xml} + ${PX4_SOURCE_DIR}/Tools/px_generate_params.py + ${PX4_SOURCE_DIR}/Tools/templates/px4_parameters.c.jinja + ${PX4_SOURCE_DIR}/Tools/templates/px4_parameters.h.jinja + ) +set_source_files_properties(px4_parameters.c PROPERTIES GENERATED TRUE) + +px4_add_module( + MODULE modules__systemlib__param + COMPILE_FLAGS + INCLUDES + ${CMAKE_CURRENT_BINARY_DIR} + SRCS + ${SRCS} + px4_parameters.c + DEPENDS + platforms__common + ) +# vim: set noet ft=cmake fenc=utf-8 ff=unix : diff --git a/src/modules/systemlib/param/param.c b/src/modules/systemlib/param/param.c index 3403d3aedc..ec075aa71b 100644 --- a/src/modules/systemlib/param/param.c +++ b/src/modules/systemlib/param/param.c @@ -64,7 +64,7 @@ #include "systemlib/uthash/utarray.h" #include "systemlib/bson/tinybson.h" -//#define PARAM_NO_ORB ///< if defined, avoid uorb depenency. This disables publication of parameter_update on param change +//#define PARAM_NO_ORB ///< if defined, avoid uorb dependency. This disables publication of parameter_update on param change //#define PARAM_NO_AUTOSAVE ///< if defined, do not autosave (avoids LP work queue dependency) #if !defined(PARAM_NO_ORB)