S-Function Builder Raspberry Pi

6 views (last 30 days)
Mirko
Mirko on 8 Nov 2016
Commented: Marc Uedelhofen on 6 Apr 2019
Good evening, I have a problem with the creation of an S-Function for my project with Raspberry Pi2 model B. Using an S-Function Builder to import the library wiringPi within my project. The compilation does not create errors, but when I load this project into problems arise tab.
_ _ _Error executing command "touch -c /home/pi/simulink/untitled1_ert_rtw/*.*;make -f untitled1.mk all -C /home/pi/simulink/untitled1_ert_rtw". Details:
STDERR: library_wrapper.c:16:50: fatal error: /home/pi/wiringPi/wiringPi/gertboard.h: No such file or directory #include ^ compilation terminated. make: * [library_wrapper.c.o] Error 1
STDOUT: make: Entering directory '/home/pi/simulink/untitled1_ert_rtw' gcc -c -MMD -MP -MF"untitled1.c.dep" -MT"untitled1.c.o" -O0 -DMODEL=untitled1 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -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=0 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DRT -DSTACK_SIZE=64 -DMODEL=untitled1 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -I./ -o "untitled1.c.o" "untitled1.c" gcc -c -MMD -MP -MF"library_wrapper.c.dep" -MT"library_wrapper.c.o" -O0 -DMODEL=untitled1 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -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=0 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DRT -DSTACK_SIZE=64 -DMODEL=untitled1 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -I./ -o "library_wrapper.c.o" "library_wrapper.c" untitled1.mk:431: recipe for target 'library_wrapper.c.o' failed make: Leaving directory '/home/pi/simulink/untitled1_ert_rtw'___

Answers (2)

Gregor Röring
Gregor Röring on 6 Apr 2019
I had the same problem with a Pi zero w and after a lot of try and error I found the solution.
  1. Install the Simulink Coder Add-on
  2. Go to the Model Configuration Parameters of your model and Select:Unbenannt.png
  3. Click Ok and open the Configuration Parameters again. The Code Generation tab should now appear.
  4. On the Code Generation tab type in the following:Unbenannt2.PNG
  5. Now you can use the wiringPi library and the Pigpio library when they are installed on your pi.
  1 Comment
Marc Uedelhofen
Marc Uedelhofen on 6 Apr 2019
Hi,
This is a model that has been configured according to the specifications. There is one S-function that uses wiringPi, and one that uses pigpio. The wiringPi library should have been installed on Matlab's Raspberry. It is possible that pigpio still has to be installed. Or the S-function can be commented out. After "Build" has been clicked, it should run on the target hardware.
Marc

Sign in to comment.


Mirko
Mirko on 8 Nov 2016
Error executing command "touch -c /home/pi/simulink/untitled1_ert_rtw/*.*;make -f untitled1.mk all -C /home/pi/simulink/untitled1_ert_rtw". Details:
STDERR: In file included from library_wrapper.c:30:0: /home/pi/wiringPi/wiringPi/softPwm.c:36:0: warning: "MAX_PINS" redefined #define MAX_PINS 1024 ^ In file included from library_wrapper.c:19:0: /home/pi/wiringPi/wiringPi/softTone.c:35:0: note: this is the location of the previous definition #define MAX_PINS 64 ^ In file included from library_wrapper.c:30:0: /home/pi/wiringPi/wiringPi/softPwm.c:56:27: error: conflicting types for ‘threads’ static volatile pthread_t threads [MAX_PINS] ; ^ In file included from library_wrapper.c:19:0: /home/pi/wiringPi/wiringPi/softTone.c:40:18: note: previous declaration of ‘threads’ was here static pthread_t threads [MAX_PINS] ; ^ In file included from library_wrapper.c:30:0: /home/pi/wiringPi/wiringPi/softPwm.c:57:21: error: conflicting type qualifiers for ‘newPin’ static volatile int newPin = -1 ; ^ In file included from library_wrapper.c:19:0: /home/pi/wiringPi/wiringPi/softTone.c:42:12: note: previous definition of ‘newPin’ was here static int newPin = -1 ; ^ make: * [library_wrapper.c.o] Error 1
STDOUT: make: Entering directory '/home/pi/simulink/untitled1_ert_rtw' gcc -c -MMD -MP -MF"untitled1.c.dep" -MT"untitled1.c.o" -O0 -DMODEL=untitled1 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -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=0 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DRT -DSTACK_SIZE=64 -DMODEL=untitled1 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -I./ -o "untitled1.c.o" "untitled1.c" gcc -c -MMD -MP -MF"library_wrapper.c.dep" -MT"library_wrapper.c.o" -O0 -DMODEL=untitled1 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -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=0 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DRT -DSTACK_SIZE=64 -DMODEL=untitled1 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -I./ -o "library_wrapper.c.o" "library_wrapper.c" untitled1.mk:431: recipe for target 'library_wrapper.c.o' failed make: Leaving directory '/home/pi/simulink/untitled1_ert_rtw'
  2 Comments
Iselgrey
Iselgrey on 2 Mar 2017
Edited: Iselgrey on 2 Mar 2017
Hi, I'm currently having exactly the same problem. Have you solved it already by any chance?
Manuel
Manuel on 26 Sep 2018
Hola Alguien a podido resolver el problema

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!