linking local embedded library when code generation

8 visualizaciones (últimos 30 días)
seongjoo thunder
seongjoo thunder el 29 de Nov. de 2022
Editada: Mark McBroom el 2 de En. de 2023
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.
  1. 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
  2. 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.

Respuesta aceptada

Mark McBroom
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#
Thanks.
Mark.

Más respuestas (0)

Productos


Versión

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by