Error when buliding PX4 firmware with some deactivated modules
7 views (last 30 days)
Show older comments
Yifan Zhang
on 12 Sep 2024
Commented: Yifan Zhang
on 16 Sep 2024
Dear all,
I am currently using simulink to impememt my filght controller into Pixhawk 6x. At the step of building PX4 firmware I followed this tutorial https://de.mathworks.com/help/uav/px4/ug/disable-control-modules.html to avoid flash memory overflow issues, since building a default PX4 firmware itself takes already 99% of the total flash usage.
I change the code
CONFIG_MODULES_MC_ATT_CONTROL=y
to
CONFIG_MODULES_MC_ATT_CONTROL=n
in the file default.px4board.original and resave it as a new file hil.px4board. in the same folder.
In the Hardware Setup screen I tried to build ths new firmware but there is then an Error in cmd window,saying:
[706/1094] Building CXX object src/modules/flight_mode_manager/CMakeFiles/modules__flight_mode_manager.dir/FlightModeManager.cpp.obj
FAILED: src/modules/flight_mode_manager/CMakeFiles/modules__flight_mode_manager.dir/FlightModeManager.cpp.obj
/usr/bin/ccache /opt/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-g++ -DCONFIG_ARCH_BOARD_PX4_FMU_V6X -DMODULE_NAME=\"flight_mode_manager\" -DPX4_MAIN=flight_mode_manager_app_main -D_SYS_CDEFS_H_ -D_SYS_REENT_H_ -D__CUSTOM_FILE_IO__ -D__PX4_NUTTX -D__STDC_FORMAT_MACROS -I../../boards/px4/fmu-v6x/src -I../../platforms/nuttx/src/px4/common/include -I. -Isrc/lib -I../../platforms/nuttx/src/px4/stm/stm32h7/include -I../../platforms/common -I../../platforms/common/include -I../../src -I../../src/include -I../../src/lib -I../../src/lib/matrix -I../../src/modules -I../../platforms/nuttx/NuttX/nuttx/arch/arm/src/armv7-m -I../../platforms/nuttx/NuttX/nuttx/arch/arm/src/chip -I../../platforms/nuttx/NuttX/nuttx/arch/arm/src/common -I../../platforms/nuttx/NuttX/apps/include -Iexternal/Install/include -I../../src/modules/flight_mode_manager -Isrc/modules/flight_mode_manager -I../../src/modules/flight_mode_manager/tasks/Auto -I../../src/modules/flight_mode_manager/tasks/FlightTask -I../../src/modules/flight_mode_manager/tasks/Utility -I../../src/lib/slew_rate -I../../src/lib/motion_planning -I../../src/modules/flight_mode_manager/tasks/Descend -I../../src/modules/flight_mode_manager/tasks/Failsafe -I../../src/modules/flight_mode_manager/tasks/ManualAcceleration -I../../src/modules/flight_mode_manager/tasks/ManualAltitudeSmoothVel -I../../src/modules/flight_mode_manager/tasks/ManualAltitude -I../../src/modules/flight_mode_manager/tasks/ManualPosition -I../../src/modules/flight_mode_manager/tasks/ManualPositionSmoothVel -I../../src/modules/flight_mode_manager/tasks/Transition -I../../src/modules/flight_mode_manager/tasks/AutoFollowTarget -I../../src/modules/flight_mode_manager/tasks/Orbit -isystem ../../platforms/nuttx/NuttX/include/cxx -isystem ../../platforms/nuttx/NuttX/nuttx/include/cxx -isystem ../../platforms/nuttx/NuttX/nuttx/include -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -Os -DNDEBUG -g -fdata-sections -ffunction-sections -fomit-frame-pointer -fmerge-all-constants -fno-signed-zeros -fno-trapping-math -freciprocal-math -fno-math-errno -fno-strict-aliasing -fvisibility=hidden -include visibility.h -Wall -Wextra -Werror -Warray-bounds -Wcast-align -Wdisabled-optimization -Wdouble-promotion -Wfatal-errors -Wfloat-equal -Wformat-security -Winit-self -Wlogical-op -Wpointer-arith -Wshadow -Wuninitialized -Wunknown-pragmas -Wunused-variable -Wno-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fdiagnostics-color=always -Wno-stringop-truncation -fno-builtin-printf -fno-strength-reduce -Wformat=1 -Wunused-but-set-variable -Wno-format-truncation -fcheck-new -Wreorder -Wno-overloaded-virtual -fno-rtti -fno-exceptions -fno-sized-deallocation -fno-threadsafe-statics -nostdinc++ -Wno-cast-align -Wframe-larger-than=2048 -D__KERNEL__ -std=gnu++14 -MD -MT src/modules/flight_mode_manager/CMakeFiles/modules__flight_mode_manager.dir/FlightModeManager.cpp.obj -MF src/modules/flight_mode_manager/CMakeFiles/modules__flight_mode_manager.dir/FlightModeManager.cpp.obj.d -o src/modules/flight_mode_manager/CMakeFiles/modules__flight_mode_manager.dir/FlightModeManager.cpp.obj -c ../../src/modules/flight_mode_manager/FlightModeManager.cpp
In file included from ../../platforms/common/include/px4_platform_common/param.h:42,
from ../../platforms/common/include/px4_platform_common/module_params.h:44,
from ../../src/modules/flight_mode_manager/tasks/FlightTask/FlightTask.hpp:44,
from ../../src/modules/flight_mode_manager/FlightModeManager.hpp:36,
from ../../src/modules/flight_mode_manager/FlightModeManager.cpp:34:
../../src/modules/flight_mode_manager/tasks/Utility/StickTiltXY.hpp:70:28: error: 'MC_MAN_TILT_TAU' is not a member of 'px4::params'; did you mean 'MPC_MAN_TILT_MAX'?
70 | (ParamFloat<px4::params::MC_MAN_TILT_TAU>) _param_mc_man_tilt_tau ///< time constant for stick filter
| ^~~~~~~~~~~~~~~
../../platforms/common/include/px4_platform_common/param_macros.h:239:18: note: in definition of macro 'REM'
239 | #define REM(...) __VA_ARGS__
| ^~~~~~~~~~~
../../platforms/common/include/px4_platform_common/param.h:60:40: note: in expansion of macro 'PAIR'
60 | do_not_explicitly_use_this_namespace::PAIR(x);
| ^~~~
../../platforms/common/include/px4_platform_common/param_macros.h:45:36: note: in expansion of macro '_DEFINE_SINGLE_PARAMETER'
45 | #define APPLY2(t, aaa, aab) t(aaa) t(aab)
| ^
../../platforms/common/include/px4_platform_common/param_macros.h:197:33: note: in expansion of macro 'APPLY2'
197 | #define APPLY_ALL_H3(t, n, ...) APPLY##n(t, __VA_ARGS__)
| ^~~~~
../../platforms/common/include/px4_platform_common/param_macros.h:198:33: note: in expansion of macro 'APPLY_ALL_H3'
198 | #define APPLY_ALL_H2(t, n, ...) APPLY_ALL_H3(t, n, __VA_ARGS__)
| ^~~~~~~~~~~~
../../platforms/common/include/px4_platform_common/param_macros.h:199:27: note: in expansion of macro 'APPLY_ALL_H2'
199 | #define APPLY_ALL(t, ...) APPLY_ALL_H2(t, NUM_ARGS(__VA_ARGS__), __VA_ARGS__)
| ^~~~~~~~~~~~
../../platforms/common/include/px4_platform_common/param.h:81:2: note: in expansion of macro 'APPLY_ALL'
81 | APPLY_ALL(_DEFINE_SINGLE_PARAMETER, __VA_ARGS__) \
| ^~~~~~~~~
../../src/modules/flight_mode_manager/tasks/Utility/StickTiltXY.hpp:68:2: note: in expansion of macro 'DEFINE_PARAMETERS'
68 | DEFINE_PARAMETERS(
| ^~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
and
[707/1094] Building CXX object src/modules/flight_mode_manager/CMakeFiles/modules__flight_mode_manager.dir/FlightTasks_generated.cpp.obj
FAILED: src/modules/flight_mode_manager/CMakeFiles/modules__flight_mode_manager.dir/FlightTasks_generated.cpp.obj
/usr/bin/ccache /opt/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-g++ -DCONFIG_ARCH_BOARD_PX4_FMU_V6X -DMODULE_NAME=\"flight_mode_manager\" -DPX4_MAIN=flight_mode_manager_app_main -D_SYS_CDEFS_H_ -D_SYS_REENT_H_ -D__CUSTOM_FILE_IO__ -D__PX4_NUTTX -D__STDC_FORMAT_MACROS -I../../boards/px4/fmu-v6x/src -I../../platforms/nuttx/src/px4/common/include -I. -Isrc/lib -I../../platforms/nuttx/src/px4/stm/stm32h7/include -I../../platforms/common -I../../platforms/common/include -I../../src -I../../src/include -I../../src/lib -I../../src/lib/matrix -I../../src/modules -I../../platforms/nuttx/NuttX/nuttx/arch/arm/src/armv7-m -I../../platforms/nuttx/NuttX/nuttx/arch/arm/src/chip -I../../platforms/nuttx/NuttX/nuttx/arch/arm/src/common -I../../platforms/nuttx/NuttX/apps/include -Iexternal/Install/include -I../../src/modules/flight_mode_manager -Isrc/modules/flight_mode_manager -I../../src/modules/flight_mode_manager/tasks/Auto -I../../src/modules/flight_mode_manager/tasks/FlightTask -I../../src/modules/flight_mode_manager/tasks/Utility -I../../src/lib/slew_rate -I../../src/lib/motion_planning -I../../src/modules/flight_mode_manager/tasks/Descend -I../../src/modules/flight_mode_manager/tasks/Failsafe -I../../src/modules/flight_mode_manager/tasks/ManualAcceleration -I../../src/modules/flight_mode_manager/tasks/ManualAltitudeSmoothVel -I../../src/modules/flight_mode_manager/tasks/ManualAltitude -I../../src/modules/flight_mode_manager/tasks/ManualPosition -I../../src/modules/flight_mode_manager/tasks/ManualPositionSmoothVel -I../../src/modules/flight_mode_manager/tasks/Transition -I../../src/modules/flight_mode_manager/tasks/AutoFollowTarget -I../../src/modules/flight_mode_manager/tasks/Orbit -isystem ../../platforms/nuttx/NuttX/include/cxx -isystem ../../platforms/nuttx/NuttX/nuttx/include/cxx -isystem ../../platforms/nuttx/NuttX/nuttx/include -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -Os -DNDEBUG -g -fdata-sections -ffunction-sections -fomit-frame-pointer -fmerge-all-constants -fno-signed-zeros -fno-trapping-math -freciprocal-math -fno-math-errno -fno-strict-aliasing -fvisibility=hidden -include visibility.h -Wall -Wextra -Werror -Warray-bounds -Wcast-align -Wdisabled-optimization -Wdouble-promotion -Wfatal-errors -Wfloat-equal -Wformat-security -Winit-self -Wlogical-op -Wpointer-arith -Wshadow -Wuninitialized -Wunknown-pragmas -Wunused-variable -Wno-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fdiagnostics-color=always -Wno-stringop-truncation -fno-builtin-printf -fno-strength-reduce -Wformat=1 -Wunused-but-set-variable -Wno-format-truncation -fcheck-new -Wreorder -Wno-overloaded-virtual -fno-rtti -fno-exceptions -fno-sized-deallocation -fno-threadsafe-statics -nostdinc++ -Wno-cast-align -Wframe-larger-than=2048 -D__KERNEL__ -std=gnu++14 -MD -MT src/modules/flight_mode_manager/CMakeFiles/modules__flight_mode_manager.dir/FlightTasks_generated.cpp.obj -MF src/modules/flight_mode_manager/CMakeFiles/modules__flight_mode_manager.dir/FlightTasks_generated.cpp.obj.d -o src/modules/flight_mode_manager/CMakeFiles/modules__flight_mode_manager.dir/FlightTasks_generated.cpp.obj -c src/modules/flight_mode_manager/FlightTasks_generated.cpp
In file included from ../../platforms/common/include/px4_platform_common/param.h:42,
from ../../platforms/common/include/px4_platform_common/module_params.h:44,
from ../../src/modules/flight_mode_manager/tasks/FlightTask/FlightTask.hpp:44,
from ../../src/modules/flight_mode_manager/FlightModeManager.hpp:36,
from src/modules/flight_mode_manager/FlightTasks_generated.cpp:42:
../../src/modules/flight_mode_manager/tasks/Utility/StickTiltXY.hpp:70:28: error: 'MC_MAN_TILT_TAU' is not a member of 'px4::params'; did you mean 'MPC_MAN_TILT_MAX'?
70 | (ParamFloat<px4::params::MC_MAN_TILT_TAU>) _param_mc_man_tilt_tau ///< time constant for stick filter
| ^~~~~~~~~~~~~~~
../../platforms/common/include/px4_platform_common/param_macros.h:239:18: note: in definition of macro 'REM'
239 | #define REM(...) __VA_ARGS__
| ^~~~~~~~~~~
../../platforms/common/include/px4_platform_common/param.h:60:40: note: in expansion of macro 'PAIR'
60 | do_not_explicitly_use_this_namespace::PAIR(x);
| ^~~~
../../platforms/common/include/px4_platform_common/param_macros.h:45:36: note: in expansion of macro '_DEFINE_SINGLE_PARAMETER'
45 | #define APPLY2(t, aaa, aab) t(aaa) t(aab)
| ^
../../platforms/common/include/px4_platform_common/param_macros.h:197:33: note: in expansion of macro 'APPLY2'
197 | #define APPLY_ALL_H3(t, n, ...) APPLY##n(t, __VA_ARGS__)
| ^~~~~
../../platforms/common/include/px4_platform_common/param_macros.h:198:33: note: in expansion of macro 'APPLY_ALL_H3'
198 | #define APPLY_ALL_H2(t, n, ...) APPLY_ALL_H3(t, n, __VA_ARGS__)
| ^~~~~~~~~~~~
../../platforms/common/include/px4_platform_common/param_macros.h:199:27: note: in expansion of macro 'APPLY_ALL_H2'
199 | #define APPLY_ALL(t, ...) APPLY_ALL_H2(t, NUM_ARGS(__VA_ARGS__), __VA_ARGS__)
| ^~~~~~~~~~~~
../../platforms/common/include/px4_platform_common/param.h:81:2: note: in expansion of macro 'APPLY_ALL'
81 | APPLY_ALL(_DEFINE_SINGLE_PARAMETER, __VA_ARGS__) \
| ^~~~~~~~~
../../src/modules/flight_mode_manager/tasks/Utility/StickTiltXY.hpp:68:2: note: in expansion of macro 'DEFINE_PARAMETERS'
68 | DEFINE_PARAMETERS(
| ^~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
Have you met this issue before and how did you solve it?
any suggestions or advices are welcome.
Thanks in advance.
Y.Z.
2 Comments
Saurabh
on 13 Sep 2024
Hi @Yifan Zhang
After saving the file as "hil.px4board," did you select the newly saved px4board build target using the "custom px4board file" option?
Accepted Answer
Arun Mathamkode
on 13 Sep 2024
PX4 modules have interdependencies. So if you remove one module you have to remove the other as well. That is why the build is failing. To help you here, the support package already provides a few px4baord options that resolve these interdependencies. For example, if you plan to develop a multicopter, you can choose the 'px4_fmu-v6x_multicopter' px4board file and with this, you should not face any flash overflow issues.
Disabling Modules in PX4board Build Target File documentation page lists a set of modules that need to be disabled based on the airframe. You have to disable them as a set, you can't disable one alone as it will result in build failure.
3 Comments
Arun Mathamkode
on 13 Sep 2024
Edited: Arun Mathamkode
on 13 Sep 2024
I think the support package is doing some checks to validate correct cmake. To work this around can you try selecting the target as 'Px4 Pixhawk Series' in Simulink instead of 'PX4 Pixhawk 6x'? You might need to enter the correct COM port to upload the firmware in Simulink model configuration paramters (under Hardware implementation->Target hardware resources->Build Options).
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!