I try to create a RASPI object in MATLAB, using the command "r = raspi()", why does this result in build errors related to I2C.c?
I obeserve similar build errors when I use the I2C block from Simulink and try to build the model.
>> r = raspi()### Updating Raspberry Pi I/O server...### Connecting to board...### Connected to 172.29.43.43...### Creating server folder...### Transferring source files...### Building MATLAB I/O server...Error executing command "make -C /opt/MATLAB/server_v19.1.0 -f Makefile". Details: STDERR: handler.c: In function ‘updateSourceInfoâ€:handler.c:435:41: warning: ‘,0†directive writing 2 bytes into a region of sizebetween 0 and 2 [-Wformat-overflow=] sprintf(pData->audioCard, "plughw:%d,0", cardType); ^~handler.c:435:5: note: ‘sprintf†output between 11 and 13 bytes into adestination of size 10 sprintf(pData->audioCard, "plughw:%d,0", cardType); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~I2C.c: In function ‘I2C_openâ€:I2C.c:29:23: warning: unused variable ‘i2c_funcs†[-Wunused-variable] unsigned long i2c_funcs = 0; ^~~~~~~~~I2C.c: In function ‘EXT_I2C_readRegisterâ€:I2C.c:74:24: error: array type has incomplete element type ‘struct i2c_msg†struct i2c_msg msg[2]; ^~~I2C.c:83:24: error: ‘I2C_M_RD†undeclared (first use in this function); did youmean ‘I2C_openâ€? msg[1].flags = I2C_M_RD | I2C_M_NOSTART; // Read ^~~~~~~~ I2C_openI2C.c:83:24: note: each undeclared identifier is reported only once for eachfunction it appears inI2C.c:83:35: error: ‘I2C_M_NOSTART†undeclared (first use in this function) msg[1].flags = I2C_M_RD | I2C_M_NOSTART; // Read ^~~~~~~~~~~~~I2C.c:74:24: warning: unused variable ‘msg†[-Wunused-variable] struct i2c_msg msg[2]; ^~~I2C.c: In function ‘EXT_I2C_writeRegisterâ€:I2C.c:110:24: error: array type has incomplete element type ‘struct i2c_msg†struct i2c_msg msg[2]; ^~~I2C.c:122:24: error: ‘I2C_M_NOSTART†undeclared (first use in this function) msg[1].flags = I2C_M_NOSTART; // Write ^~~~~~~~~~~~~I2C.c:110:24: warning: unused variable ‘msg†[-Wunused-variable] struct i2c_msg msg[2]; ^~~I2C.c: In function ‘EXT_I2C_writeâ€:I2C.c:148:24: error: storage size of ‘msg†isnâ€t known struct i2c_msg msg; ^~~I2C.c:148:24: warning: unused variable ‘msg†[-Wunused-variable]I2C.c: In function ‘EXT_I2C_readâ€:I2C.c:178:24: error: storage size of ‘msg†isnâ€t known struct i2c_msg msg; ^~~I2C.c:182:21: error: ‘I2C_M_RD†undeclared (first use in this function); didyou mean ‘I2C_openâ€? msg.flags = I2C_M_RD; ^~~~~~~~ I2C_openI2C.c:178:24: warning: unused variable ‘msg†[-Wunused-variable] struct i2c_msg msg; ^~~make: *** [Makefile:56: obj/I2C.o] Error 1
Best Answer