MATLAB Answers

calling a c++ function using coder.ceval to be compiled on raspberrypi [error ./MW/modelname: No such file or directory]

조회 수: 21(최근 30일)
arman sani
arman sani 10 Dec 2015
댓글: Dennis 14 May 2016
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)
persistent initflag;
if strcmp(, 'rtw')
if isempty(initflag)
% Initialize step
initflag = 1;
% Output step
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 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:
I have no idea what should be found in this address or how i can modify this path. Any hints would be appreciated.

  댓글 수: 3

Vaibhav Awale
Vaibhav Awale 14 Jan 2016
Hi Arman,
Are you able to run any demo models shipped with the Rasberry pi support package?
The demo models can be found by entering following command at MATLAB command prompt:
Are you able to run any other C++ functions on your board using the above approach?
arman sani
arman sani 21 Jan 2016
Hi Vaibhav, raspi_example doesn work I'm not sure what I'm doing wrong there! and none of the examples, that are incluided in the support package, use C++ functions directly. They are all made up of RaspberryPi blocks. regards Arman
Dennis 14 May 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.

로그인 to comment.


Venkatachala Sarma
Venkatachala Sarma 14 Jan 2016
편집: Venkatachala Sarma 14 Jan 2016
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.
Venkatachala Sarma

  댓글 수: 1

arman sani
arman sani 21 Jan 2016
Hi, I'll take a look at it as soon as I can. I actually gave up on MATLAB function and redid everything from scratch with S-function builder and fortunately it's working now. I'll post it here if find out where the problem was. Tanks a lot Arman

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.

Translated by