calling a c++ function using coder.ceval to be compiled on raspberrypi [error ./MW/modelname: No such file or directory]
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I'm trying to access GPIOs by calling a c++ function (which uses the wiringPi) in simulink. The matlab function used in the model looks something like this :
function ledf(signalin)
%#codegen
persistent initflag;
coder.cinclude('/home/pi/blinkerf.h');
if strcmp(coder.target, 'rtw')
if isempty(initflag)
% Initialize step
coder.ceval('blinker_init');
initflag = 1;
else
% Output step
coder.ceval('blinker_update',coder.ref(signalin));
end
end
the functions ("blinker_init" and "blinker_update") and the header file blinkerf work fine when used directly on the raspberryPi in a c++ code, however when I try to deploy the model I get this error :
Error executing SSH command: make: Entering directory '/home/pi/simublink_rtt'
"g++" -lm -ldl -lpthread -lrt -o final ./MW/simublink -lwiringPi
g++: error: ./MW/simublink: No such file or directory
_simublink.mk:122: recipe for target 'MW/simublink' failed
make: *** [MW/simublink] Error 1
make: Leaving directory '/home/pi/simublink_rtt'
just in case, the Xmake configurations look like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/152559/image.png)
I have no idea what should be found in this address or how i can modify this path. Any hints would be appreciated.
Thanks
Arman
3 comentarios
Dennis
el 14 de Mayo de 2016
Hi, I got the same error: Integrating custom code works with simulation, but not on another target. It seems like Matlab does not transfer the custom code to the raspberry pi. Ich checked the pi folders where stuff is compiled, and everything is copied there except my custom code. I integrated headers and .c references in both locations in the simulink options.
https://de.mathworks.com/matlabcentral/answers/262856-coder-ceval-on-raspberry-pi-undefined-reference-error
Respuestas (1)
Venkatachala Sarma
el 14 de En. de 2016
Editada: Venkatachala Sarma
el 14 de En. de 2016
Hi,
This looks like a path issue. While including external code for Simulation and Code Generation, it is necessary to provide the include path and the names of the C++ files in the "Custom Code" Section of Configuration Parameters in addition to providing that information in the 'code.ceval' function. The external code information should be provided in the 'Simulation Target' tab and 'Code Generation' tab for them to be linked while performing Simulation and Code Generation respectively.
Go through the following documentation links to understand how to provide the include directory and C++ files in the Custom Code section.
Hope this helps.
Regards,
Venkatachala Sarma
Ver también
Categorías
Más información sobre C Shared Library Integration en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!