linking local embedded library when code generation
8 次查看(过去 30 天)
显示 更早的评论
Hello. I am generating c++ program from my s-function in simulink for processor in the loop (PIL) simulation. In the s-function, I utilized a library for window x64.
I hope to link the same library but for arm64 linux. My local embedded board already has the library. I tried to link this library but failed.
I tried several ways.
- to attach linking option like -L"PATH to the library" -lmylib. because the generated compile command put this option before the enumeration of objects files. So linking failed
- to attach external library options. I think this is the standard way to link external library however, the program failed to find the shared object (so.0) file / I tried to fix this problem, I couldn't
At the moment, the best way to link the library is add the linking option at the end of the compile command like
CXX CPPFLAGS OBJ LIB + <MY linking option>.
Because PIL updates makefile right before the simulation, it seems like that it's impossible to edit makefile in the local embedded board.
So the point is how to link local library when generating code using code generator.
0 个评论
采纳的回答
Mark McBroom
2023-1-2
编辑:Mark McBroom
2023-1-2
If you are on a windows computer, then Embedded Coder is using a Windows compiler ( either Visual Studio or mingw). You can't have a windows compiler link to a linux library.
What ARM processor are you using? Embedded coder supports most ARM processors running linux. https://www.mathworks.com/hardware-support/arm.html These support package include cross compiler for an ARM/Linux OS.
Once you are using a hardware support package, you should change your s-function to use the windows library for simulation but the linux library for generating code for targetprocessor. If you are using legacy_code tool to build your s-function, there are options for the library used for simulation and for code generation ( HostLibFiles and TargetLibFiles ). https://www.mathworks.com/help/simulink/slref/legacy_code.html#
Thanks.
Mark.
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!