The px4_os_add_flags defined in cmake/posix/px4_impl_posix.cmake did
add (threading) libraries to added_exe_linker_flags, which subsequently
end up in CMAKE_EXE_LINKER_FLAGS and then have no effect because those
flags are passed to the linker before any of the object files and static
libraries.
Those libraries are already added correctly in the corresponding
src/firmware/*/CMakeLists.txt files (for qurt, nuttx AND posix).
I left in the non-library linker flag '-pthread' for the bebop board,
although it seems very weird to me that this is needed (is it?).
If that is needed then it seems weird to link manually (that is,
src/firmware/*/CMakeLists.txt) with -lpthread.
For linux/g++ -pthread is added to the CXXFLAGS as it should be:
this causes the compiler to define _REENTRANT which is needed
for (the interface of) certain libraries to become thread-safe.
Offically one also can just pass -pthread to the linker, which then
causes the right libraries to be linked, but just linking with
-lpthread -lm -lrt works too.
I ran into this while adding support for libcwd, which explicitly
complains that _REENTRANT isn't defined when trying to link with
the thread-safe version of libcwd (-lcwd_r) and then tells you
to use -pthread.
This allows one to set a semi-colon separated list of regular
expressions in the environment variable PX4_NO_OPTIMIZATION
to control which (cmake generated) targets should be compiled
without optimization.
Suppressing optimization can be necessary for debugging in
a debugger, especially when trying to step through the code
or needing to print variables that otherwise are optimized out.
EXAMPLE
export PX4_NO_OPTIMIZATION="px4;^modules__uORB;^modules__systemlib$"
will result in the following messages during cmake configuration:
[...]
-- Disabling optimization for target 'platforms__posix__px4_layer'
because it matches the regexp 'px4' in env var PX4_NO_OPTIMIZATION
-- Disabling optimization for target 'modules__systemlib' because it
matches the regexp '^modules__systemlib$' in env var PX4_NO_OPTIMIZATION
-- Disabling optimization for target 'modules__uORB' because it matches
the regexp '^modules__uORB' in env var PX4_NO_OPTIMIZATION
-- Disabling optimization for target 'examples__px4_simple_app' because
it matches the regexp 'px4' in env var PX4_NO_OPTIMIZATION
-- Disabling optimization for target 'modules__uORB__uORB_tests' because
it matches the regexp '^modules__uORB' in env var PX4_NO_OPTIMIZATION
-- Disabling optimization for target 'px4' because it matches the regexp
'px4' in env var PX4_NO_OPTIMIZATION
Note that a list of all (currently used) target names can be printed
with the following command line from within the required build directory:
find . -wholename '*/CMakeFiles/*.dir/flags.make' | xargs dirname | xargs basename -a | sort -u | sed -e 's/.dir$//'
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].
* Low impact changes from path_cleanup branch.
This is a step towards minimizing the diff with path_cleanup branch.
* Update ecl.
* Revert matrix update.
* Revert ecl and matrix.
* Update sitl gazebo.
* Revert sitl_gazebo and matrix changes.
* Use DriverFramework as a PX4 module
Targets wanting to use DriverFramework must add
lib/DriverFramework/framework
to their config file.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
* Removed spurious code
No need to add if check before for loop
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
* Added DriverFramework to NuttX configs
Added lib/DriverFramework/firmware to nuttx configs
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
* Updated src/lib/DriverFramework
* Removed DF_TARGET and __DF_${OS} defines
These are now handled inside DriverFramework
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
* Updated DriverFramework
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
* Restored __DF_${OS}
The include files in DriverFramwork need to know the target OS.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Nuttx now gets to link phase. But there are two unresolved symbols:
arm-none-eabi/include/c++/4.7.4/bits/basic_string.h:1128: undefined reference to `std::string::assign(char const*, unsigned int)'
arm-none-eabi/include/c++/4.7.4/bits/stl_list.h:1534: undefined reference to `std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)'
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
I am unable to get the nuttx build dependencies set up so that
it builds the export dir before it builds df_driver_framework.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
The DF_TARGET cmake variable needs to be set to (linux, darwin, qurt, nuttx)
The define __DF_LINUX or __DF_QURT needs to be set.
The __DF_DARWIN target is untested
Signed-off-by: Mark Charlebois <charlebm@gmail.com>