• No results found

2.3 Working with the ST editor and the compiler

2.3.6 Making settings for the compiler

You can define the compiler settings (compiler options) as follows:

● Globally for the SIMOTION project, valid for all programming languages, seeGlobal settings of the compiler (Page 45)

● Locally for an individual ST source within the SIMOTION project, see Local settings of the compiler (Page 46)

2.3.6.1 Global compiler settings

The global setting are valid for all programming languages within the SIMOTION project.

Proceed as follows

1. Select the menu Tools > Settings.

2. Select the Compiler tab.

3. Define the settings according to the following table.

4. Confirm with OK.

Figure 2-16 Global compiler settings

Parameter

Table 2-5 Parameters for global compiler settings

Parameter Description

Warning classes1 Active: In addition to the error messages, the compiler outputs warning messages of the selected classes.

Inactive: The compiler suppresses the warning messages of the respective class.

See also For meanings of the warning classes (Page 49).

Selective linking1 Active (standard): Unused code is removed from the executable program.

Parameter Description

Enable program status1 Active: Additional program code is generated to enable monitoring of program variables (including local variables).

Inactive (standard): Program status not possible.

See Properties of the program status (Page 265).

Permit language extensions1 Active: Language elements are permitted that do not comply with IEC 61131-3.

Inactive (standard): Only language elements that comply with IEC 61131-3 are permitted.

Only create program

instance data once1 Active: The local variables of a program are only stored once in the user memory of the unit. The setting is required when a further program is to be called within a program.

Inactive (standard): The local variables of a program are stored according to the task assignment in the user memory of the respective task.

See Memory ranges of the variable types (Page 194).

Display all messages with

Save and compile all2 Here, you can control the scope of the error log that will be displayed in the workbench's detail view when you call the Save and compile all command in SIMOTION SCOUT.

Active: A detailed log is created that is similar to that for single compilation of an ST source file.

Inactive: A compressed error log is created.

1 Local setting also possible, see Local settings of the compiler (Page 46).

2User-specific settings. Valid for all SIMOTION projects that the user processes.

NOTICE

You may have to recompile the project for the settings to take effect.

2.3.6.2 Local compiler settings

Local settings are configured individually for each ST source file; local settings overwrite global settings.

Proceed as follows

1. Open the Properties window for the ST source file, see Changing the properties of an ST source (Page 23):

Select the ST source file in the project navigator and select the Edit > Object properties menu command.

2. Select the Compiler tab.

3. Define the settings according to the following table.

4. Confirm with OK.

Figure 2-17 Local compiler settings for the ST source file

Parameter

Table 2-6 Parameters for the local compiler settings for the ST source file

Parameter Description

Ignore global settings Affects:

Warning classes

Selective linking

Use preprocessor

Enable program status

Permit language extensions

Only create program instance data once

Active: Only the selected local settings apply. The global settings are ignored.

Inactive: The respective global setting can be adopted. The corresponding checkbox is grayed out.

Suppress warnings In addition to error messages, the compiler can output warnings. You can set the scope of the output warning messages:

Active: The compiler outputs the warning messages according to the selection in the global settings of the warning classes. The checkboxes of the warning classes can no longer be selected.

Inactive: The compiler outputs the warning messages according to the following selection of the warning classes.

Warning classes1 Only for Suppress warnings = inactive.

Active: The compiler outputs warning messages of the selected class.

Inactive: The compiler suppresses warning messages of the respective class.

Parameter Description

Selective linking1 Active: Unused code is removed from the executable program.

Inactive: Unused code is retained in the executable program.

Grey background: The displayed global setting is adopted (only for Ignore global settings = inactive).

Use preprocessor1 Active: Preprocessor is used.

Inactive: Preprocessor is not used.

Grey background: The displayed global setting is adopted (only for Ignore global settings = inactive).

See Controlling the preprocessor (Page 243).

Enable program status1 Active: Additional program code is generated to enable monitoring of program variables (including local variables).

Inactive: Program status not possible.

Grey background: The displayed global setting is adopted (only for Ignore global settings = inactive).

See Properties of the program status (Page 265).

Permit language extensions1 Active: Language elements are permitted that do not comply with IEC 61131-3.

Inactive: Only language elements are permitted that comply with IEC 61131-3.

Grey background: The displayed global setting is adopted (only for Ignore global settings = inactive).

Only create program

instance data once1 Active: The local variables of a program are only stored once in the user memory of the unit. The setting is required when a further program is to be called within a program.

Inactive: The local variables of a program are stored according to the task assignment in the user memory of the respective task.

Grey background: The displayed global setting is adopted (only for Ignore global settings = inactive).

See Memory ranges of the variable types (Page 194).

Enable OPC-XML Active: Symbol information for the unit variables of the ST source is available in the SIMOTION device (required for the _exportUnitDataSet and _importUnitDataSet functions, see the SIMOTION Basic Functions Function Manual.

Inactive: Icon information is not created,

1 Global setting also possible, see Global settings of the compiler (Page 45).

2.3.6.3 Meaning of warning classes

The table lists the warning classes and their meanings.

Table 2-7 Meaning of warning classes

Warning class Meaning

0 Warnings for unreferenced or unused code sections and data 1 Warnings for hidden identifiers

2 Warnings for data type conversion, e.g. for data change 3 Warnings about set compiler options

4 Warnings about semaphores (potentially faulty functions) 5 Warnings about alarm functions

6 Warnings about constructs in libraries (unit variables declared) 7 Messages of the preprocessor

For the detailed description of the compiler error messages, specify which warning classes are assigned to the individual warnings (Page 361) and information (Page 365).

2.3.6.4 Display of the compiler options

You can view for a program source the following:

● The current compiler options using the global or local settings of the compiler.

● The compiler options used for the last compilation of the program source.

Requirement

The Properties window of the program source (Page 23) is open.

Proceed as follows

To display the current compiler options using the global or local settings of the compiler (Page 44):

● Select the Additional settings tab.

The current compiler options for the program source are displayed. They are valid for a future compilation.

To display the compiler options used for the last compilation of the program source:

● Select the Compiler tab.

The following are displayed for the last compilation of the program source:

– The version of the used compiler.

– The used compiler options.

Meaning of the compiler options

Compiler option Meaning

-c2 Do not create debug and symbol information.

-C lang_ext -C lang_iec

"Permit language extensions"1 active.

"Permit language extensions" inactive.

-C opcsym -C no_opcsym

"Permit OPC-XML"1 active.

"Permit OPC-XML" inactive.

-C opcsym -C no_preproc

"Use preprocessor"1 active.

"Use preprocessor" inactive.

-C prog_once -C prog_multi

"Create program instance data only once"1 active.

"Create program instance data only once" inactive.

-D text Preprocessor definition (Page 51).

-e local2 -e user2

Only local settings act.

Only global settings act.

No details (default): Global settings will be augmented with local settings.

-I2 Accept the package settings from device or library.

-l sel -l no_sel

"Selective linking"1 active.

"Selective linking" inactive.

-s -s_off

"Enable program status"1 active.

"Enable program status" inactive.

-w no_warn -w all_warn2 -w n_off -w n_on

"Suppress warnings"1 active.

Display all warnings.

Warning class n active1. Warning class n inactive1.

Further options Internal options of the SIMOTION compiler.

1 Meaning of the compiler option: see "Local compiler settings (Page 46)".

2 Only when the compiler is called from the command line, e.g. using scripting.

Note

The compiler options can also be specified when the compiler is called from the command line, e.g. using scripting.