Failed to run led demo in external mode at the raspberry pi 4B with simulink
48 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
chen
el 26 de Dic. de 2024 a las 5:18
Respondida: chen
el 26 de Dic. de 2024 a las 13:49
I have tried different 32bit bullseye raspberry OS, and different matlab version, but the issuse is still exsisted, could somebody kindly please tell me about the stable version raspberry OS and Matlab for running external mode on raspberry 4B.
matlab :2023b; 2024a;
raspberry pi os: 32-bii-bullseye-armhf_2024-10-22
Error:
### Starting build procedure for: untitled
### Build procedure for untitled aborted due to an error.
Build Summary
Top model targets built:
Model Action Rebuild Reason
====================================================================
untitled Failed Code generation information file does not exist.
0 of 1 models built (0 models already up to date)
Build duration: 0h 0m 28.07s
Error executing command "touch -c /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/*.*;make MATLAB_ROOT=%MATLAB_ROOT% ALT_MATLAB_ROOT=%ALT_MATLAB_ROOT% MATLAB_BIN=%MATLAB_BIN% ALT_MATLAB_BIN=%ALT_MATLAB_BIN% -j$(($(nproc)+1)) -Otarget -f untitled.mk all MATLAB_WORKSPACE="/home/pi/MATLAB_ws/R2023b" LINUX_TARGET_LIBS_MACRO="" -C /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw LC_ALL=C". Details:
STDERR: make: *** No rule to make target '%MATLAB_ROOT%/rtw/c/src/ext_mode/common/ext_svr.c', needed by 'ext_svr.c.o'. Stop.
make: *** Waiting for unfinished jobs....
In file included from /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled.h:6,
from /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled.c:2:
/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/rtwtypes.h:4:10: fatal error: tmwtypes.h: No such file or directory
4 | #include "tmwtypes.h"
| ^~~~~~~~~~~~
compilation terminated.
make: *** [untitled.mk:461: untitled.c.o] Error 1
In file included from /home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/common.h:5,
from /home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/devices.h:3,
from /home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/devices.c:6:
/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/rtwtypes.h:4:10: fatal error: tmwtypes.h: No such file or directory
4 | #include "tmwtypes.h"
| ^~~~~~~~~~~~
compilation terminated.
make: *** [untitled.mk:449: devices.c.o] Error 1
In file included from /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled.h:6,
from /home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled_data.c:2:
/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/rtwtypes.h:4:10: fatal error: tmwtypes.h: No such file or directory
4 | #include "tmwtypes.h"
| ^~~~~~~~~~~~
compilation terminated.
make: *** [untitled.mk:465: untitled_data.c.o] Error 1
In file included from /home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/common.h:5,
from /home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/LED.c:8:
/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/rtwtypes.h:4:10: fatal error: tmwtypes.h: No such file or directory
4 | #include "tmwtypes.h"
| ^~~~~~~~~~~~
compilation terminated.
make: *** [untitled.mk:453: LED.c.o] Error 1
STDOUT: make: Entering directory '/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw'
gcc -c -MMD -MP -MF"untitled.c.dep" -MT"untitled.c.o" -O2 -DMW_NUM_CORES=4 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_CAN_BITRATE=500000 -DMW_CAN_ALLOWALLMSGS=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw -I%MATLAB_ROOT%/extern/include -I%MATLAB_ROOT%/simulink/include -I%MATLAB_ROOT%/rtw/c/src -I%MATLAB_ROOT%/rtw/c/src/ext_mode/common -I%MATLAB_ROOT%/rtw/c/ert -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src/utils -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/include -I%MATLAB_ROOT%/toolbox/target/codertarget/rtos/inc -o "untitled.c.o" "/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled.c"
make: Leaving directory '/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw'
make: Entering directory '/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw'
gcc -c -MMD -MP -MF"devices.c.dep" -MT"devices.c.o" -O2 -DMW_NUM_CORES=4 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_CAN_BITRATE=500000 -DMW_CAN_ALLOWALLMSGS=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw -I%MATLAB_ROOT%/extern/include -I%MATLAB_ROOT%/simulink/include -I%MATLAB_ROOT%/rtw/c/src -I%MATLAB_ROOT%/rtw/c/src/ext_mode/common -I%MATLAB_ROOT%/rtw/c/ert -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src/utils -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/include -I%MATLAB_ROOT%/toolbox/target/codertarget/rtos/inc -o "devices.c.o" "/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/devices.c"
make: Leaving directory '/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw'
make: Entering directory '/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw'
gcc -c -MMD -MP -MF"untitled_data.c.dep" -MT"untitled_data.c.o" -O2 -DMW_NUM_CORES=4 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_CAN_BITRATE=500000 -DMW_CAN_ALLOWALLMSGS=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw -I%MATLAB_ROOT%/extern/include -I%MATLAB_ROOT%/simulink/include -I%MATLAB_ROOT%/rtw/c/src -I%MATLAB_ROOT%/rtw/c/src/ext_mode/common -I%MATLAB_ROOT%/rtw/c/ert -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src/utils -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/include -I%MATLAB_ROOT%/toolbox/target/codertarget/rtos/inc -o "untitled_data.c.o" "/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw/untitled_data.c"
make: Leaving directory '/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw'
make: Entering directory '/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw'
gcc -c -MMD -MP -MF"LED.c.dep" -MT"LED.c.o" -O2 -DMW_NUM_CORES=4 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_CAN_BITRATE=500000 -DMW_CAN_ALLOWALLMSGS=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver -I/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw -I%MATLAB_ROOT%/extern/include -I%MATLAB_ROOT%/simulink/include -I%MATLAB_ROOT%/rtw/c/src -I%MATLAB_ROOT%/rtw/c/src/ext_mode/common -I%MATLAB_ROOT%/rtw/c/ert -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src -I%MATLAB_ROOT%/toolbox/coder/rtiostream/src/utils -I/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/include -I%MATLAB_ROOT%/toolbox/target/codertarget/rtos/inc -o "LED.c.o" "/home/pi/MATLAB_ws/R2023b/C/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/realtime/targets/raspi/unifiedserver/LED.c"
make: Leaving directory '/home/pi/MATLAB_ws/R2023b/C/Users/chenz/Documents/MATLAB/Examples/R2023b/raspberrypi/GettingStartedWithSimulinkRaspberryPiHardwareExample/untitled_ert_rtw'
In addition, it can run in matlab, but the name is wrong, I suspect that this name might lead to this error.
r=raspi('xxx.xxx.xxx.xxx','pi','raspberry')
r =
raspi with properties:
DeviceAddress: '192.168.137.176'
Port: 18734
BoardName: 'Raspberry Pi 2 Model B'
AvailableLEDs: {'led0'}
AvailableDigitalPins: [4,5,6,10,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]
AvailableSPIChannels: {'CE1'}
AvailableI2CBuses: {'i2c-1'}
AvailableWebcams: {}
I2CBusSpeed: 100000
AvailableCANInterfaces: {}
3 comentarios
Respuesta aceptada
Más respuestas (1)
Madheswaran
el 26 de Dic. de 2024 a las 10:16
Hello Chen,
Upon reviewing the error log, it appears that the file 'tmwtypes.h' cannot be located during the code build process. This header file is essential as it contains type definitions required by the generated code. To address this issue, you can copy the 'tmwtypes.h' file from the '<MATLAB_ROOT>/extern/include' directory into your project folder. Alternatively, placing the file in the '<MATLAB_ROOT>/simulink/include' directory can also resolve the problem.
To determine the path for '<MATLAB_ROOT>', you can execute the command 'matlabroot' within MATLAB command window: https://mathworks.com/help/matlab/ref/matlabroot.html
I hope this resolves the issue!
Ver también
Categorías
Más información sobre Raspberry Pi Hardware 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!