codegen: Do I need to include the source generated under the "interface" directory when building a library on a different platform?
1 view (last 30 days)
Show older comments
Erick Castillo
on 24 May 2016
Commented: Erick Castillo
on 26 May 2016
I am successfully generating code for a basic algorithm that does not depend on any toolboxes. I am using the following configuration settings:
% Set up the configuration cfg = coder.config('lib');
cfg.TargetLang = 'C++'; cfg.TargetLangStandard = 'C99 (ISO)'
cfg.GenerateReport = false; cfg.LaunchReport = false; cfg.EnableVariableSizing = true;
cfg.GenCodeOnly = true; cfg.GenerateExampleMain = 'DoNotGenerate';
The output produces a folder called "interface". So far I am able to build without including the source files in the "interface" folder, but I'd like to know what they are just in case I'm incorrectly building my library. Are the files in the "interface" folder necessary when building on a different platform? If not now, will they become necessary if I start to export code that depends on MatLab toolboxes?
0 Comments
Accepted Answer
Ryan Livingston
on 26 May 2016
You don't need to include the code in the interface folder. That code is used for things like Software-in-the-Loop (SIL) and Processor-in-the-Loop (PIL).
To reliably package the generated code and other dependencies for compilation elsewhere, you can use packNGo which is described in the documentation.
If you are generating code for another platform, make sure to set up the HardwareImplementation property of the configuration object to match the integer sizes and other properties of that platform. You can also choose from many pre-configured options by changing cfg.HardwareImplementation.ProdHWDeviceType and possibly cfg.HardwareImplementation.TargetHWDeviceType. Using the Coder app to change these settings may be easier than the command line or you can open the Coder configuration UI to edit cfg by running:
open cfg
in MATLAB.
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!