How to add libraries stored on the remote target (Raspberry Pi)
1 次查看(过去 30 天)
显示 更早的评论
Good day !
I have developed a piece of code to read i2c buffer (32 bits) on a Raspberry Pi. It works well on the Pi, and I am trying to implement the code as a Matlab system object.
I need to add the following libraries to make it work:
#include <linux/i2c-dev.h>
#include <i2c/smbus.h>
How should this be added to the Matlab system object ?
My first guess is that it should not require any link flags.
My second guess this is: use the addLinkerFlags function, but I have no idea what argument should be added.
function updateBuildInfo(buildInfo, context)
if context.isCodeGenTarget('rtw')
% Update buildInfo
srcDir = fullfile(fileparts(mfilename('fullpath')),'src'); %#ok<NASGU>
includeDir = fullfile(fileparts(mfilename('fullpath')),'include');
addIncludePaths(buildInfo,includeDir);
% Use the following API's to add include files, sources and
% linker flags
addIncludeFiles(buildInfo,'I2C_read.h',includeDir);
addSourceFiles(buildInfo,'I2C_read.c',srcDir);
% addLinkFlags(buildInfo,{'-lwiringPi'});
%addLinkObjects(buildInfo,'sourcelib.a',srcDir);
%addCompileFlags(buildInfo,{'-D_DEBUG=1'});
%addDefines(buildInfo,'MY_DEFINE_1')
end
any help ?
2 个评论
Prasanth Sunkara
2023-3-10
Hi Sylvain,
I dont think you need any explicit linker flags for this header. In which case, you dont have to use addLinkFlags API. By the way, is there any specific reason as to why you are rewriting i2c block/function? There is already a MATLAB function and Simulink blocks for i2c from the Raspberry Pi Support Package
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Raspberry Pi Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!