code generation with grt.tlc creates private header file

17 次查看(过去 30 天)
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

回答(2 个)

Chaabane
Chaabane 2019-12-4
Any idea guys ?

Sukrut Tamhankar
Sukrut Tamhankar 2020-5-8
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 个评论
cui,xingxing
cui,xingxing 2022-3-11
@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?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by