IBM
Contents Index Previous Next



Optimization and Configuration


Optimization and configuration is mainly performed in two .h files. These are auto_cfg.h and extreme_user_cfg.h. The file auto_cfg.h is generated by the Cextreme Code Generator, and contains the optimization and configuration that can be automatically computed given the system that code is generated for. The extreme_user_cfg.h file is generated by The Targeting Expert from configuration information provided by the user.

auto_cfg.h

The auto_cfg.h has the contents discussed below. The first section in the file is used to configure mainly the size of some arrays and the size (8, 16, or 32 bits) needed to represent certain entities.

#define CFG_NUMBER_PROCESS_TYPES 2
#define CFG_MAX_INSTANCES 1
#define CFG_NUMBER_TIMERS 0
#define CFG_MAX_TIMER_INSTS 0
#define CFG_NUMBER_SIGNALS 4
#define CFG_NUMBER_THREADS 0
#define CFG_MAX_ACTIONS 2
#define CFG_MAX_STATES 1
#define CFG_MAX_STATE_INDEX_ENTRY 2

In the second section information is given about what concepts that are used in the system that code is generated for. For concepts that are used a #define is generated, while for concepts not used, a comment, saying the corresponding macro is not defined, is generated. The information in this section is used to scale the code, to remove code and fields in data structures that is not needed.

#define CFG_USED_DYNAMIC_THREADS
#define CFG_USED_UNLIMITED_INSTANCES
#define CFG_USED_TIMER
#define CFG_USED_CREATE
#define CFG_USED_STOP
#define CFG_USED_SAVE
#define CFG_USED_STATE_STAR
#define CFG_USED_INPUT_SAVE_STAR
#define CFG_USED_GUARD
#define CFG_USED_SIGNAL_WITH_PARAMS
#define CFG_USED_TIMER_WITH_PARAMS
#define CFG_USED_SIGNAL_WITH_DYN_PARAMS
#define CFG_USED_SENDER
#define CFG_USED_OFFSPRING
#define CFG_USED_PARENT
#define CFG_USED_SELF
#define CFG_USED_PROCEDURE
#define CFG_USED_RPC
#define CFG_USED_INITFUNC

The third section contains information about items in connection with data types, used to remove code in the file sctpred.c not needed by the generated application. The section contains a sequence of defines looking like the example below.

#define XNOUSE_"at-lot-of-things-about-data-types"

In rare cases the auto_cfg.h file might contain information that does not fit the application to be built. One such case is if the third section contains information that a certain function is not used, and therefore removed with ifdefs. The function is, however, used in user provided C code, in for example the environment functions. In such cases it is possible to override the information in auto_cfg.h by including macro definitions last in extreme_user_cfg.h.

Example 643 : Assume the auto_cfg.h contains

  #define XNOUSE_LENGTH_CHARSTRING

which shows that the length function for character strings are not used. To override this the following code should be included in uml_cfg.h:

#ifdef XNOUSE_LENGTH_CHARSTRING
  #undef XNOUSE_LENGTH_CHARSTRING
#endif 

extreme_user_cfg.h

This file is generated by the Targeting Expert and contains information about the options that you have selected.

extreme_user_cfg.h is, just as auto_cfg.h, a file that should contain defines that are used to build the Cextreme Code Generator application with specified options. The file extreme_user_cfg.h will include auto_cfg.h.

Some of the features discussed below can be selected in the Targeting Expert and will affect the contents of the extreme_user_cfg.h file. The options not included in the UI can be inserted in the file directly, just make sure that your modifications won't be overwritten by the Targeting Expert.

Process properties

Signal properties

Timer properties

Dynamic memory allocation

Error detection

Miscellaneous

Code generation commands

There are some options in the Targeting Expert that is passed to the code generator, sdtsan, and does not affect the extreme_user_cfg.h file. The purpose is to be able to generate as readable code as possible, which is also the default. If certain features are needed, that will affect the readability, these features can be selected individually. These options can be found in the "SDL to C compiler"-tab, in the group "Code generation options".


http://www.ibm.com/rational
Contents Index Previous Next