UAV toolbox with PX4: Error encountered when trying to log in SD card

11 views (last 30 days)
종원 이
종원 이 on 15 Feb 2022
Edited: Seung woo Park on 2 Jun 2022
I tried to upload my custom flight controller in px4.
When I just build&deploy the px4 simulink app to pixhawk board, It worked well.
However, when I tried to log some of signals in SD card using 'To Workspace' Block, some error occurred.
When I check the box 'log on MAT file' and press the button Build & Deploy, (after Limiting data point using below command)
px4PrepareModelForMATFileLogging('My File name')
It suddenly starts to Re-running CMake File with under error
Warning: Compilation failure for command "C:\PX4\toolchain\gcc-arm\bin\arm-none-eabi-gcc -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=2 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DPX4 -DFMUv3 -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 -DMW_SD_STATIC_MEMORY_ENABLE -DMW_SD_VERBOSE_DISABLE=1 -DMW_SD_STATIC_MEMORY_SIZE=138493.6 -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 -fno-common -Wbad-function-cast -Wnested-externs -Wstrict-prototypes -std=gnu11 -fpermissive -Wno-narrowing -Wframe-larger-than=2000 -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\ert_targets_logging.c.obj -c ..\..\src\modules\px4_simulink_app\ert_targets_logging.c" with error "cc1.exe: warning: command line option '-fpermissive' is valid for C++/ObjC++ but not for C
<command-line>:0:26: error: floating constant in preprocessor expression
..\..\src\modules\px4_simulink_app\ert_targets_logging.c:207:5: note: in expansion of macro 'MW_SD_STATIC_MEMORY_SIZE'
compilation terminated due to -Wfatal-errors.
After this error, it starts to rerun CMake which takes long time (about 10 minutes) it finally shows
[524/1205] Generating nuttx/fs/libfs.a
[525/1205] Generating nuttx/sched/libsched.a
ninja: build stopped: subcommand failed.
make[1]: *** [Makefile:195: px4_fmu-v3_default] �ㅻ쪟 1
make[1]: �붾젆�곕━ '/cygdrive/c/PX4/home/Firmware' �섍컧
PX4 Cygwin returned an error of 2
gmake: *** [postdownload_preexecute] Error 1
C:\ProgramData\MATLAB\SupportPackages\R2021b\toolbox\target\supportpackages\px4\lib\etc\untitled_ert_rtw>echo The make command returned an error of 2
The make command returned an error of 2
C:\ProgramData\MATLAB\SupportPackages\R2021b\toolbox\target\supportpackages\px4\lib\etc\untitled_ert_rtw>exit /B 1
### Build procedure for untitled aborted due to an error.
Error(s) encountered while building "{My File Name}"
Red letters are due to wrong encoding.
Actually, sometimes there are same errors when I tried to upload my custom flight algorithm regardless of the choice of MAT File logging(Don't know why error occurred yet).
If error occurred, I just copy the content of simulink file and paste it to new file. And it worked.
However, when I tried to upload different flight control algorithm (which is quite complex than before), copy and paste to new file doesn't solve the problem.
I unchecked the MAT File logging and upload it, and it worked but when I checked it, above error occurred so I concluded that checking MAT File logging is the reason.
I searched some related error, and speculated some problem related to file path, but not sure.
I re-build the PX4 Firmware in initalize process, but above error still occurred.
Can You give me some reason why that error occurred and solution?
Thank you very much

Accepted Answer

Ankur Bose
Ankur Bose on 15 Feb 2022
Your Simulink model name "My file name" contains spaces. Can you try removing the space from your model name and then try?
Ankur Bose
Ankur Bose on 16 Feb 2022
Yes, you can reach out for official MathWorks Tech Support from this link. Provide the details of your problem and reproduction steps and if possible a Simulink model where the problem is reproducible.

Sign in to comment.

More Answers (1)

Seung woo Park
Seung woo Park on 2 Jun 2022
Edited: Seung woo Park on 2 Jun 2022
한국인이신거 같으니 그냥 한국말로 대답할게요 종원님
지금쯤이면 해결하셨을지는 모르겠지만 제가 겪어본 바로는 스코프 문제더라구요
build&deploy 하기전에 시뮬링크에 있는 스코프를 다 지우고하니 오류가 안뜨고 잘 빌드됐어요

Community Treasure Hunt

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

Start Hunting!

Translated by