Simulink Pixhawk 1 Build Error: "MW_target_hardware_resources.h": No such file or directory
11 views (last 30 days)
Show older comments
Anthony Comer
on 18 Feb 2023
Edited: Arun Mathamkode
on 23 Feb 2023
I have been trying to upload a simple PX4 gyro code in Build, Deploy & Start mode in a Simulink model. I installed the UAV toolbox for PX4 support and followed the instructions and went to test a simple model but continue to get stuck with the following error:
Warning: Compilation failure for command "C:\PX4\T\toolchain\gcc-arm\bin\arm-none-eabi-g++ -DCONFIG_ARCH_BOARD_PX4_FMU_V3 -D__CUSTOM_FILE_IO__ -D__DF_NUTTX -D__PX4_NUTTX -D__STDC_FORMAT_MACROS -DMODULE_NAME=\"px4_simulink_app\" -DPX4_MAIN=px4_simulink_app_app_main -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DPX4 -DFMUv2 -DNULL=0 -DMW_PX4_NUTTX_BUILD -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -D__linux__ -DXCP_PLATFORM_LINUX_NO_PIE_SUPPORT -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-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 -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 -fno-builtin-printf -fno-strength-reduce -Wformat=1 -Wunused-but-set-variable -Wno-format-truncation -fcheck-new -fno-exceptions -fno-rtti -fno-threadsafe-statics -Wreorder -Wno-overloaded-virtual -nostdinc++ -Wframe-larger-than=2000 -fpermissive -Wno-narrowing -std=gnu++11 -I../../boards/px4/fmu-v3/src -I../../platforms/nuttx/src/px4/common/include -I. -Isrc -Isrc/lib -Isrc/modules -I../../platforms/nuttx/src/px4/stm/stm32f4/include -I../../platforms/common/include -I../../src -I../../src/include -I../../src/lib -I../../src/lib/DriverFramework/framework/include -I../../src/lib/matrix -I../../src/modules -I../../src/platforms -INuttX/nuttx/arch/arm/src/armv7-m -INuttX/nuttx/arch/arm/src/chip -INuttX/nuttx/arch/arm/src/common -INuttX/apps/include -Iexternal/Install/include -I../../src/modules/px4_simulink_app -I../../src/modules/mavlink -I../../mavlink/include/mavlink -isystem ../../platforms/nuttx/NuttX/include/cxx -isystem NuttX/nuttx/include/cxx -isystem NuttX/nuttx/include -o src\modules\px4_simulink_app\CMakeFiles\modules__px4_simulink_app.dir\MW_uORB_Read.cpp.obj -c ..\..\src\modules\px4_simulink_app\MW_uORB_Read.cpp" with error "In file included from ..\..\src\modules\px4_simulink_app\MW_uORB_Read.cpp:3:0: ..\..\src\modules\px4_simulink_app\nuttxinitialize.h:38:10: fatal error: MW_target_hardware_resources.h: No such file or directory #include "MW_target_hardware_resources.h" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
It seems to me that it's trying to call a file that does not exist, but I'm failing to understand why it doesn't exist and where it's supposed to be generated from. I am using MATLAB 2022a and Firmware v1.10.2 on a Pixhawk 1 board with FMUv3. Any additional support would be greatly appreciated. I followed the tutorial online and successfuly got the board connected through the UAV toolbox.
0 Comments
Accepted Answer
Arun Mathamkode
on 23 Feb 2023
Edited: Arun Mathamkode
on 23 Feb 2023
I would encourage you to use MATLAB R2022b version instead of the below workaround. From MATLAB R2022b PX4 v1.12.3 is supported.
In R2022b, can you try a simple workaround in your MATLAB? Run the below command in MATLAB command window immediately after launch and try building the Simulink model.
setpref('MW_PX4_Build','FullFirmwareBuild',true)
This command will do the full PX4 Firmware build and the make will pull in the required packages and might resolve this issue. But please note that this will take much longer tme for the Simulink build (~5min).
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!