【发布时间】:2021-11-06 22:36:55
【问题描述】:
我正在尝试 BeagleBone Blue 的示例 Simulink 代码,名为 Counting Steps Using BeagleBone Blue Hardware。 web端是这样的。
当我尝试将代码发送到 Beagle 时,我在下方收到此错误。
另外,我想将 I2C 总线与 BeagleBone Blue 一起使用,并通过 Matlab (2019b) 和 Simulink 控制 Beagle。如果我将任何 I2C 模块添加到 Simulink 模型并尝试将代码发送到 Beagle,我会收到相同的错误。似乎创建的 C 代码是错误的。有人知道如何解决这个问题吗?
Error executing command "touch -c /home/debian/beagleboneblue_countstep_ert_rtw/*.*;make -f beagleboneblue_countstep.mk all -C /home/debian/beagleboneblue_countstep_ert_rtw". Details:
STDERR: MW_I2C.c: In function ‘EXT_I2C_writeH’:
MW_I2C.c:140:20: error: storage size of ‘msg’ isn’t known
struct i2c_msg msg;
^~~
MW_I2C.c: In function ‘EXT_I2C_readH’:
MW_I2C.c:177:20: error: storage size of ‘msg’ isn’t known
struct i2c_msg msg;
^~~
MW_I2C.c:183:21: error: ‘I2C_M_RD’ undeclared (first use in this function)
msg.flags = I2C_M_RD;
^~~~~~~~
MW_I2C.c:183:21: note: each undeclared identifier is reported only once for each function it appears in
MW_I2C.c: In function ‘MW_I2C_MasterRead’:
MW_I2C.c:261:28: warning: passing argument 1 of ‘EXT_I2C_readH’ makes integer from pointer without a cast [-Wint-conversion]
status = EXT_I2C_readH(I2CModuleHandle, SlaveAddress, data, DataLength);
^~~~~~~~~~~~~~~
MW_I2C.c:169:5: note: expected ‘int’ but argument is of type ‘MW_Handle_Type {aka void *}’
int EXT_I2C_readH(
^~~~~~~~~~~~~
MW_I2C.c: In function ‘MW_I2C_MasterWrite’:
MW_I2C.c:273:29: warning: passing argument 1 of ‘EXT_I2C_writeH’ makes integer from pointer without a cast [-Wint-conversion]
status = EXT_I2C_writeH(I2CModuleHandle, SlaveAddress, data, DataLength);
^~~~~~~~~~~~~~~
MW_I2C.c:132:5: note: expected ‘int’ but argument is of type ‘MW_Handle_Type {aka void *}’
int EXT_I2C_writeH(
^~~~~~~~~~~~~~
MW_I2C.c: In function ‘MW_I2C_Close’:
MW_I2C.c:302:24: warning: passing argument 1 of ‘EXT_I2C_terminateH’ makes integer from pointer without a cast [-Wint-conversion]
EXT_I2C_terminateH(I2CModuleHandle);
^~~~~~~~~~~~~~~
MW_I2C.c:221:5: note: expected ‘int’ but argument is of type ‘MW_Handle_Type {aka void *}’
int EXT_I2C_terminateH(int fd)
^~~~~~~~~~~~~~~~~~
make: *** [MW_I2C.c.o] Error 1
STDOUT: make: Entering directory '/home/debian/beagleboneblue_countstep_ert_rtw'
gcc -c -MMD -MP -MF"MW_I2C.c.dep" -MT"MW_I2C.c.o" -O0 -D_roboticscape_in_use_ -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -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 -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=beagleboneblue_countstep -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -I./ -o "MW_I2C.c.o" "MW_I2C.c"
beagleboneblue_countstep.mk:446: recipe for target 'MW_I2C.c.o' failed
make: Leaving directory '/home/debian/beagleboneblue_countstep_ert_rtw'
提前致谢
【问题讨论】:
-
消息很清楚。例如第一个,“
msg的存储大小未知”。这应该很容易追踪,但由于您的代码不包括在内,不知道如何提供帮助。只需通读每一个,并查看它所涉及的代码区域。仔细检查函数调用的参数输入是否正确等。这里的minimal reproducible example 会有所帮助。 -
有些相关,至少对于一些错误... "“i2c-dev”库的一些头文件被重新组织,我们的I2C源代码不兼容. MATLAB IO server" Look here 了解他们如何解决这个问题,也许类似的东西会对你有所帮助。
标签: c matlab simulink beagleboard