MATLAB Answers

Pixhawk PX4 Support Build: Validation Error

22 views (last 30 days)
Jose Manriquez
Jose Manriquez on 8 Jun 2017
Answered: Abhishek GS on 2 Apr 2019
So I am trying to build the model of a flight feedback controller that I have in Simulink for a fixed wing model airplane. This is the error I get, but I don't know how to approach it.
I reinstalled CMake 3.6.0. I even tried copying "sys/ioctl.h" around to different folders and it still didn't work. I also tried searching around for "MAKEROOTWIN" but I have not found anything related to that term with GMake.
Thank you for considering my issue.
### Invoking Target Language Compiler on RC_controller_autopilot.rtw
### Using System Target File: C:\Program Files\MATLAB\R2016a\rtw\c\ert\ert.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
### Caching model source code
### Writing source file RC_controller_autopilot.c
### Writing header file RC_controller_autopilot_private.h
### Writing header file RC_controller_autopilot.h
### Writing header file RC_controller_autopilot_types.h
### Writing header file rtwtypes.h
### Writing header file multiword_types.h
### Writing header file zero_crossing_types.h
### Writing source file RC_controller_autopilot_data.c
### Writing header file rtmodel.h
### Writing source file ert_main.c
### TLC code generation complete.
### Evaluating PostCodeGenCommand specified in the model
Nothing to remove from build output
Build path: C:\Users\jam\Documents\MATLAB\RC_controller_autopilot_ert_rtw
Removing Simulink module CMAKE source directory, adding new content..
Warning: Directory already exists.
Building objects to ensure proper compilation, will then invoke make command on firmware after
### Using toolchain: Pixhawk Toolchain v4.6.2 | gmake (64-bit Windows)
### 'C:\Users\jam\Documents\MATLAB\RC_controller_autopilot_ert_rtw\' is up to date
### Building 'RC_controller_autopilot': %PX4_ROOT%\toolchain\bin\make -f postdownload_preexecute all
C:\Users\jam\Documents\MATLAB\RC_controller_autopilot_ert_rtw>cd .
C:\Users\jam\Documents\MATLAB\RC_controller_autopilot_ert_rtw>if "" == "" (c:/px4\toolchain\bin\make -f postdownload_preexecute all ) else (c:/px4\toolchain\bin\make -f postdownload_preexecute )
arm-none-eabi-gcc -MD -c -std=gnu99 -Wall -Wextra -Wdouble-promotion -Wshadow -Wfloat-equal -Wframe-larger-than=1024 -Wpointer-arith -Wlogical-op -Wmissing-declarations -Wpacked -Wno-unused-parameter -Werror=format-security -Werror=array-bounds -Wfatal-errors -Wformat=1 -Wbad-function-cast -Wstrict-prototypes -Wold-style-declaration -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -ffixed-r10 -mfloat-abi=hard -DCONFIG_ARCH_BOARD_PX4FMU_V2 -fno-common -nodefaultlibs -nostdlib -Wframe-larger-than=2000 -fvisibility=hidden -include visibility.h -O0 -fno-builtin-printf -DMODEL=RC_controller_autopilot -DNUMST=2 -DNCSTATES=4 -DHAVESTDIO -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=1 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DUSE_STDPERIPH_DRIVER -DPX4 -DCONFIG_ARCH_BOARD_PX4FMU_V2 -DGIT_VERSION=d3398270e101359de9687c2d077d991c9892f573 -D__DF_NUTTX -D__PX4_NUTTX -DARM_MATH_CM4=1 -D__FPU_PRESENT=1 -D__FPU_USED=1 -DHSE_VALUE=8000000 -DNULL=0 -DEXIT_FAILURE=1 -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLEPRINTF -DRT -DSTACK_SIZE=64 -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=1 -DUSE_STDPERIPH_DRIVER -DPX4 -DCONFIG_ARCH_BOARD_PX4FMU_V2 -DGIT_VERSION=d3398270e101359de9687c2d077d991c9892f573 -D__DF_NUTTX -D__PX4_NUTTX -DARM_MATH_CM4=1 -D__FPU_PRESENT=1 -D__FPU_USED=1 -DHSE_VALUE=8000000 -DNULL=0 -DEXIT_FAILURE=1 -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLEPRINTF -DRT -DSTACK_SIZE=64 -DMODEL=RC_controller_autopilot -DNUMST=2 -DNCSTATES=4 -DHAVESTDIO -IC:/PROGRA~1/MATLAB/R2016a/simulink/include/sf_runtime -IC:/Users/jam/Documents/MATLAB/RC_controller_autopilot_ert_rtw -IC:/Users/jam/Documents/MATLAB -IC:/Users/jam/Downloads -IC:/PROGRA~1/MATLAB/R2016a/extern/include -IC:/PROGRA~1/MATLAB/R2016a/simulink/include -IC:/PROGRA~1/MATLAB/R2016a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2016a/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2016a/rtw/c/ert -IC:/PROGRA~1/MATLAB/R2016a/rtw/c/src/ext_mode/serial -Ic:/px4/src/lib/mathlib/CMSIS/Include -Ic:/px4/lib/gcc/wingw32/4.6.2.include -Ic:/px4/Firmware/src -Ic:/px4/Firmware/build_px4fmu-v2_default -Ic:/px4/Firmware/build_px4fmu-v2_default/src -Ic:/px4/Firmware/src/modules -Ic:/px4/Firmware/src/include -Ic:/px4/Firmware/src/lib -Ic:/px4/Firmware/src/platforms -Ic:/px4/Firmware/src/drivers/boards/px4fmu-v2 -Ic:/px4/Firmware/build_px4fmu-v2_default/src/modules/px4_messages -Ic:/px4/Firmware/build_px4fmu-v2_default/src/modules -Ic:/px4/Firmware/mavlink/include/mavlink -Ic:/px4/Firmware/src/lib/DriverFramework/framework/include -Ic:/px4/Firmware/src/lib/matrix -Ic:/px4/Firmware/build_px4fmu-v2_default/px4fmu-v2/NuttX/nuttx-export/include -Ic:/px4/Firmware/build_px4fmu-v2_default/px4fmu-v2/NuttX/nuttx-export/include/cxx -Ic:/px4/Firmware/build_px4fmu-v2_default/px4fmu-v2/NuttX/nuttx-export/arch/chip -Ic:/px4/Firmware/build_px4fmu-v2_default/px4fmu-v2/NuttX/nuttx-export/arch/common -Ic:/px4/Firmware/build_px4fmu-v2_default/external/Install/include -IC:/PROGRA~1/MATLAB/R2016a/toolbox/psp/pixhawk/include -o "RC_controller_autopilot.o" "RC_controller_autopilot.c"
In file included from RC_controller_autopilot.h:23:0,
from RC_controller_autopilot.c:16:
c:/px4/Firmware/src/drivers/drv_rc_input.h:44:23: fatal error: sys/ioctl.h: No such file or directory
compilation terminated.
make: *** [RC_controller_autopilot.o] Error 1
C:\Users\jam\Documents\MATLAB\RC_controller_autopilot_ert_rtw>echo The make command returned an error of 2
The make command returned an error of 2
'An_error_occurred_during_the_call_to_make' is not recognized as an internal or external command,
operable program or batch file.
### Creating HTML report file RC_controller_autopilot_codegen_rpt.html
Warning: Validation warning(s):
Skipped the existence check for 'Invoke Make'. Cannot determine the utility that needs to be checked for existence from the build tool command '$(call CALLPX4MK)'.
### Build procedure for model: 'RC_controller_autopilot' aborted due to an error.
Error(s) encountered while building "RC_controller_autopilot":
### Failed to generate all binary outputs.
Caused by:
Validation error(s):
GMAKE Utility: Path '$(MAKEROOTWIN)' does not exist.
Component: Simulink | Category: Model error


Mark  Andrews
Mark Andrews on 18 Jul 2017
Hello Jose I am getting started on px4 in embedded coder but have no idea how to. I know its a very broad question but could you please spare a few mins to point me in the right direction on how to get started.
yohan diaz
yohan diaz on 19 Mar 2018
Have somobody found the solution? Building the "tune demo" the same error is shown. the CMake version used could be a probably cause?
Thanks in advanced!

Sign in to comment.

Answers (3)

Yuanyan Chen
Yuanyan Chen on 19 Oct 2017
I have solved the problem. Make sure your test folder's name does not include any space.

  1 Comment

yifan lin
yifan lin on 17 Jan 2019
I have also solved this problem. As this answer suggests, you should not include any space in your test folder's name/path, including your MATLAB install path.

Sign in to comment.

Xin Jin
Xin Jin on 13 Jun 2017
Maybe,the Toolchain you need to install again, the matlab changed some files when install it. Please follow the order of the tutorial to install.


Sign in to comment.

Abhishek GS
Abhishek GS on 2 Apr 2019
The official support package 'Embedded Coder Support Package for PX4 Autopilots' is now available from R2018b onwards.
Here is the documentation on getting started with the official support package.


Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!