Upload
lamphuc
View
282
Download
0
Embed Size (px)
Citation preview
IAR Visual StateUser Guide
UVS-11
2
COPYRIGHT NOTICE 20022018 IAR Systems AB.
No part of this document may be reproduced without the prior written consent of IAR Systems AB. The software described in this document is furnished under a license and may only be used or copied in accordance with the terms of such a license.
DISCLAIMERThe information in this document is subject to change without notice and does not represent a commitment on any part of IAR Systems. While the information contained herein is assumed to be accurate, IAR Systems assumes no responsibility for any errors or omissions.
In no event shall IAR Systems, its employees, its contractors, or the authors of this document be liable for special, direct, indirect, or consequential damage, losses, costs, charges, claims, demands, claim for lost profits, fees, or expenses of any nature or kind.
TRADEMARKSIAR Systems, IAR Embedded Workbench, Embedded Trust, IAR Connect, C-SPY, C-RUN, C-STAT, IAR Visual State, IAR KickStart Kit, I-jet, I-jet Trace, I-scope, IAR Academy, IAR, and the logotype of IAR Systems are trademarks or registered trademarks owned by IAR Systems AB.
Microsoft and Windows are registered trademarks of Microsoft Corporation.
Adobe and Acrobat Reader are registered trademarks of Adobe Systems Incorporated.
All other product names are trademarks or registered trademarks of their respective owners.
EDITION NOTICE Eleventh edition: June 2018
Part number: UVS-11
This guide applies to version 9.1.x of IAR Visual State.
This guide replaces the obsolete guides IAR visualSTATE User Guide (UVS-5 and previous editions), as well as the IAR visualSTATE API Guide, the IAR visualSTATE Version 5 Project Setup Guide, IAR visualSTATE Reference Guide, IAR visualSTATE Quick Start Tutorial, C-SPYLink User Guide, and Getting Started with visualSTATE.
Internal reference: IJOA.
AFE1_AFE2-1:1
IAR Visual StateUser Guide
Brief contentsTables ..................................................................................................................... 41
Preface .................................................................................................................... 43
Part 1. IAR Visual State and its components ..... 51
IAR Visual State and state machine design .......................................... 53
Part 2. Projectmanagement using the Navigator ................................... 67
Project management ....................................................................................... 69
Source code control ..................................................................................... 101
The IAR Visual State Compare Tool ................................................... 105
Custom commands ....................................................................................... 111
Part 3. Designing using the Designer ......................... 119
Designing ............................................................................................................. 121
States ..................................................................................................................... 141
Transitions ......................................................................................................... 171
Transition elements ...................................................................................... 181
Reusing designs using state machine templates .............................. 205
Using variants and features ....................................................................... 221
The Visual State Designer .......................................................................... 227
Part 4. Simulating using the Validator ..................... 313
Simulation .......................................................................................................... 315
AFE1_AFE2-1:1
3
4
Graphical animation ...................................................................................... 329
Tracing ................................................................................................................. 335
Analyzing ............................................................................................................. 339
Recording and playing test/event sequences .................................... 343
The Visual State Validator ......................................................................... 351
Part 5. Formalverification using the Verificator .................................... 403
Formal verification ......................................................................................... 405
Checks performed by the Verificator ................................................. 425
Verificator command line options ......................................................... 439
Part 6. Code generation using a Coder .................. 447
Code generation ............................................................................................. 449
HCoder API code generation .................................................................. 457
HCoder API reference information ..................................................... 463
The Visual State Hierarchical Coder ................................................... 485
Hierarchical Coder command line options ...................................... 509
Adaptive API code generation ................................................................. 561
Uniform API code generation .................................................................. 577
Adaptive API reference information .................................................... 581
Uniform API reference information ..................................................... 627
The Visual State Classic Coder ............................................................... 665
Classic Coder command line options .................................................. 693
AFE1_AFE2-1:1
IAR Visual StateUser Guide
Brief contents
Part 7. Testing yourstate machine model on hardware ............................... 747
Debugging design models using C-SPYLink ...................................... 749
Debugging design models using RealLink ........................................... 775
Part 8. DocumentingVisual State projects using the Documenter ... 801
Documenting projects ................................................................................. 803
Documenter command line options .................................................... 827
Part 9. Additional features and utilities .................. 871
Prototyping a graphical interface ............................................................ 873
Viewing design models via the Visual State Viewer ..................... 897
Using IAR Visual State remotely via the Control Center ......... 899
Importing and exporting design models via XMI files ............. 917
The Visual State State Machine API for programmatic manipulation of models ............................................................................... 921
Handling Visual State files from previous versions ....................... 923
Glossary ............................................................................................................... 925
Index ..................................................................................................................... 935
AFE1_AFE2-1:1
5
6
AFE1_AFE2-1:1
IAR Visual StateUser Guide
ContentsTables ..................................................................................................................... 41
Preface .................................................................................................................... 43
Who should read this guide ............................................................... 43Required knowledge .......................................................................... 43
How to use this guide ........................................................................... 43What this guide contains ..................................................................... 44
Part 1. IAR Visual State and its components ..................................... 44
Part 2. Project management using the Navigator ............................... 44
Part 3. Designing using the Designer ................................................. 44
Part 4. Simulating using the Validator ............................................... 45
Part 5. Formal verification using the Verificator ............................... 45
Part 6. Code generation using a Coder ............................................... 46
Part 7. Testing your state machine model on hardware ..................... 47
Part 8. Documenting Visual State projects using the Documenter .... 47
Part 9. Additional features and utilities .............................................. 47
Other documentation ........................................................................... 48User and reference guides .................................................................. 48
The online help system ...................................................................... 48
Web sites ............................................................................................ 48
Document conventions ........................................................................ 49Typographic conventions ................................................................... 49
Naming conventions .......................................................................... 50
Part 1. IAR Visual State and its components ..... 51
IAR Visual State and state machine design .......................................... 53
Introduction to IAR Visual State and its components ........... 53Why use IAR Visual State and state machines .................................. 53
IAR Visual State overview ................................................................ 54
Important features and advantages ..................................................... 57
AFE1_AFE2-1:1
7
8
Application development using IAR Visual State ..................... 60The application development cycle .................................................... 61
Control logic, data manipulation, and device drivers ........................ 62
Code required for an application ........................................................ 63
Project examples ................................................................................ 64
Sample source code ............................................................................ 65
Part 2. Projectmanagement using the Navigator ................................... 67
Project management ....................................................................................... 69
Introduction to project management using the Navigator . 69Briefly about the Visual State Navigator ........................................... 69
The Visual State project ..................................................................... 70
The workspace ................................................................................... 71
Variants and features .......................................................................... 73
Setting up workspaces and projects ............................................... 73Starting IAR Visual State ................................................................... 74
Creating a standard workspace .......................................................... 74
Creating a new project in a workspace .............................................. 75
Adding an existing project to a workspace ........................................ 76
Setting a project or system as active .................................................. 77
Setting Verificator, Coder, and Documenter options ......................... 77
Graphical environment for the Navigator ................................... 79The Navigator main window .............................................................. 80
HTML Viewer window ...................................................................... 83
Navigator Reload Files dialog box ..................................................... 84
Navigator Settings dialog box ........................................................... 85
New Project dialog box ..................................................................... 87
New Workspace dialog box .............................................................. 88
Output window ................................................................................... 89
Properties window .............................................................................. 90
Workspace Browser window ............................................................. 90
AFE1_AFE2-1:1
IAR Visual StateUser Guide
Contents
Reference information on Navigator menus .............................. 91File menu ............................................................................................ 92
Edit menu ........................................................................................... 94
View menu ......................................................................................... 95
Project menu ...................................................................................... 96
Tools menu ........................................................................................ 97
Window menu .................................................................................... 98
Help menu .......................................................................................... 98
Navigator shortcut key summary ....................................................... 99
Source code control ..................................................................................... 101
Introduction to using source code control ................................ 101Briefly about using a source
code control system with IAR Visual State ..................................... 101
Using source code control ................................................................ 101Specifying a user name for your source code control system .......... 102
Adding a file to your source code control system ............................ 102
Accessing files under source code control ....................................... 102
Updating the source code control status .......................................... 103
The IAR Visual State Compare Tool ................................................... 105
Introduction to the IAR Visual State Compare Tool ........... 105Using the IAR Visual State Compare Tool ............................... 105Reference informationon the IAR Visual State Compare Tool ...................................... 106
IAR Visual State Compare Tool window ........................................ 107
File menu .......................................................................................... 108
View menu ....................................................................................... 108
Commands menu .............................................................................. 109
Help menu ........................................................................................ 109
Custom commands ....................................................................................... 111
Introduction to custom commands .............................................. 111Briefly about custom commands ...................................................... 111
AFE1_AFE2-1:1
9
10
Using custom commands .................................................................. 111Creating a custom command ............................................................ 111
Executing a custom command ......................................................... 113
Editing or deleting a custom command ............................................ 113
Renumbering custom command macros .......................................... 114
Graphical environment for custom commands ...................... 114Custom Commands dialog box ........................................................ 115
Part 3. Designing using the Designer ......................... 119
Designing ............................................................................................................. 121
Introduction to designingstate machines using the Designer ............................................... 121
Briefly about state machines and designing ..................................... 121
Runtime behaviormacrosteps and microsteps .............................. 126
The Visual State system ................................................................... 127
Designing state machines .................................................................. 130Identifying and creating events and action functions ....................... 131
Identifying and drawing simple states ............................................. 132
Organizing your states logically ...................................................... 133
Creating transitions between your states .......................................... 134
Synchronizing one part of the model with other parts of the model 140
States ..................................................................................................................... 141
Introduction to states ......................................................................... 141Briefly about states ........................................................................... 141
Simple state ...................................................................................... 144
Composite state ................................................................................ 144
Initial state ........................................................................................ 145
Shallow history pseudostate ............................................................. 147
Deep history pseudostate ................................................................. 151
Join and fork pseudostates ............................................................... 152
Junction pseudostate ........................................................................ 153
Connector pseudostate ..................................................................... 153
AFE1_AFE2-1:1
IAR Visual StateUser Guide
Contents
Choice state ...................................................................................... 154
State reactions .................................................................................. 154
Working with states ............................................................................ 157Creating a state with a state reaction ................................................ 157
Creating states with a uniform look using stereotypes .................... 160
Drawing a connector state ................................................................ 161
Drawing initial, shallow history,
and deep history states (pseudostates) ............................................. 161
Drawing fork and join states ............................................................ 162
Drawing a junction state .................................................................. 163
Drawing a choice state ..................................................................... 163
Working with composite states and regions ............................ 163Creating a composite state consisting of concurrent regions ........... 163
Hiding the contents in off-page regions ........................................... 165
Adding descriptions for off-page regions ........................................ 167
Excluding states or regions from further processing ....................... 167
Transitions ......................................................................................................... 171
Introduction to transitions ............................................................... 171Briefly about transitions ................................................................... 171
The transition condition ................................................................... 172
The transition action ......................................................................... 176
Completion transitions ..................................................................... 177
Trigger-less transitions ..................................................................... 177
Local transitions ............................................................................... 177
Else transitions ................................................................................. 178
Transition rule deductionan example ........................................... 178
Creating transitions ............................................................................. 179
Transition elements ...................................................................................... 181
Introduction to transition elements ............................................. 181Briefly about transition elements ..................................................... 181
Events ............................................................................................... 183
Event group ...................................................................................... 184
Signal ............................................................................................... 185
AFE1_AFE2-1:1
11
12
Action function ................................................................................ 186
Working with transitionelements and transition element files ......................................... 187
Creating a transition element ........................................................... 188
Making local elements global .......................................................... 189
Declaring global elements locally .................................................... 189
Specifying arguments for action function parameters ..................... 189
Adding assignments and guard expressions ..................................... 191
Setting a constraint for a state reaction ............................................ 193
Specifying the signal queue behavior and size ................................ 194
Declaring action functions in external C files .................................. 196
Setting up an external editor for action functions ............................ 196
Searching for a transition element ................................................... 196
Creating and adding a new transition element file ........................... 197
Adding an existing transition element file ....................................... 197
Editing the contents of a transition element file .............................. 197
Deleting, renaming, or saving a transition element file under a new
name ................................................................................................. 198
Visual State operators, reference information ........................ 198Precedence of operators ................................................................... 198
Assignment operators ....................................................................... 198
Binary arithmetic operators .............................................................. 198
Bit manipulation operators ............................................................... 199
Logical operators .............................................................................. 199
Relational operators ......................................................................... 199
Unary arithmetic operators ............................................................... 200
Unary bitwise operators ................................................................... 200
Unary logical operators .................................................................... 200
Visual State operands, reference information ......................... 200Visual State data types ..................................................................... 201
Internal variables .............................................................................. 202
External variables ............................................................................. 202
Visual State constants ...................................................................... 202
Syntax for guard expressions and action expressions .......... 202
AFE1_AFE2-1:1
IAR Visual StateUser Guide
Contents
Reusing designs using state machine templates .............................. 205
Introduction to state machine templates .................................. 205State machine templates and submachine states .............................. 205
Hints for designing state machine templates .................................... 207
Working with state machine templates and submachine states .......................................................................................................... 208
Creating state machine templates ..................................................... 208
Instantiating a state machine template ............................................. 211
Drawing an entry (exit) point state .................................................. 214
Binding state conditions .................................................................. 218
Using variants and features ....................................................................... 221
Introduction to variants and features .......................................... 221Variants ............................................................................................ 221
Features ............................................................................................ 221
Include/exclude parts in a variant .................................................... 222
Working with variants and features ............................................. 222Defining a new feature in your model ............................................. 222
Defining a new variant in your model ............................................. 223
Including a region in a variant or feature ......................................... 224
Including a transition in a variant or feature .................................... 224
Including a state in a variant or feature ............................................ 225
Including a transition element in a variant or feature ...................... 225
The Visual State Designer .......................................................................... 227
Introduction to the Visual State Designer ................................ 227Briefly about the Visual State Designer ........................................... 228
Using the Visual State Designer ..................................................... 229Creating and saving a project with
systems and state machine diagrams ................................................ 229
Creating systems and state machine diagrams in a blank project .... 230
Editing objects in the state machine diagram ................................... 231
Inserting notes .................................................................................. 232
Navigating in the state machine diagram ......................................... 233
AFE1_AFE2-1:1
13
14
Getting warnings for non-verifiable elements ................................. 233
Importing C header files into
the project or top-level state machine .............................................. 234
Creating multiple system instances .................................................. 235
Using Designer backup files ............................................................ 235
Customizing the Designer ................................................................ 235
Graphical environment for the Designer ................................... 236The Designer main window ............................................................. 237
Customize Appearance dialog box .................................................. 243
Define Action Function Arguments dialog box ............................... 244
Edit Action dialog box ..................................................................... 245
Edit Constant dialog box .................................................................. 247
Edit Event dialog box ....................................................................... 248
Edit Event Group dialog box ........................................................... 249
Edit External Variable dialog box .................................................... 251
Edit Features dialog box .................................................................. 252
Edit Internal Variable dialog box ..................................................... 254
Edit Note dialog box ........................................................................ 255
Edit Project dialog box ..................................................................... 256
Edit Region dialog box .................................................................... 257
Edit Signal dialog box ...................................................................... 258
Edit State dialog box ........................................................................ 259
Edit Submachine State dialog box ................................................... 262
Edit System dialog box .................................................................... 265
Edit Transition dialog box ................................................................ 266
Edit Variants dialog box .................................................................. 268
Find dialog box ................................................................................ 269
Grid Setup dialog box ...................................................................... 270
Output window ................................................................................. 271
Project Browser window .................................................................. 272
Project View window ....................................................................... 279
Property window .............................................................................. 281
Settings dialog box ........................................................................... 281
State machine diagram window ....................................................... 284
AFE1_AFE2-1:1
IAR Visual StateUser Guide
Contents
System View window ...................................................................... 287
Transition Elements window ........................................................... 288
Zoom View window ......................................................................... 290
General Designer windows context menus ...................................... 291
Reference information on Designer menus .............................. 295File menu .......................................................................................... 296
Edit menu ......................................................................................... 298
View menu ....................................................................................... 300
Insert menu ....................................................................................... 302
Format menu .................................................................................... 304
Tools menu ....................................................................................... 305
Window menu .................................................................................. 306
Help menu ........................................................................................ 307
Designer shortcut key summary ....................................................... 307
Syntax of C header files ..................................................................... 309Syntax for import of function declarations ...................................... 310
Syntax for import of constants ......................................................... 310
Syntax for importing triggers ........................................................... 311
Part 4. Simulating using the Validator ..................... 313
Simulation .......................................................................................................... 315
Introduction to simulatingyour model using the Validator ...................................................... 315
Briefly about simulating using the Validator ................................... 315
Debugging modes ............................................................................ 316
Viewing elements during simulation ............................................... 316
Conditional breakpoints ................................................................... 317
Simulating models using the Validator ....................................... 318Creating a new Validator workspace ............................................... 318
Preparing for the simulation ............................................................. 319
Specifying event parameters ............................................................ 320
Sending events manually ................................................................. 321
Filtering events ................................................................................. 322
AFE1_AFE2-1:1
15
16
Activating automatic signal queue handling .................................... 322
Using manual emptying of signal queues ........................................ 322
Handling signal queues for a single system ..................................... 323
Defining breakpoints ........................................................................ 323
Using breakpoints ............................................................................ 324
Changing values of variables ........................................................... 326
Setting action function return values ............................................... 326
Forcing states ................................................................................... 327
Specifying the order of the systems/instances ................................. 327
Toggling between Validator mode and Target mode for a window 328
Graphical animation ...................................................................................... 329
Introduction to graphical animation of debug sessions ....... 329Graphical animation of debug sessions ............................................ 329
Animating debug sessions graphically ......................................... 329Animating your debug session graphically ...................................... 329
Setting breakpoints for graphical animation .................................... 330
Customizing shapes and colors for graphical animation ................. 330
Graphical environment for graphical animation .................... 331Designer windows in Graphical Animation mode ........................... 331
Customize Graphical Animation dialog box .................................... 332
Tracing ................................................................................................................. 335
Introduction to tracing your state machine model ............... 335Tracing using the Validator .............................................................. 335
Tracing state machine models ........................................................ 335Setting up a trace .............................................................................. 335
Setting up the trace point ................................................................. 337
Analyzing ............................................................................................................. 339
Introduction to analyzing using the Validator ......................... 339Static and dynamic analysis ............................................................. 339
Analyzing using the Validator ......................................................... 340Performing static analysis ................................................................ 340
Performing dynamic analysis ........................................................... 341
AFE1_AFE2-1:1
IAR Visual StateUser Guide
Contents
Recording and playing test/event sequences .................................... 343
Introduction to recording and playing test sequences ......... 343Briefly about recording test and event sequences ............................ 343
Briefly about playing recorded test sequences ................................. 344
Recording and playing your test sequences .............................. 344Recording a test sequence to a sequence file ................................... 344
Viewing output from steps ............................................................... 345
Playing your recorded test sequence ................................................ 346
Jumping to a specific step in a recorded test sequence .................... 347
Comparing played test sequences with recorded output .................. 347
Event sequence files description .................................................... 349Syntax ............................................................................................... 349
The Visual State Validator ......................................................................... 351
Introduction to the Visual State Validator ................................ 351Briefly about the Visual State Validator .......................................... 352
Graphical environment for the Validator .................................. 353The Validator main window ............................................................ 354
Actions window ............................................................................... 358
Animation Speed dialog box ............................................................ 359
Breakpoint Reached dialog box ....................................................... 359
Breakpoints window ........................................................................ 360
Breakpoints Setup dialog box : Actions ........................................... 361
Breakpoints Setup dialog box : Current States ................................ 362
Breakpoints Setup dialog box : Events/Signals ............................... 363
Breakpoints Setup dialog box : General .......................................... 364
Breakpoints Setup dialog box : Next States ..................................... 365
Breakpoints Setup dialog box : Variables ........................................ 366
Dynamic Analysis window .............................................................. 368
Events window ................................................................................. 370
Find Trace dialog box ...................................................................... 372
Guard Expressions window ............................................................. 373
Log Mismatch Detected dialog box ................................................. 374
Output window ................................................................................. 375
AFE1_AFE2-1:1
17
18
Sequence File window ..................................................................... 376
Sequence File dialog box ................................................................. 379
Set Event Parameter Value dialog box ............................................ 379
Signal Queues window ..................................................................... 380
Static Analysis window .................................................................... 381
Systems window .............................................................................. 382
System Setup window ...................................................................... 384
Timer Tick Length dialog box ......................................................... 385
Timers window ................................................................................ 385
Trace Point Setup dialog box ........................................................... 387
Variables window ............................................................................ 388
Watch window ................................................................................. 391
Reference information on Validator menus ............................. 392File menu .......................................................................................... 393
Edit menu ......................................................................................... 394
View menu ....................................................................................... 396
Debug menu ..................................................................................... 397
Window menu .................................................................................. 399
Help menu ........................................................................................ 400
Validator shortcut key summary ...................................................... 400
Part 5. Formalverification using the Verificator .................................... 403
Formal verification ......................................................................................... 405
Introduction to formal verification using the Verificator ... 405Briefly about verification using the Verificator ............................... 405
The checks that can be performedan overview ............................ 405
Verification modes ........................................................................... 408
Verification strategies ...................................................................... 408
Optimizing for verification .............................................................. 412
Verifying state machine models ..................................................... 414Starting the verification .................................................................... 414
Tracing your verified state machine model ...................................... 417
AFE1_AFE2-1:1
IAR Visual StateUser Guide
Contents
Graphical environment for the Verificator ............................... 418Verificator Options dialog box ........................................................ 418
Verificator Options: General ............................................................ 419
Verificator Options: Check options ................................................. 421
Verificator window .......................................................................... 422
Checks performed by the Verificator ................................................. 425
Overview of checks, modes, and errors ..................................... 425Performing various checks ............................................................... 426
Check for unused elements .............................................................. 426
Check for activation of elements ..................................................... 428
Check for conflicting transitions ...................................................... 431
Check for state dead ends ................................................................. 432
Check for local dead ends ................................................................ 433
Check for system dead ends ............................................................. 434
Check for dynamic ambiguous assignments .................................... 434
Check for static ambiguous assignments ......................................... 435
Check for signal queue size ............................................................. 436
Check for domain errors .................................................................. 437
Verificator command line options ......................................................... 439
Introduction to invokingthe Verificator using command line options ............................ 439
Briefly about invoking the Verificator ............................................ 439
Invocation syntax for the Verificator ............................................... 439
Summary of Verificator options .................................................... 440Descriptions of Verificator options ............................................... 441
-B ...................................................................................................... 441
-c ....................................................................................................... 441
-ds ..................................................................................................... 442
-f ....................................................................................................... 442
-large ................................................................................................ 442
-p ...................................................................................................... 442
-s ....................................................................................................... 443
-S ...................................................................................................... 443
AFE1_AFE2-1:1
19
20
-small ................................................................................................ 443
-t ....................................................................................................... 444
-u ...................................................................................................... 444
-v ...................................................................................................... 444
-variant ............................................................................................. 445
-w ..................................................................................................... 445
-x ...................................................................................................... 445
-y ...................................................................................................... 446
Part 6. Code generation using a Coder .................. 447
Code generation ............................................................................................. 449
Introduction to code generation,the Coders, and the APIs .................................................................. 449
The Hierarchical coder versus the Classic Coder ............................ 449
Code generation using the Visual State Coders ............................... 449
The Visual State APIs ...................................................................... 451
Briefly about the generated code layers ........................................... 453
Size of generated table-based code .................................................. 453
Size of generated readable code ....................................................... 454
Generating code using a Coder and an API .............................. 454Tailoring data types for a specific compiler ..................................... 455
HCoder API code generation .................................................................. 457
Introduction to the HCoder API code generation ................ 457Briefly about HCoder API code generation ..................................... 457
API table-based code with C++ ....................................................... 458
API code ........................................................................................... 459
Using the HCoder API for table-based code and C++ ..................... 459
Using the HCoder API ....................................................................... 461Setting up the file structure for the HCoder API ............................. 461
HCoder API reference information ..................................................... 463
HCoder API source files .................................................................... 463HCoder-generated source files for the API ...................................... 463
AFE1_AFE2-1:1
IAR Visual StateUser Guide
Contents
Summary of the HCoder API functions ..................................... 465Descriptions of the HCoder API functions ................................ 466
VSActiveState .................................................................................. 466
VSDeduct ......................................................................................... 467
VSDelete .......................................................................................... 469
VSProjectEnterState ........................................................................ 469VSEventExpl .................................................................................... 470
VSEventName .................................................................................. 470
VSGetSystemObjectSize ................................................................. 471
VSInitAll .......................................................................................... 471
VSInquiry ......................................................................................... 472
VSProjectLeaveState ....................................................................... 473VSMachineExpl ............................................................................... 473
VSMachineName ............................................................................. 474
VSNew ............................................................................................. 474
VSNofEventParameters ................................................................... 475
VSNofEvents ................................................................................... 476
VSNofInstances ............................................................................... 476
VSNofMachines ............................................................................... 476
VSNofStates ..................................................................................... 477
VSNofVariables ............................................................................... 477
VSParentMachine ............................................................................ 478
VSParentState .................................................................................. 478
VSReinitialize .................................................................................. 479
VSSetInstance .................................................................................. 479
VSStateName ................................................................................... 480
VSSymbolicVariableName .............................................................. 481
VSTopMachine ................................................................................ 482
VSVariableValue ............................................................................. 482
HCoder API return codes ................................................................. 483VSRC_CannotAllocateMemory ...................................................... 483
VSRC_Conflict ................................................................................ 483
VSRC_EventActive ......................................................................... 483
VSRC_OK ....................................................................................... 484
AFE1_AFE2-1:1
21
22
VSRC_RangeError ........................................................................... 484
VSRC_SignalQueueOverflow ......................................................... 484
The Visual State Hierarchical Coder ................................................... 485
Introduction to the Visual State Hierarchical Coder ........... 485Briefly about the Visual State Hierarchical Coder ........................... 485
Graphical environment for the Hierarchical Coder .............. 485Hierarchical Coder Options dialog box ........................................... 486
Hierarchical Coder Options dialog box: Configuration ................... 487
Hierarchical Coder Options dialog box: File Output ....................... 488
Hierarchical Coder Options dialog box: Memory ............................ 490
Hierarchical Coder Options dialog box: Code ................................. 491
Hierarchical Coder Options dialog box: Optimization .................... 496
Hierarchical Coder Options dialog box: Extended Keywords ......... 500
Hierarchical Coder Options dialog box: API Functions .................. 502
Hierarchical Coder Options dialog box: C-SPYLink ...................... 503
Hierarchical Coder Options dialog box: Names .............................. 505
Type identifiers ...................................................................................... 507Transition rule data format ............................................................. 508
Hierarchical Coder command line options ...................................... 509
Introduction to invoking the HCoder using command line options ....................................................................................................... 509
Briefly about invoking the Hierarchical Coder ............................... 509
Invocation syntax for the Hierarchical Coder .................................. 510
Summary of Hierarchical Coder options ................................... 511Descriptions of Hierarchical Coder options ............................. 516
-af_activeState .................................................................................. 516
-af_gsos ............................................................................................ 516
-af_gvv ............................................................................................. 517
-af_inquiry ........................................................................................ 517
-af_nofEventParameters ................................................................... 518
-af_nofEvents ................................................................................... 518
-af_nofInstances ............................................................................... 519
-af_nofMachines .............................................................................. 519
AFE1_AFE2-1:1
IAR Visual StateUser Guide
Contents
-af_nofStates .................................................................................... 520
-af_nofVariables ............................................................................... 520
-af_parentMachine ........................................................................... 521
-af_parentState ................................................................................. 521
-af_topMachine ................................................................................ 522
-armsemihostingbreakpoint .............................................................. 522
-autoentryfunction ............................................................................ 523
-autoexitfunction .............................................................................. 523
-constactionfpt .................................................................................. 524
-constguardfpt .................................................................................. 524
-constsc ............................................................................................. 525
-constvbfpt ....................................................................................... 525
-cpp ................................................................................................... 526
-cppsourcefileext .............................................................................. 526
-cspylink ........................................................................................... 526
-D ..................................................................................................... 527
-dlibbreakpoint ................................................................................. 528
-dso ................................................................................................... 528
-epm ................................................................................................. 529
-exclude ............................................................................................ 529
-fullinstrumentation .......................................................................... 530
-funcexph ......................................................................................... 530
-gds ................................................................................................... 531
-gip ................................................................................................... 531
-H ..................................................................................................... 532
-ipev ................................................................................................. 532
-isev .................................................................................................. 533
-issn .................................................................................................. 533
-isvn .................................................................................................. 534
-itcfe ................................................................................................. 534
-ivsufp .............................................................................................. 535
-kw_actionexpr ................................................................................. 535
-kw_clsame ...................................................................................... 535
-kw_dbexpr ...................................................................................... 536
AFE1_AFE2-1:1
23
24
-kw_guardexpr ................................................................................. 536
-kw_prj_extvar ................................................................................. 537
-kw_runtimeinfo ............................................................................... 537
-kw_sys_extvar ................................................................................ 538
-kw_systemClass .............................................................................. 538
-kw_systemObject ............................................................................ 538
-lssn .................................................................................................. 539
-macros ............................................................................................. 539
-namespace ....................................................................................... 539
-no_warnings .................................................................................... 540
-opt_asse ........................................................................................... 540
-opt_d ............................................................................................... 541
-opt_eise ........................................................................................... 541
-opt_h ............................................................................................... 542
-opt_msc ........................................................................................... 542
-opt_rrs ............................................................................................. 543
-opt_scum ......................................................................................... 543
-opt_sobitarray ................................................................................. 544
-opt_somos ....................................................................................... 544
-opt_tr ............................................................................................... 545
-opt_ubabiv ...................................................................................... 545
-opt_ubfbev ...................................................................................... 546
-opt_uso ............................................................................................ 546
-path ................................................................................................. 547
-projectheader ................................................................................... 547
-projectnamespace ............................................................................ 547
-projectsource ................................................................................... 548
-pssf .................................................................................................. 548
-pssn ................................................................................................. 549
-R ...................................................................................................... 549
-recordingbuffersize ......................................................................... 549
-riins ................................................................................................. 550
-S ...................................................................................................... 550
-samplingbuffersize .......................................................................... 551
AFE1_AFE2-1:1
IAR Visual StateUser Guide
Contents
-siss ................................................................................................... 551
-spath ................................................................................................ 552
-ssewi ............................................................................................... 552
-suppress_cspylink_common_files .................................................. 553
-targetbreakpoints ............................................................................. 553
-txte .................................................................................................. 553
-txtm ................................................................................................. 554
-txts ................................................................................................... 555
-uselivesamplingbuffer ..................................................................... 555
-usepop ............................................................................................. 556
-userecordingbuffer .......................................................................... 556
-usesamplingbuffer ........................................................................... 557
-V ..................................................................................................... 557
-variant ............................................................................................. 558
-warnings_affect_exit_code ............................................................. 558
-warnings_are_errors ....................................................................... 558
-width_babiv .................................................................................... 559
Adaptive API code generation ................................................................. 561
Introduction to the Adaptive API code generation .............. 561Briefly about Adaptive API code generation ................................... 561
File structure for Adaptive API code ............................................... 562
Adaptive API table-based code with C++ ........................................ 563
Adaptive API readable code ............................................................ 563
Using the Adaptive API ..................................................................... 564Getting started generating code for the Adaptive API ..................... 564
Generating code for an API ............................................................. 564
Setting up the file structure for Adaptive API ................................. 566
Using the API ................................................................................... 566
Using the Adaptive API for table-based code and C++ ................... 574
Converting table-based C applications to C++ code ........................ 575
Uniform API code generation .................................................................. 577
Introduction to the Uniform API code generation ............... 577Briefly about Uniform API code generation .................................... 577
AFE1_AFE2-1:1
25
26
Uniform API code ............................................................................ 578
Using the Uniform API ...................................................................... 579Getting started generating code for the Uniform API ...................... 580
Setting up the file structure for the Uniform API ............................ 580
Adaptive API reference information .................................................... 581
Coder-generated source files for the Adaptive API .............. 581Coder-generated files for Adaptive API code .................................. 581
Summary of the Adaptive API functions ................................... 582Descriptions of the Adaptive API functions .............................. 584
SEM_Expl ........................................................................................ 584
SEM_ExplAbs ................................................................................. 585
SEM_ForceState .............................................................................. 586
SEM_GetInput ................................................................................. 587
SEM_GetInputAll ............................................................................ 589
SEM_Init .......................................................................................... 591
SEM_InitAll ..................................................................................... 591
SEM_InitExternalVariables ............................................................. 592
SEM_InitInstances ........................................................................... 593
SEM_InitInternalVariables .............................................................. 594
SEM_InitSignalQueue ..................................................................... 595
SEM_Inquiry .................................................................................... 595
SEM_Machine ................................................................................. 596
SEM_Name ...................................................................................... 598
SEM_NameAbs ............................................................................... 599
SEM_SetInstance ............................................................................. 600
SEM_SignalQueueInfo .................................................................... 600
SEM_State ....................................................................................... 601
SEM_StateAll .................................................................................. 602
VSDeduct ......................................................................................... 604
VSDeductInstance ............................................................................ 605
VSElementExpl ................................................................................ 607
VSElementName .............................................................................. 608
VSForceState ................................................................................... 609
AFE1_AFE2-1:1
IAR Visual StateUser Guide
Contents
VSForceStateInstance ...................................................................... 610
SystemVSGetCurrentStateTree ........................................................ 611SystemVSGetMaxCurrentStateTree ................................................. 612VSInitAll .......................................................................................... 612
VSInitExternalVariables .................................................................. 613
VSInitInternalVariables ................................................................... 613
VSInquiry ......................................................................................... 614
VSInquiryInstance ........................................................................... 616
VSMachine ....................................................................................... 617
VSState ............................................................................................. 619
VSStateInstance ............................................................................... 619
VSStateAll ....................................................................................... 620
VSStateAllInstance .......................................................................... 621
Adaptive API return codes ............................................................... 623SES_ACTIVE .................................................................................. 623
SES_BUFFER_OVERFLOW ......................................................... 623
SES_CONTRADICTION ................................................................ 624
SES_EMPTY ................................................................................... 624
SES_FOUND ................................................................................... 624
SES_NOT_INITIALIZED ............................................................... 624
SES_OKAY ..................................................................................... 624
SES_RANGE_ERR ......................................................................... 625
SES_SIGNAL_QUEUE_FULL ....................................................... 625
SES_TEXT_TOO_LONG ............................................................... 625
SES_TYPE_ERR ............................................................................. 625
Uniform API reference information ..................................................... 627
Uniform API source files ................................................................... 627Coder-generated source files for the Uniform API .......................... 627
Summary of the Uniform API functions .................................... 628Descriptions of the Uniform API functions ............................... 630
SystemSEM_InitExternalVariables .................................................. 630SystemSEM_InitInternalVariables ................................................... 630ProjectSEM_InitPrjExternalVariables ............................................. 631
AFE1_AFE2-1:1
27
28
SMP_Action ..................................................................................... 632
SMP_Connect .................................................................................. 632
SMP_Expl ........................................................................................ 634
SMP_ExplAbs .................................................................................. 635
SMP_ForceState ............................................................................... 636
SMP_Free ......................................................................................... 637
SMP_GetInput ................................................................................. 638
SMP_GetInputAll ............................................................................ 640
SMP_GetOutput ............................................................................... 642
SMP_Init .......................................................................................... 642
SystemSMP_InitAll .......................................................................... 643SMP_InitGuardCallBack ................................................................. 644
SMP_InitInstances ........................................................................... 644
SMP_InitSignalQueue ..................................................................... 646
SMP_Inquiry .................................................................................... 647
SMP_Machine .................................................................................. 648
SMP_Name ...................................................................................... 649
SMP_NameAbs ................................................................................ 650
SMP_NextState ................................................................................ 652
SMP_NextStateChg ......................................................................... 652
SMP_SetInstance ............................................................................. 652
SMP_State ........................................................................................ 652
SMP_StateAll ................................................................................... 654
SystemVSDeduct .............................................................................. 655SystemVSElementExpl ..................................................................... 657SystemVSElementName ................................................................... 658SystemVSGetCurrentStateTree ........................................................ 659SystemVSGetMaxCurrentStateTree ................................................. 659VSGetSignature ............................................................................... 660
SystemVSInitAll ............................................................................... 660Uniform API return codes ................................................................ 661
SES_ACTIVE .................................................................................. 661
SES_BUFFER_OVERFLOW ......................................................... 661
SES_CONTRADICTION ................................................................ 661
AFE1_AFE2-1:1
IAR Visual StateUser Guide
Contents
SES_EMPTY ................................................................................... 662
SES_FORMAT_ERR ...................................................................... 662
SES_FOUND ................................................................................... 662
SES_MEM_ERR ............................................................................. 662
SES_NULL_PTR ............................................................................. 663
SES_OKAY ..................................................................................... 663
SES_RANGE_ERR ......................................................................... 663
SES_SIGNAL_QUEUE_FULL ....................................................... 663
SES_TEXT_TOO_LONG ............................................................... 664
SES_TYPE_ERR ............................................................................. 664
The Visual State Classic Coder ............................................................... 665
Introduction to the Visual State Classic Coder ...................... 665Briefly about the Visual State Classic Coder ................................... 665
Graphical environment for the Classic Coder ......................... 665Classic Coder Options dialog box .................................................... 666
Classic Coder Options dialog box: Configuration ........................... 667
Classic Coder Options dialog box: File Output ............................... 669
Classic Coder Options dialog box: Code ......................................... 670
Classic Coder Options dialog box: Style ......................................... 674
Classic Coder Options dialog box: Extended Keywords ................. 675
Classic Coder Options dialog box: Names ...................................... 677
Classic Coder Options dialog box: API Functions .......................... 681
Classic Coder Options dialog box: C++ .......................................... 682
Classic Coder Options dialog box: Readable Code ......................... 683
Classic Coder Options dialog box: C-SPYLink ............................... 684
Classic Coder Options dialog box: RealLink ................................... 686
Classic Coder Options dialog box: Types ........................................ 687
Classic Coder Options dialog box: MISRA ..................................... 688
SEM type identifiers ............................................................................. 690Transition rule data format ............................................................. 690
AFE1_AFE2-1:1
29
30
Classic Coder command line options .................................................. 693
Introduction to invoking the Classic Coder using command line options .............................................................................................. 693
Briefly about invoking the Classic Coder ....................................... 693
Invocation syntax for the Classic Coder .......................................... 694
Summary of Classic Coder options .............................................. 695Descriptions of Classic Coder options ......................................... 700
-apiprefix .......................................................................................... 700
-api_type ........................................................................................... 701
-armsemihostingbreakpoint .............................................................. 701
-autoentryfunction ............................................................................ 702
-autoexitfunction .............................................................................. 702
-classname ........................................................................................ 703
-constactionfpt .................................................................................. 703
-constcml .......................................................................................... 704
-constguardfpt .................................................................................. 704
-cpp ................................................................................................... 705
-cppsourcefileext .............................................................................. 705
-csourcefileext .................................................................................. 705
-cspylink ........................................................................................... 706
-D ..................................................................................................... 706
-dlibbreakpoint ................................................................................. 707
-dw ................................................................................................... 708
-fullinstrumentation .......................................................................... 708
-funcexph ......................................................................................... 709
-gds ................................................................................................... 709
-generatetimeandversion .................................................................. 710
-H ..................................................................................................... 710
-iev ................................................................................................... 711
-iiv .................................................................................................... 711
-include_excluded ............................................................................ 711
-keywordheaderfile .......................................................................... 712
-kw_actionexpr ................................................................................. 712
AFE1_AFE2-1:1
IAR Visual StateUser Guide
Contents
-kw_context ...................................................................................... 713
-kw_corelogic ................................................................................... 713
-kw_dbdata ....................................................................................... 713
-kw_guardexpr ................................................................................. 714
-kw_intvar ........................................................................................ 714
-kw_prj_extvar ................................................................................. 714
-kw_rlcd ........................................................................................... 715
-kw_rld ............................................................................................. 715
-kw_rlec ........................................................................................... 716
-kw_rlpd ........................................................................................... 716
-kw_runtimeinfo ............................................................................... 717
-kw_sys_extvar ................................................................................ 717
-namespace ....................................................................................... 717
-no_warnings .................................................................................... 718
-oa ..................................................................................................... 718
-og .................................................................................................... 719
-omitcontradictiontests ..................................................................... 719
-osm .................................................................................................. 720
-path ................................................................................................. 720
-projectheader ................................................................................... 721
-projectnamespace ............................................................................ 721
-projectsource ................................................................................... 721
-R ...................................................................................................... 722
-rdfm ................................................................................................. 722
-readable ........................................................................................... 723
-reallink ............................................................................................ 724
-recordingbuffersize ......................................................................... 724
-removevsnofmacros ........................................................................ 725
-S ...................................................................................................... 725
-samplingbuffersize .......................................................................... 725
-semfunc ........................................................................................... 726-sne ................................................................................................... 727
-snm .................................................................................................. 727
-sns ................................................................................................... 728
AFE1_AFE2-1:1
31
32
-spath ................................................................................................ 728
-splitreadable .................................................................................... 729
-suppress_cspylink_common_files .................................................. 729
-sysrdfm ........................................................................................... 730
-targetbreakpoints ............................................................................. 731