With the MicroC profile, you can specify that elements
should be initialized at compile time.
Compile-time initialization provides the following benefits:
- Ability to allocate data to ROM
- Saving of CPU cycles at application startup
- Ability to allocate data to specific memory segments
With the compile-time initialization feature, you can specify that
compile-time initialization should be used for any of the following
elements:
- relations
- flow ports
- data from the MicroC Execution Framework (MXF)
- object attributes
Regarding object attributes, with the MicroC profile you can specify
different compile-time initialization values for an attribute that
appears in multiple instances of a class.
You specify that compile-time initialization should be used for
model elements by:
- Setting the values of a number of properties
- Providing values on the Initial Values tab of the Features window
for packages
Specifying compile-time initialization for relations,
flow ports, and framework data
The C_CG::Configuration::AllCategoriesInitializingMode property
provides the following values for setting the type of initialization
to use:
- CompileTime—The generated code uses compile-time
initialization for relations, flow ports, framework data, and all
user-defined attributes.
- RunTime—The generated code uses runtime initialization
for relations, flow ports, framework data, and all user-defined attributes.
- ByCategory—The use of compile-time or runtime initialization
in the generated code depends upon the values selected for the following
properties:
- C_CG::Configuration:AttributeInitializingMode
- C_CG::Configuration::DirectFlowPortsInitializingMode
- C_CG::Configuration::FrameworkInitializingMode
- C_CG::Configuration::RelationInitializingMode
:
Note: For flow ports and relations, compile-time initialization
code is only generated for direct flow ports and direct relations
(meaning that the C_CG::Configuration::DirectFlowPorts and
C_CG::Configuration::DirectRelations properties
must be set to True).
Specifying compile-time initialization for attributes
To
have the generated code use compile-time initialization for attributes,
use one of the following approaches:
- Set the value of the C_CG::Configuration::AllCategoriesInitializingMode property
to CompileTime.
- Set the value of the C_CG::Configuration::AllCategoriesInitializingMode property
to ByCategory, and set the value of the C_CG::Configuration:AttributeInitializingMode property
to CompileTime.
Specifying initial compile-time values for attributes
With
the MicroC profile, you can define different compile-time initialization
values for the same attribute when it appears in multiple objects.
Use
the Initial Values tab of the Features window
for the package that contains the attributes.
This tab lists
all the attributes for all the objects contained in the package. For
each attribute, enter the relevant initialization value.
When
objects contain parts, the Initial Values tab shows the parts and
their attributes hierarchically.
Note: The values displayed for
the attributes before you make any changes are the initial values
defined at the class level.