Can't deploy the executable on Raspberry Pi and Matlab Coder doesn't generate the .elf file

10 views (last 30 days)
I've succesfully modified a deep learning matlab script to use it on a Raspberry Pi: i've done the code generation using Matlab Coder without any error and i've also tried the script directly on Matlab with the raspi connected to the pc. But if i try to deploy it as a standlone application on the raspi, i've got an error.
I've also tried to generate the code as an executable and even if the success message appears in the report saying that the output file is an .elf file, it doesn't appear in the folder or anywhere
I don't know if there is another possible way to deploy it on the raspi or to find out why the .elf file doesn't appear in the folder.
I post the options i used to generate the code and to deploy it, if they can be more useful.
Code Generation:
Deploy:
  11 Comments
David Fink
David Fink on 19 Oct 2021
Note on "I've also tried to generate the code as an executable and even if the success message appears in the report saying that the output file is an .elf file, it doesn't appear in the folder or anywhere":
The "Generate code only" checkbox on the code generation options page prevents the makefile from being invoked, so only the C++ sources are generated, and the C++ compiler is not invoked.
Based on later comments, it looks like you were able to invoke the makefile via the deployment workflow.
Pietro Ventrella
Pietro Ventrella on 19 Oct 2021
"The "Generate code only" checkbox on the code generation options page prevents the makefile from being invoked, so only the C++ sources are generated, and the C++ compiler is not invoked."
I've realized that shortly after. But even if I successfully generate code for an executable and run the "make -f filename.m" command I get errors.
Anyway i keep getting errors on the deployment phase even using different toolchains. In particular i have used "Microsoft Visual C++ 2019 v16.0 | nmake (64-bit Windows)" (which is also the specific compiler required on windows by functions that call opencv components, like the cascade object detector) but i got this error:
****************************************************************************************************************************************
cl /TP -c -nologo -GS -W4 -DWIN32 -D_MT -MT -EHs -D_CRT_SECURE_NO_WARNINGS /wd4251 /O2 /Oy- -std=c++11 -mfpu=neon -fopenmp /source-charset:utf-8 /openmp /wd4101 -D_MW_MATLABTGT_ -DUSE_19_05_LIBRARY -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_MATLABTARGET -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=200000 -DMODEL=raspi_singleFaceRecognition @raspi_singleFaceRecognition_rtw_comp.rsp -Fo"MWAvgPoolingLayer.obj" D:\Politecnico\Tesi_Prof.Giorgio\Matlab\RaspberryPi\Riconoscimento_Singolo\codegen\exe\raspi_singleFaceRecognition\MWAvgPoolingLayer.cpp
cl : warning della riga di comando D9002 : l'opzione sconosciuta '-std=c++11' verrà ignorata
cl : warning della riga di comando D9002 : l'opzione sconosciuta '-mfpu=neon' verrà ignorata
cl : warning della riga di comando D9002 : l'opzione sconosciuta '-fopenmp' verrà ignorata
MWAvgPoolingLayer.cpp
D:\VisualStudio\VC\Tools\MSVC\14.29.30037\include\arm_neon.h(21): fatal error C1189: #error: This header is specific to ARM targets
NMAKE : fatal error U1077: 'D:\VisualStudio\VC\Tools\MSVC\14.29.30037\bin\HostX64\x64\cl.EXE' : codice restituito '0x2'
Stop.
The make command returned an error of 2
Error(s) encountered while building "raspi_singleFaceRecognition"
****************************************************************************************************************************************

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 8 Oct 2021
  8 Comments
Pietro Ventrella
Pietro Ventrella on 12 Oct 2021
so why did i get the same error while generating the code with a pc that has only visual studio 2019 compiler (and hasn't any version of minGW compiler installed) ?
With both PCs i have correctly generated this code https://it.mathworks.com/help/supportpkg/raspberrypiio/ref/identify-objects-within-video-using-resNet-50-on-raspberry-pi-hardware.html , so i don't get what is the problem with my code
Walter Roberson
Walter Roberson on 12 Oct 2021
Sorry, I do not have a Windows development system to test with.
(Microsoft considers me a commercial developer when I am volunteering to help other people, and the commercial licenses I would need are several thousand dollars per year.)

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!