linking local embedded library when code generation
10 visualizaciones (últimos 30 días)
seongjoo thunder el 29 de Nov. de 2022
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.
Mark McBroom el 2 de En. de 2023
Editada: Mark McBroom el 2 de En. de 2023
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#