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!