What is the relationship between coder.config objects, registering a toolchain with RTW, and mex_C_glnxa64.xml?

4 vues (au cours des 30 derniers jours)
BACKGROUND
  • I use MATLAB Coder.
  • After I create a custom toolchain and validate it, to register it I must create an object that appears to have a method called registerTargetInfo.
  • The name recommended for the function that creates this object is rtwTargetInfo.
  • I suspect that the rtw in rtwTargetInfo stands for Real-Time Workshop®, which is now known as Simulink Coder.
  • The mechanics of the toolchain registration is opaque to me, but it appears to me that MATLAB Coder can generate source-code without compiling it.
  • I thought that I had registered a custom toolchain properly, but when I let MATLAB Coder attempt the compilation step, too, it calls the wrong compiler. The path to this incorrect compiler appears only in the file mex_C_glnxa64.xml.
QUESTIONS
  • Must I update mex_C_glnxa64.xml by hand, or is there any relationship between this file and a custom toolchain?
  • What is happening when I register a custom toolchain?
  • Is there any way to link a coder.config object and a custom toolchain to give a more seamless view of the code-generation and compilation processes?

Réponses (1)

Mukund Sankaran
Mukund Sankaran le 14 Juin 2023
Hello Joe,
For MEX code generation, MATLAB Coder will use the MEX compiler that has been selected (for instance via mex-setup). Custom toolchains are not supported for MEX code generation, they are only supported for standalone code generation. You can create a standalone code configuration object using the coder.config function with 'lib', 'dll', or 'exe' as the argument, and use the Toolchain and/or CustomToolchainOptions properties to link the config to your custom toolchain.
Here is a doc page that explains how to go about this, and also gives some insight into how the toolchain registration mechanism works: https://www.mathworks.com/help/coder/ug/adding-a-custom-toolchain.html
Hope this helps!

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by