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!