forked from Archive/PX4-Autopilot
Bug fixes, typos, indentation.
Over time I made a few changes unrelated to what I'm really working on. These changes are hereby committed first. The bug fixes are related to what I'm doing in that I need them to be fixed for future commits. Tools/sitl_run.sh: rename label to rcS_dir and fix usage help. cmake/common/px4_base.cmake: Remove the check on OUT_UNPARSED_ARGUMENTS, and a few typos and indentation issues. cmake/configs/posix_sitl_replay.cmake: Set the correct variable (config_sitl_rcS_dir) to the correct directory. cmake/nuttx/px4_impl_nuttx.cmake: typos and indentation issues, and removal of a redundant FORCE (INTERNAL implies FORCE). cmake/posix/px4_impl_posix.cmake: typos and indentation issues. cmake/qurt/px4_impl_qurt.cmake: typos and indentation issues. src/modules/mavlink/mavlink_ftp.cpp : possible strict-aliasing breakage. NOTES The second argument passed to sitl_run.sh is the value of config_sitl_rcS_dir. This fact is missing from the usage help. I renamed 'label' to 'rcS_dir' to better reflect this. Also, for the 'replay' config the wrong variable was set causing the call to sitl_run.sh to skip an argument and fail (ie the debugger was passed as rcS_dir and so on). The check on OUT_UNPARSED_ARGUMENTS in px4_parse_function_args basically causes every passed IN variable to be REQUIRED and is therefore a bug. The test for the presence of the REQUIRED arguments follows directly after and is sufficient for this job. This bug went unnoticed because currently every argument to OPTIONS, ONE_VALUE, and MULTI_VALUE is actually passed to the function(s) calling px4_parse_function_args (them being REQUIRED or not). The changes in mavlink_ftp.cpp are to avoid a possible aliasing bug and (mostly) to avoid the compiler warning/error: dereferencing type- punned pointer will break strict-aliasing rules [-Werror=strict-aliasing].
This commit is contained in:
parent
6c7e5651ce
commit
03d176d097
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
#
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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})
|
||||
|
|
|
@ -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})
|
||||
|
|
|
@ -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})
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue