diff --git a/Tools/sitl_run.sh b/Tools/sitl_run.sh index c6961765e0..159a3a232b 100755 --- a/Tools/sitl_run.sh +++ b/Tools/sitl_run.sh @@ -5,7 +5,7 @@ set -e echo args: $@ sitl_bin=$1 -label=$2 +rcS_dir=$2 debugger=$3 program=$4 model=$5 @@ -15,7 +15,7 @@ build_path=$7 echo SITL ARGS echo sitl_bin: $sitl_bin -echo label: $label +echo rcS_dir: $rcS_dir echo debugger: $debugger echo program: $program echo model: $model @@ -40,9 +40,9 @@ then model="iris" fi -if [ "$#" -lt 5 ] +if [ "$#" -lt 7 ] then - echo usage: sitl_run.sh rc_script debugger program model devel_path + echo usage: sitl_run.sh rc_script rcS_dir debugger program model src_path build_path echo "" exit 1 fi @@ -109,7 +109,7 @@ fi # Do not exit on failure now from here on because we want the complete cleanup set +e -sitl_command="$sudo_enabled $sitl_bin $chroot_enabled $src_path $src_path/${label}/${model}" +sitl_command="$sudo_enabled $sitl_bin $chroot_enabled $src_path $src_path/${rcS_dir}/${model}" echo SITL COMMAND: $sitl_command diff --git a/cmake/common/px4_base.cmake b/cmake/common/px4_base.cmake index 0f3ba5d148..c30d79d6c7 100644 --- a/cmake/common/px4_base.cmake +++ b/cmake/common/px4_base.cmake @@ -98,9 +98,6 @@ include(CMakeParseArguments) function(px4_parse_function_args) cmake_parse_arguments(IN "" "NAME" "OPTIONS;ONE_VALUE;MULTI_VALUE;REQUIRED;ARGN" "${ARGN}") cmake_parse_arguments(OUT "${IN_OPTIONS}" "${IN_ONE_VALUE}" "${IN_MULTI_VALUE}" "${IN_ARGN}") - if (OUT_UNPARSED_ARGUMENTS) - message(FATAL_ERROR "${IN_NAME}: unparsed ${OUT_UNPARSED_ARGUMENTS}") - endif() foreach(arg ${IN_REQUIRED}) if (NOT OUT_${arg}) message(FATAL_ERROR "${IN_NAME} requires argument ${arg}\nARGN: ${IN_ARGN}") @@ -239,7 +236,7 @@ endfunction() # STACK : deprecated use stack main instead # STACK_MAIN : size of stack for main function # STACK_MAX : maximum stack size of any frame -# COMPILE_FLAGS : compile flags +# COMPILE_FLAGS : compile flags # LINK_FLAGS : link flags # SRCS : source files # INCLUDES : include directories @@ -573,7 +570,7 @@ endfunction() # # px4_add_common_flags # -# Set ths default build flags. +# Set the default build flags. # # Usage: # px4_add_common_flags( @@ -591,8 +588,8 @@ endfunction() # Input/Output: (appends to existing variable) # C_FLAGS : c compile flags variable # CXX_FLAGS : c++ compile flags variable -# EXE_LINKER_FLAGS : executable linker flags variable -# INCLUDE_DIRS : include directories +# EXE_LINKER_FLAGS : executable linker flags variable +# INCLUDE_DIRS : include directories # LINK_DIRS : link directories # DEFINITIONS : definitions # diff --git a/cmake/configs/posix_sitl_replay.cmake b/cmake/configs/posix_sitl_replay.cmake index a20a2d8cfe..28576424bf 100644 --- a/cmake/configs/posix_sitl_replay.cmake +++ b/cmake/configs/posix_sitl_replay.cmake @@ -34,9 +34,8 @@ set(config_extra_builtin_cmds sercon ) -set(config_sitl_rcS - posix-configs/SITL/init/rcS - CACHE FILEPATH "init script for sitl" +set(config_sitl_rcS_dir + posix-configs/SITL/init/replay ) set(config_sitl_viewer diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 32983d648f..55e87ac8f3 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -209,7 +209,7 @@ function(px4_nuttx_add_export) REGEX "CONFIG_ARMV7M_STACKCHECK=y" ) if ("${hw_stack_check_${CONFIG}}" STREQUAL "CONFIG_ARMV7M_STACKCHECK=y") - set(config_nuttx_hw_stack_check_${CONFIG} y CACHE INTERNAL "" FORCE) + set(config_nuttx_hw_stack_check_${CONFIG} y CACHE INTERNAL "") endif() # copy and export @@ -365,7 +365,7 @@ endfunction() # # px4_os_add_flags # -# Set ths nuttx build flags. +# Set the nuttx build flags. # # Usage: # px4_os_add_flags( @@ -382,8 +382,8 @@ endfunction() # Input/Output: (appends to existing variable) # C_FLAGS : c compile flags variable # CXX_FLAGS : c++ compile flags variable -# EXE_LINKER_FLAGS : executable linker flags variable -# INCLUDE_DIRS : include directories +# EXE_LINKER_FLAGS : executable linker flags variable +# INCLUDE_DIRS : include directories # LINK_DIRS : link directories # DEFINITIONS : definitions # @@ -400,7 +400,7 @@ function(px4_os_add_flags) C_FLAGS CXX_FLAGS EXE_LINKER_FLAGS INCLUDE_DIRS LINK_DIRS DEFINITIONS) px4_parse_function_args( - NAME px4_add_flags + NAME px4_os_add_flags ONE_VALUE ${inout_vars} BOARD REQUIRED ${inout_vars} BOARD ARGN ${ARGN}) diff --git a/cmake/posix/px4_impl_posix.cmake b/cmake/posix/px4_impl_posix.cmake index 4893f884fb..d5757f7247 100644 --- a/cmake/posix/px4_impl_posix.cmake +++ b/cmake/posix/px4_impl_posix.cmake @@ -42,7 +42,7 @@ # * px4_posix_add_export # * px4_posix_generate_romfs # -# Required OS Inteface Functions +# Required OS Interface Functions # # * px4_os_add_flags # * px4_os_prebuild_targets @@ -126,8 +126,8 @@ endfunction() # Input/Output: (appends to existing variable) # C_FLAGS : c compile flags variable # CXX_FLAGS : c++ compile flags variable -# EXE_LINKER_FLAGS : executable linker flags variable -# INCLUDE_DIRS : include directories +# EXE_LINKER_FLAGS : executable linker flags variable +# INCLUDE_DIRS : include directories # LINK_DIRS : link directories # DEFINITIONS : definitions # @@ -144,7 +144,7 @@ function(px4_os_add_flags) C_FLAGS CXX_FLAGS EXE_LINKER_FLAGS INCLUDE_DIRS LINK_DIRS DEFINITIONS) px4_parse_function_args( - NAME px4_add_flags + NAME px4_os_add_flags ONE_VALUE ${inout_vars} BOARD REQUIRED ${inout_vars} BOARD ARGN ${ARGN}) diff --git a/cmake/qurt/px4_impl_qurt.cmake b/cmake/qurt/px4_impl_qurt.cmake index f5387c515e..118a9a8caa 100644 --- a/cmake/qurt/px4_impl_qurt.cmake +++ b/cmake/qurt/px4_impl_qurt.cmake @@ -102,7 +102,7 @@ endfunction() # # px4_os_add_flags # -# Set ths qurt build flags. +# Set the qurt build flags. # # Usage: # px4_os_add_flags( @@ -119,8 +119,8 @@ endfunction() # Input/Output: (appends to existing variable) # C_FLAGS : c compile flags variable # CXX_FLAGS : c++ compile flags variable -# EXE_LINKER_FLAGS : executable linker flags variable -# INCLUDE_DIRS : include directories +# EXE_LINKER_FLAGS : executable linker flags variable +# INCLUDE_DIRS : include directories # LINK_DIRS : link directories # DEFINITIONS : definitions # @@ -137,7 +137,7 @@ function(px4_os_add_flags) C_FLAGS CXX_FLAGS EXE_LINKER_FLAGS INCLUDE_DIRS LINK_DIRS DEFINITIONS) px4_parse_function_args( - NAME px4_add_flags + NAME px4_os_add_flags ONE_VALUE ${inout_vars} BOARD REQUIRED ${inout_vars} BOARD ARGN ${ARGN}) diff --git a/src/modules/mavlink/mavlink_ftp.cpp b/src/modules/mavlink/mavlink_ftp.cpp index e6fe801d5e..6834d91266 100644 --- a/src/modules/mavlink/mavlink_ftp.cpp +++ b/src/modules/mavlink/mavlink_ftp.cpp @@ -489,7 +489,7 @@ MavlinkFTP::_workOpen(PayloadHeader *payload, int oflag) payload->session = 0; payload->size = sizeof(uint32_t); - *((uint32_t *)payload->data) = fileSize; + std::memcpy(payload->data, &fileSize, payload->size); return kErrNone; } @@ -574,7 +574,7 @@ MavlinkFTP::_workWrite(PayloadHeader *payload) } payload->size = sizeof(uint32_t); - *((uint32_t *)payload->data) = bytes_written; + std::memcpy(payload->data, &bytes_written, payload->size); return kErrNone; } @@ -798,7 +798,7 @@ MavlinkFTP::_workCalcFileCRC32(PayloadHeader *payload) ::close(fd); payload->size = sizeof(uint32_t); - *((uint32_t *)payload->data) = checksum; + std::memcpy(payload->data, &checksum, payload->size); return kErrNone; }