Azzera filtri
Azzera filtri

Matlab and Ubuntu 20.04 in RaspberryPi4

13 visualizzazioni (ultimi 30 giorni)
Silvia Della Torre
Silvia Della Torre il 8 Set 2023
Modificato: Walter Roberson il 11 Set 2023
Hello, I'm trying to connect Matlab/Simulink (R2021b) with RaspberryPi4 (with Ubuntu 20.04). When I try to run a function in Matlab (the example function BlinkLED provided by Matlab support) this is the error:
>> blinkLED
### Updating Raspberry Pi I/O server...
### Connecting to board...
### Connected to 192.168.1.30...
### Installing nanomsg Library (this might take a while)...
### Creating server folder...
### Transferring source files...
### Building MATLAB I/O server...
Error using blinkLED (line 3)
Error executing command "make ONLY_MATLAB_IO=0 -C /opt/MATLAB/mw_server_v21.2.0 -f Makefile". Details:
STDERR: ide a declaration of ‘printf’
IO_wrapperCameraboard.c:67:39: warning: passing argument 1 of ‘EXT_CAMERABOARD_snapshot’ from incompatible pointer type
[-Wincompatible-pointer-types]
67 | status = EXT_CAMERABOARD_snapshot(&ts, data, &dataSize);
| ^~~
| |
| long long unsigned int *
In file included from IO_wrapperCameraboard.h:16,
from IO_wrapperCameraboard.c:10:
picam.h:18:40: note: expected ‘uint64_t *’ {aka ‘long unsigned int *’} but argument is of type ‘long long unsigned int *’
18 | int EXT_CAMERABOARD_snapshot(uint64_t *ts,uint8_T *data, uint32_T *dataSize);
| ~~~~~~~~~~^~
IO_wrapperCameraboard.c: In function ‘cameraboardControl’:
IO_wrapperCameraboard.c:95:19: warning: pointer targets in assignment from ‘uint8_T *’ {aka ‘unsigned char *’} to ‘char_T *’ {aka ‘char *’}
differ in signedness [-Wpointer-sign]
95 | controlParams = &payloadBufferRx[0];
| ^
IO_wrapperCameraboard.c:96:5: warning: incompatible implicit declaration of built-in function ‘printf’
96 | printf("REQUEST_CAMERABOARD_CONTROL: %s \n", controlParams);
| ^~~~~~
IO_wrapperCameraboard.c:96:5: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
IO_wrapperCameraboard.c: In function ‘cameraboardTerminate’:
IO_wrapperCameraboard.c:118:5: warning: incompatible implicit declaration of built-in function ‘printf’
118 | printf("REQUEST_CAMERABOARD_TERMINATE \n");
| ^~~~~~
IO_wrapperCameraboard.c:118:5: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
In file included from sharedServer.h:16,
from mw_wrapperCANChannel.h:16,
from mw_wrapperCANChannel.c:11:
mw_wrapperCANChannel.c: In function ‘canWrite’:
mw_wrapperCANChannel.c:18:23: warning: too many arguments for format [-Wformat-extra-args]
18 | LOG_PRINT(stdout, "REQUEST_CAN_WRITE: \n",0);
| ^~~~~~~~~~~~~~~~~~~~~~~
common.h:12:51: note: in definition of macro ‘LOG_PRINT’
12 | #define LOG_PRINT(fd, format, ...) fprintf(fd, format, __VA_ARGS__); fflush(fd)
| ^~~~~~
mw_wrapperCANChannel.c:53:26: warning: too many arguments for format [-Wformat-extra-args]
53 | LOG_PRINT(stdout,"CANChannel: Write successful \n",0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common.h:12:51: note: in definition of macro ‘LOG_PRINT’
12 | #define LOG_PRINT(fd, format, ...) fprintf(fd, format, __VA_ARGS__); fflush(fd)
| ^~~~~~
mw_wrapperCANChannel.c:56:26: warning: too many arguments for format [-Wformat-extra-args]
56 | LOG_PRINT(stdout,"CANChannel: Write failed \n",0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common.h:12:51: note: in definition of macro ‘LOG_PRINT’
12 | #define LOG_PRINT(fd, format, ...) fprintf(fd, format, __VA_ARGS__); fflush(fd)
| ^~~~~~
mw_wrapperCANChannel.c: In function ‘canRead’:
mw_wrapperCANChannel.c:65:22: warning: too many arguments for format [-Wformat-extra-args]
65 | LOG_PRINT(stdout,"REQUEST_CAN_Read: \n",0);
| ^~~~~~~~~~~~~~~~~~~~~~
common.h:12:51: note: in definition of macro ‘LOG_PRINT’
12 | #define LOG_PRINT(fd, format, ...) fprintf(fd, format, __VA_ARGS__); fflush(fd)
| ^~~~~~
mw_wrapperCANChannel.c:98:26: warning: too many arguments for format [-Wformat-extra-args]
98 | LOG_PRINT(stdout,"CANChannel: Read successful \n",0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common.h:12:51: note: in definition of macro ‘LOG_PRINT’
12 | #define LOG_PRINT(fd, format, ...) fprintf(fd, format, __VA_ARGS__); fflush(fd)
| ^~~~~~
mw_wrapperCANChannel.c:100:26: warning: too many arguments for format [-Wformat-extra-args]
100 | LOG_PRINT(stdout,"CANChannel: Read failed \n",0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
common.h:12:51: note: in definition of macro ‘LOG_PRINT’
12 | #define LOG_PRINT(fd, format, ...) fprintf(fd, format, __VA_ARGS__); fflush(fd)
| ^~~~~~
picam.c: In function ‘EXT_CAMERABOARD_init’:
picam.c:515:9: warning: unused variable ‘result’ [-Wunused-variable]
515 | int result = EXT_CAMERABOARD_terminate();
| ^~~~~~
IO_wrapperLED.c: In function ‘setLEDTrigger’:
IO_wrapperLED.c:54:13: warning: pointer targets in assignment from ‘uint8_T *’ {aka ‘unsigned char *’} to ‘char_T *’ {aka ‘char *’} differ in
signedness [-Wpointer-sign]
54 | trigger = &payloadBufferRx[index];
| ^
MW_digitalIO.c: In function ‘MW_digitalIO_open’:
MW_digitalIO.c:15:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
15 | return (MW_Handle_Type)pin;
| ^
MW_digitalIO.c: In function ‘MW_digitalIO_read’:
MW_digitalIO.c:23:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
23 | EXT_GPIO_read((unsigned int)DigitalIOPinHandle, &gpioValue); //TODO: Find a way to return the right status
| ^
MW_digitalIO.c: In function ‘MW_digitalIO_write’:
MW_digitalIO.c:31:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
31 | EXT_GPIO_write((unsigned int)DigitalIOPinHandle, value); //TODO: Find a way to return the right status
| ^
MW_digitalIO.c: In function ‘MW_digitalIO_close’:
MW_digitalIO.c:37:24: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
37 | EXT_GPIO_terminate((unsigned int)DigitalIOPinHandle); //TODO: Find a way to return the right status
| ^
In file included from IO_wrapperEncoder.h:16,
from customFunction.c:27:
MW_RaspiEncoder.h:9:10: fatal error: pigpio.h: No such file or directory
9 | #include <pigpio.h>
| ^~~~~~~~~~
compilation terminated.
make: *** [Makefile:79: obj/customFunction.o] Error 1
STDOUT: make: Entering directory '/opt/MATLAB/mw_server_v21.2.0'
[Compiling] IO_wrapperv4l2.c
gcc -c -g -O0 -D_DEBUG -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include -I/opt/userland/interface/vcos
-I/opt/userland/interface/vcos/pthreads -I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DMW_WEBSOC_INUSE -DMW_ENCODER_INUSE IO_wrapperv4l2.c -o obj/IO_wrapperv4l2.o
[Compiling] MW_PWM.c
gcc -c -g -O0 -D_DEBUG -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include -I/opt/userland/interface/vcos
-I/opt/userland/interface/vcos/pthreads -I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DMW_WEBSOC_INUSE -DMW_ENCODER_INUSE MW_PWM.c -o obj/MW_PWM.o
[Compiling] MW_pigs.c
gcc -c -g -O0 -D_DEBUG -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include -I/opt/userland/interface/vcos
-I/opt/userland/interface/vcos/pthreads -I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DMW_WEBSOC_INUSE -DMW_ENCODER_INUSE MW_pigs.c -o obj/MW_pigs.o
[Compiling] sharedServer.c
gcc -c -g -O0 -D_DEBUG -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include -I/opt/userland/interface/vcos
-I/opt/userland/interface/vcos/pthreads -I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DMW_WEBSOC_INUSE -DMW_ENCODER_INUSE sharedServer.c -o obj/sharedServer.o
[Compiling] IO_wrapperCameraboard.c
gcc -c -g -O0 -D_DEBUG -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include -I/opt/userland/interface/vcos
-I/opt/userland/interface/vcos/pthreads -I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DMW_WEBSOC_INUSE -DMW_ENCODER_INUSE IO_wrapperCameraboard.c -o
obj/IO_wrapperCameraboard.o
[Compiling] mw_wrapperCANChannel.c
gcc -c -g -O0 -D_DEBUG -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include -I/opt/userland/interface/vcos
-I/opt/userland/interface/vcos/pthreads -I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DMW_WEBSOC_INUSE -DMW_ENCODER_INUSE mw_wrapperCANChannel.c -o
obj/mw_wrapperCANChannel.o
[Compiling] LED.c
gcc -c -g -O0 -D_DEBUG -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include -I/opt/userland/interface/vcos
-I/opt/userland/interface/vcos/pthreads -I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DMW_WEBSOC_INUSE -DMW_ENCODER_INUSE LED.c -o obj/LED.o
[Compiling] picam.c
gcc -c -g -O0 -D_DEBUG -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include -I/opt/userland/interface/vcos
-I/opt/userland/interface/vcos/pthreads -I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DMW_WEBSOC_INUSE -DMW_ENCODER_INUSE picam.c -o obj/picam.o
[Compiling] system.c
gcc -c -g -O0 -D_DEBUG -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include -I/opt/userland/interface/vcos
-I/opt/userland/interface/vcos/pthreads -I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DMW_WEBSOC_INUSE -DMW_ENCODER_INUSE system.c -o obj/system.o
[Compiling] IO_wrapperLED.c
gcc -c -g -O0 -D_DEBUG -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include -I/opt/userland/interface/vcos
-I/opt/userland/interface/vcos/pthreads -I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DMW_WEBSOC_INUSE -DMW_ENCODER_INUSE IO_wrapperLED.c -o obj/IO_wrapperLED.o
[Compiling] MW_digitalIO.c
gcc -c -g -O0 -D_DEBUG -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include -I/opt/userland/interface/vcos
-I/opt/userland/interface/vcos/pthreads -I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DMW_WEBSOC_INUSE -DMW_ENCODER_INUSE MW_digitalIO.c -o obj/MW_digitalIO.o
[Compiling] customFunction.c
gcc -c -g -O0 -D_DEBUG -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include -I/opt/userland/interface/vcos
-I/opt/userland/interface/vcos/pthreads -I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DMW_WEBSOC_INUSE -DMW_ENCODER_INUSE customFunction.c -o obj/customFunction.o
make: Leaving directory '/opt/MATLAB/mw_server_v21.2.0'
------
I thought it was a problem of packages since I flashed Ubuntu on Raspberry instead of Raspian. So I try to installed the missing packages in 'Manage get add-on' but this is the error that comes out:
' Error executing command "sudo ldconfig -p grep libmmal.so" '.
Can you help me to fix it please?
thank you.

Risposte (1)

MathWorks MATLAB Hardware Team
Modificato: Walter Roberson il 11 Set 2023
Hi ,
MATLAB Support Package for Raspberry Pi hardware currently supports the 32-bit Raspberry Pi Linux® operating system. For more detailed information, please visit the following link:
Thanks,
MATLAB Hardware Team
MathWorks

Categorie

Scopri di più su MATLAB Support Package for Raspberry Pi Hardware in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by