code generation with grt.tlc creates private header file

17 views (last 30 days)
Hello,
I have generated code for grt.tlc target in c language from Simulink model, version 2018a.
The generated folder modelname_rti_rtw contains a header file named modelname_private.h that declares only one function prototype with extern attribute.
The name of this function is the same of an 'enabled subsystem' in my model. This enabled subsystem has nothing in particular to be declared in a unique way like this ?
It's much easier to have everything in less files as possible to port it later.
Is there a way to configure code generation so it avoids generating this file ?
Thank you,
Chaabane

Answers (2)

Chaabane
Chaabane on 4 Dec 2019
Any idea guys ?

Sukrut Tamhankar
Sukrut Tamhankar on 8 May 2020
The generation of model_private.h can be avoided by setting File Packaging Format to Compact.
This option is available under:
Model Configuration Parameters > Code Generation > Code Placement > Code packaging > File packaging format.
There are 3 settings in file packaging format as : Modular, Compact (with separate data file) and Compact.
Modular setting outputs model_data.c, model_private.h, and model_types.h, in addition to generating model.c and model.h
Compact (with separate data file) setting conditionally outputs model_data.c, in addition to generating model.c and model.h
In Compact setting, the contents of model_data.c are in model.c and the contents of model_private.h and model_types.h are in model.h or model.c
For the contents of these generated files, please refer the table given in the following MATLAB documentation link:
  1 Comment
cui,xingxing
cui,xingxing on 11 Mar 2022
@Sukrut Tamhankar So the question is, if I don't use simulink , how can I use matlab coder + embeded coder toolbox to generate only a <name>.h and a corresponding <name>.c?

Sign in to comment.

Categories

Find more on Simulink Coder in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!