The "non distributed" execution, where the Cmicro Kernel and the Cmicro Tester are executed together on a development system, is not contained per default in this current version.
The both configurations are differentiated from one another, throughout this chapter, by the terms "distributed" and "non distributed".
If the possibilities of the executable sdtmt do not meet the users requirements it is possible to reimplement functions. Therefore, it is possible to subscribe to the host library. The following picture explains the various options available for Cmicro Tester configuration:
Figure 585 : Cmicro Tester configuration possibilities ----- (fig) -----The target library is mandatory, when the Cmicro Tester is ordered. By using the open interface, it is possible to connect user specific tools to the Cmicro Testers target library. The Cmicro Tester target library must be used together with the Cmicro Library on the target.
Figure 586 : Functionality of the Cmicro Tester ----- (fig) -----The following components, as seen from the users' point of view, represent the Cmicro Tester:
The Cmicro Recorder is introduced following the subsection "Reproduction of Errors - the Cmicro Recorder" on page 2984.
The command and debug interface is introduced in the subsection "Commands for the Host and Debugging Facilities" on page 2986.
The following subsections give an overview of how to use the Cmicro Tester. A detailed description of the necessary preparations and adaptations will be given in the sections:
------------------------------------------------------------------- State The SDL nextstate operation Input The SDL input operation Save The SDL save operation Output The SDL output operation Create The SDL create operation Stop The SDL stop operation Static Create Used at system start, appears for each statically created process Dynamic Create Used at start of a dynamically created process Decision Trace of SDL action decision Task Trace of SDL action task Procedure Trace of SDL procedure call Set Trace of SDL action: Set timer Reset Trace of SDL action: Reset timer Signalparams Used to switch on/off trace of signal parameters Implicit con Trace of SDL implicit transition sumption Discard Trace of SDL discard -------------------------------------------------------------------For each symbol in each process in the system the trace can be separately switched on or off.
Please consult the subsection "The API on Target" on page 3052 for information about how to set the different options.
------------------------------------------------------------- Schedule Used to trace scheduling events. Error Used to trace System errors, which are detected either within the generated code, within the Cmi cro Kernel, or within the Cmicro Tester. Showprio Used to trace the event, when the scheduling changes to a higher, or a lower priority level. -------------------------------------------------------------Each system event can be separately switched on or off.
Please consult the subsection "The API on Target" on page 3052 for information about how to set the different options.
The second possibility doesn't need that much processor power on the host side. In practice, this method is more useful.
The method to store information about an SDL execution, which gives the best real-time properties, is of course the one with the Cmicro Recorder. In comparison to the trace, the Cmicro Recorder stores only a reduced subset of information, in a compact format.
The amount of information transferred via the communications link and stored into a file on the hard disk is kept small and compact, so that the realtime properties are not influenced. Only information is stored, which is necessary in order to replay an SDL session later. It is the communication of the environment to the SDL system, and the expiry of timers, which is recorded.
--------------------------------------------------------------------- Caution! The realtime properties, and in that way the behavior of the SDL system may be affected when recording. You have to ensure, that there is enough time to process the functions of the Cmicro Record er, and to transfer all the information via the communications link. In general, it is a good idea to use a high performance communica tions link with a large transmit buffer and a host machine, which is able to handle all recorded events at any time during the SDL exe cution. Please see the different self explanatory error messages in order to receive information about what happens in possible error cases. ---------------------------------------------------------------------It is not possible to receive information about the inner events of the recorded SDL system, by using the recorder only. The purpose of the Cmicro Recorder has nothing to do with the purpose of the Cmicro Tracer. You have to use the Cmicro Tracer additionally if you want to get information about inner events. Additional information is then transmitted via the communications link and stored into the file, which can be displayed dynamically or later when reading the file. It turned out to be difficult to get a realtime trace regarding the performance of the communications link. The more information traced via the link, the higher the performance should be.
The record mode must be switched on within the target (by using the C function interface on target), and on the host (by using an appropriate option flag - see subsection "Invoking sdtmt from the Command Line" on page 2993).
When the end of file is reached and indicated with <Play mode off> to the target, the SDL system is able to react on ordinary environment signals coming from the real environment (if programmed by the user).
The play mode must be switched on within the target (by using the C function interface on target), and on the host (by using an appropriate option flag - see subsection "Invoking sdtmt from the Command Line" on page 2993). No environment signals may be handled by the user in the C function xInEnv during the play.
In this case, it is not necessary to do a file compare. In other cases, it might be of interest to do a file compare as described later.
The procedure to do this is:
For instance, after an SDL interpretation error occurred, it is possible to suspend the SDL system and to inspect the global state by viewing the process queues. The Cmicro Library uses - per default - a fixed upper limit of entries in the SDL queue. A peak hold can be asked for on host side. That allows it to dimension the queue. The correct processing of timers can be checked by a few commands.
The ability to set breakpoints during realtime execution and to execute a single step also helps to find an error situation.
The amount of trace information can dynamically be defined via commands. A differentiation is made between the information on the communications link and the information displayed.
sdtmt is the tool, which allows to communication with the target via a communications interface, to read/write files, display information on the screen and/or the MSC-editor. It allows trace of SDL and system events, to record events and to replay them later in order to reproduce error situations.
sdtmt features:
The user interface of sdtmt is described in the subsections of the manual.
The following exceptions force a rebuild of sdtmt:
Figure 587 : sdtmt used for target control ----- (fig) -----Another way to use sdtmt is to use it as a pure conversion tool. That is of interest, if a binary file has been written during earlier sessions with the target. The following picture explains sdtmt as a conversion tool:
Figure 588 : sdtmt used for file conversion ----- (fig) -----Furthermore, if the user implements it in the host library, sdtmt can be used to simulate the SDL environment. However, no SDL environment is delivered with the Cmicro Tester, except utility functions to encode and decode messages sent via the data link.
sdtmt.opt.The default communications link of sdtmt
There is a V.24 interface implemented to transfer data between target and sdtmt.
------------------------------------------------------------------ Note: C functions used both on host and on target side ease the implemen tation of another device type. ------------------------------------------------------------------
V24_DEVICE /dev/<ttydevicename>Please ask your UNIX system administrator for the appropriate <ttydevicename> and its installation. It might be ttya or ttyb.
Then select the appropriate baud rate by specifying
BAUDRATE 19200in the file sdtmt.opt. 19200 Baud is the default baud rate.
V24_DEVICE com1or
V24_DEVICE com2Please select the appropriate baud rate by specifying:
BAUDRATE 19200
in the file sdtmt.opt. 19200 Baud is the default baudrate.
Example 362 : sdtmt.opt SIZEOF_CHAR 1 xPID 2 /* 1 for char, 2 for 2oct-int*/ xmk_T_STATE 1 xmk_T_SIGNAL 1 xmk_T_PRIO 1 xmk_T_TIME 4 /* if long value */ xmk_T_MESS_LENGTH 1 /* coding of message length */ XSTARTUP 255 /* internal kernel values */ XDORMANT 252 XDASHSTATE 254 XCREATION 250 V24_DEVICE /dev/ttya /* V24 for UNIX */ BAUDRATE 19200 /* Baudrate for V.24 */
The environment variable SDTMT_DIR refers to the directory, where sdtmt assumes to find the following files:
setenv SDTMT_DIR ./Under UNIX sh, you can specify for example:
SDTMT_DIR=./Under MS-DOS or MS-Windows, you can specify as an example:
set SDTMT_DIR .\In that case sdtmt assumes the above files are located under the directory where sdtmt has been started from.
If no environment variable was specified, then the tool reacts with the following message
Unable to find environment in SDTMT_DIRafter its invocation.
Also, an environment should be set for sdtmt, as described in the previous subsection.
sdtmt -Idqo <outfile>.Combinations of options are allowed, of course. A list of forbidden and allowed combinations is given in the subsection "List of Possible Options" on page 2999.
sdtmt -dThat will be enough to route the traces, which are generated within the target to the screen. To write the trace to a binary file enter:
sdtmt -do <outfile>
------------------------------------------------------------------ Note: sdtmt must be exited (for instance, by typing CTRL-Q or CTRL-D in any case), before a new mode can be entered. ------------------------------------------------------------------Beginning with a record session the target system is to be reset (assuming it is compiled and linked appropriately with the Cmicro Recorder facility, and that the target is configured to the record mode). The host command could look like:
sdtmt -dro <outfile>The -r stands for record.
If the information received suffices (following the trace on the screen, or at external devices connected to the target, if it has some), the record mode can be left by, for example CTRL-D. Sdtmt will prompt with:
Leaving SDT Cmicro Tester. Bye bye.and then exit. There now exists a file named <outfile>, which contains the trace information generated by the target.
Replaying the previously recorded session the target should be reset and configured to the play mode.
The command line for sdtmt could be:
sdtmt -dpi <infile>The -p above stands for play, the -i for input file. The input file to be specified, must be the filename of <outfile> of the previous record session.
Sdtmt now begins to replay the events stored in <infile>, event by event in synchronization with the target. This means each environment signal is sent via the communications link to the SDL system, where it is put into the process input queue and worked on. When the target requests the next environment signal, sdtmt sends it. Reaching the end of the file <infile>, sdtmt displays this message using stdout (which might be scrolled through very fast when a trace is running):
No more recorded events. Type CTRL-D after all remaining traces have been received.The play mode is now left in the target and the user has to decide what to do.
It should be possible from now on to use the real environment again, which is connected to the target on hardware level (of course, functions have to be provided and initialized like ISR drivers). Further traces can be seen on host side when environment signals are sent to the SDL system using the real environment.
Possibly, the target shows the erroneous situation, which the user wanted to examine. From now on, traces can be inspected which have been created on the hard disk, or a hardware debugger can be used to inspect illegal behavior. This process of replaying the session repeatable as often as the user wants to. In this way erroneous system behavior is reproducible up to solving the problem.
Furthermore, the recorded file may be compared with a replayed one in order to validate correct system behavior in different sessions, specifying:
sdtmt -dpi <infile> -o<outfile>After having two files, for instance record.dat and play.dat, they may be routed to a simple UNIX script, or to any tool which allows a comparison between two files. The following sequence of commands give an example:
Example 363 sdtmt -i record.dat -s <symbolfile> > record.asc sdtmt -i play.dat -s <symbolfile> > play.asc sdiff record.asc play.asc | pgOf course, all UNIX or MS-DOS commands can be used to process the output files record.asc and play.asc.
sdtmt -dpRi <infile> -o <outfile>lets sdtmt replay the SDL environment events at the same absolute time values, as they occurred during the record session.
To do this, a time stamp is stored for each environment signal, which is compared within the target with the current value of SDL now. SDL now-and the time stamps in the signals are calculated with time value zero from target reset on.
The processing power of host and target together must be large enough to handle that. As a rule of thumb, the recorded environment signals may not be sent to the SDL system more often than one per a few hundred microseconds. This too depends on the communications link in use.
sdtmt -dIo <outfile>where -d and -o <outfile> are of course optional. It is now possible, to enter the commands which are listed in the section sdtmt commands below examining the system (for an error,..).
sdtmt -o <outfile>leads sdtmt to a conversion mode, where all messages which are received on the communications link, concerning the Cmicro Tester, are stored as received into the outfile.
--------------------------------------------------------------------- Caution! The specified file will be overwritten, if it already exists. No warn ing message will be displayed. ---------------------------------------------------------------------The trace session can be left by typing CTRL-D. The outfile will be closed and can later be viewed as documented in the next subsection.
sdtmt -i <infile>If infile contains more than one page information, the output of sdtmt should be made page by page. To do this and to display information using the outfile the user can enter:
sdtmt -s <symbolfile> -i <infile> | pgif pg exists on the machine in use. Another possible type of pager is more:
sdtmt -s <symbolfile> -i <infile> | moreor, storing that information in a file:
sdtmt -s <symbolfile> -i <infile> > <asciifile>
sdtmt -s <symbolfile> -m <diagramname>where diagram name is any name. This name will be displayed on top of each MSC editor page.
Per default, sdtmt together with the MSC editor creates non Z.120 standard traces. These traces can be used to find out errors and to get more information about the inner behavior of SDL processes.
It is - as described subsequently - possible to generate an MSC diagram during the SDL execution, and later, after the trace information has been stored in a specified file.
sdtmt -s <symbolfile> -m <diagramname>it produces a non Z.120 standard trace. An MSC editor will be activated on condition that at least the SDT postmaster is up and running. The internal actions executed in SDL processes (Task, Decision and Procedure call), are displayed as MSC actions within the diagram. If there is any error detected in the system, it will be displayed as an MSC action statement on another instance axes, named "Kernel" on the right side of the diagram.
By specifying the -Z 120 flag, the MSC trace created is conform to the Z.120 standard:
sdtmt -s <symbolfile> -m <diagramname> -Z 120In exceptional cases, when an error occurs, the kernel instance axes mentioned above is displayed with an appropriate error message.
sdtmt -s <symbolfile> -m <diagramname>
sdtmt -s <symbolfile> -i <filename -m diagramname
As a general recommendation a symbol file should always be specified. The symbol file is automatically generated by the Cmicro Generator. Thus, the user just has to add the symbol file whenever invoking sdtmt:
...... -s symbolfile ......----------------------------------------------------------------------- Caution! Since the symbol file is updated whenever code generation takes place, it is important to use the most recent version of this file. Oth erwise, the interpretation of binary data and therefore the results of the trace will be wrong! -----------------------------------------------------------------------
------------------------------------------------------------------- Option Meaning ------------------------------------------------------------------- -h Get a detailed help -I Use the interactive mode with command inter preter / debug interface -i inputfile Specify file to read from -o outputfile Specify file to write into -s file Specify file containing symbols to read. If a symbol file is neither specified nor can be found, no display of symbolic information is possible. -d Route traces also to screen -m diagramname Trace on MSC editor. The diagram name will be shown within the MSC editor and is used as a filename to store MSC informations, too. -z 120 The trace on the MSC editor is be conform to Z.120. -P Do not show signal parameters on screen / on MSC editor. -S Single step for each event -D nnn Delay each environment signal for nnn seconds when replaying with Cmicro Recorder -q Do work quiet -r Record an SDL session into <outfile> -p Replay a previously recorded SDL session from the file specified with -i <infile> -R Realtime simulation for Cmicro Recorders play mode. -------------------------------------------------------------------Examples for Cmicro Tracer
------------------------------------------------------------------------- sdtmt invocation Meaning ------------------------------------------------------------------------- sdtmt -h Detailed usage sdtmt -d V.24 -> Screen sdtmt -m name V.24 -> MSC Editor sdtmt -o <outfile> V.24 -> File sdtmt -o <outfile> -d V.24 -> File and screen sdtmt -o <outfile> -m name V.24 -> File and MSC editor sdtmt -o <outfile> -d -m V.24. -> File, Screen and MSC editor name sdtmt -i <infile> File -> Screen sdtmt -i <infile> -m name File -> MSC editor sdtmt -di <infile> -m name File -> Screen and MSC editor -------------------------------------------------------------------------Examples for Cmicro Recorder
------------------------------------------------------------------------- sdtmt invocation Meaning ------------------------------------------------------------------------- sdtmt -ro <outfile> record a session into <outfile> sdtmt -pi <infile> replay a session from <infile> -------------------------------------------------------------------------Exceptions in the use of options
---------------------------------------------------------------- Combination Exception ---------------------------------------------------------------- -r and -p These options must not be specified together. -R and -D These options must not be specified together. -d and -m These options write to slow devices. This affects the realtime properties of the communications interface and therefore the target under test. The faster mechanism is to write into a file, and to display it later. ----------------------------------------------------------------
Not using the Cmicro Recorder, the command line will appear like:
0/Enter Command>The number in front of the "/" character represents a current counter, which counts the traces of all SDL or system events received by sdtmt. That is useful when writing into a file only to keep the realtime properties. Whenever CR is entered the counter value is updated to enable the user to observe the trace in progress.
Using the Cmicro Recorder, the command line will appear like:
Figure 589 : Prompt at command line ----- (fig) -----The first number in front of the "/" character again represents the current trace counter value.
The second number between the two "/" characters represents the recorder counter value used for the Cmicro Recorder.
If sdtmt is in record mode the recorder counter value represents the amount of signals which have been recorded at the environment to SDL interface. In this case, the counter value is updated continuously by the target.
If sdtmt is in play mode, then the recorder counter value represents the amount of signals at the environment to SDL interface, which have already been read and sent to the target. In this case, the counter value is updated by sdtmt.
The use of these counters is obvious: The amount of recorded signals during record can be compared with the amount of replayed signals during replay.
---------------------------------------------------------- ---------------------------------------------------------- CTRL-D Unconditionally exit sdtmt. The opened files will be closed and the communications link will be disabled correctly. CTRL-Q Same as CTRL-D CTRL-C This is the hard form of ending sdtmt, which is detected in more cases than the other exit com mands. The signal is caught and the same actions as with CTRL-D apply. EXIT This is the exit command of the interactive mode of sdtmt. QUIT Same as exit command ----------------------------------------------------------One possibility to use sdtmt is to start it with the built in command interpreter by using the option switch -I. sdtmt will enter the interactive mode. The commands listed are available in interactive mode only.
The serial communications interface may be implemented faulty on target side. Some commands are implemented to help in debugging this. Please consult the subsection concerning the communications link, which can be found later, in order to get the details.
Consider, as an example, the command ?breaklist. The command may be entered as ?b. However, if only ? is typed, sdtmt will respond with the error message
Command was ambigoussince the command cannot be distinguished from, for example the ?queue command.
Each parameter is mandatory from a syntactical point of view and must be specified. No parameters may be left out.
If the parameter list following a command name is not complete, sdtmt responds with the error message
**ERR:Missing parameters at end of command.Specifying more parameters than the command can handle, sdtmt prompts
**ERR:Extra parameters specified in command.If the type of any parameter, which was entered, doesn't match the expected one, then sdtmt responds with an appropriate error message according to the expected type. Type
help commandnameor see the manual again.
":"
This is the separator for process type and instance, and it must be specified, where an instance number must be given.
----------------------------------------------------------------------- Note: There is a difference between the notation in the simulator and in the Cmicro Tester concerning instance numbering. The simulator al ways uses the value one as the first instance number whereas the Cmicro Tester begins numbering these at zero! -----------------------------------------------------------------------
-------------------------------------------------------------------- Caution! If no symbol file was specified, then neither process type nor In stance is checked within sdtmt! If the target is compiled without er ror checks, that might lead to an fatal error in the target system. --------------------------------------------------------------------
Enter Command>helpA complete list of commands will be displayed on the screen. Commands, which are available in the current mode of sdtmt, are marked with an asterisk. Entering a command, which is not available in the current context sdtmt responds with:
Sorry. The current mode of sdtmt doesn't allow you to enter that command. The command has been ignored.To get a short explanation, type:
Enter Command>help <commandname>for instance type:
help helpTo get a complete list of commands, type:
Enter Command>help *
------------------------------------------------------------- Command Exit / Ex Parameters (None) Type Local Description The session will be terminated normally and sdtmt will be exited. All opened files will be closed. The communications interface is dis abled. It is the same command as Quit. -------------------------------------------------------------
-------------------------------------------------------------- Command Help / He Parameters [<commandname>,*] Type Local Description A complete list of commands will be displayed on the screen. Commands available in the cur rent mode of sdtmt are marked with an asterisk. --------------------------------------------------------------
Example 364 :Entering the name of a command not being available in the current context sdtmt responds with
Sorry. The current mode of sdtmt doesn't allow you to enter that command. The command has been ignored. Example 365Type
Enter Command>help <commandname> ,to get a short explanation of one or several commands, e.g.
help helpwhich is the same as
he he Example 366A list of all commands beginning with b can be requested by typing:
help bA complete list of commands can be requested by typing:
help *After getting the prompt, enter:------------------------------------------------------------- Command History / Hi Parameters (None) Type Local Description Print out a command history and allow to reuse commands given earlier by entering !number or !!. The command history behaves like the UNIX c- shell. ------------------------------------------------------------------------------------------------------------------------- Command ! Parameters <command-number> Type Local Description By entering this command, you can reuse a pre vious command which you typed in. First get a history with the History command. ----------------------------------------------------------------------------------------------------------------------- Command !! Parameters (None) Type Local Description The last command in the command history will be reused. -------------------------------------------------------------------------------------------------------------------- Command Quit / Q Parameters (None) Type Local Description This is the same command as EXIT, but with another name only. -------------------------------------------------------------------------------------------------------------------------- Command Any UNIX-command / MSDOS-command Parameters As defined for UNIX / MSDOS-command Type Local Description Any command sdtmt cannot recognize, will be taken as a system call and routed to the operating system (UNIX / MS-DOS). -----------------------------------------------------------------Example 367
Enter command>ls -lsa (for UNIX)or
Enter command>dir (for MS-DOS)That will work just like calling the command directly from the OS shell. The command is useful in order to perform an ls or dir, to see, whether the output files are really written by sdtmt or not.
Please consider, that during the time, the OS command is executed, sdtmt is not active. If traces are to be received from the target, they may fail.
-------------------------------------------------------------------- Caution! Do not enter silly commands here, for instance, do not call sdtmt re cursively. That will cause improper operation! --------------------------------------------------------------------
---------------------------------------------------------------- Command ?Tracebuffer / ?Tr Parameters (None) Type Remote Description The target trace buffer can be asked for and will be displayed by this command. ----------------------------------------------------------------
------------------------------------------ Note: This command is currently not implemented. ------------------------------------------
---------------------------------------------------------- Command Tr-Detail / Tr-D Parameters level, where 0 <= level <= N. Type Local Description Define Trace detail. The command is applied locally within sdtmt and it works on stdout traces only. ----------------------------------------------------------Both, output to a file and output to the MSC editor will not be affected by this command, thus, if the target is configured correctly, no inconsistency can occur, and no information stored in a file or on the MSC editor is incomplete.
We defined 5 levels. The higher the level, the more SDL events are traced. The different events are assigned to levels as depicted in the following table:
--------------------------------------------- Trace subject L.1 L.2 L.3 L.4 L.5 --------------------------------------------- PRINT STRING * * * * * TASK - - - - * DECISION - - - - * PROCEDURE - - - - * SET - - - * * RESET - - - * * ACTUAL RESET - - - - - STOP - - - * * STATE - * * * * STATIC CREATE - - - * * DYNAMIC CREATE - - - * * CREATE - - - * * SAVE * * * * * TIMER * * * * * INPUT * * * * * OUTPUT - - * * * DISCARD * * * * * IMPLICIT CONSUMPTION * * * * * ---------------------------------------------
---------------------------------------------------------------- Command Tr-off Parameters (None) Type Remote Description The command switches the Cmicro Tracer off within the target. The current option settings stored in the target will not be affected. After this command is received within the target, the trace immediately is suspended and can only be resumed with the command Tr-on. The output trace, that has been written, is interrupted. Consider misinterpretation of the trace because of missing traces after resuming the trace via Tr- on. ----------------------------------------------------------------
----------------------------------------------------------------- Command Tr-on Parameters (None) Type Remote Description This command switches the Cmicro Tracer on, if it is compiled within the target. All the current option settings concerning trace within the target will not be affected. -----------------------------------------------------------------
------------------------------------------------------------------- Command Tr-Process / Tr-Pr Parameters <Process name> <Bitmask>or ENV <Bitmask> or * <Bitmask> Type Remote Description This command defines the trace for one or all processes in the system. It is applied in the target (remote command), so that the traffic load on the communications interface can be reduced inter actively. This trace command works for all instances of the given process type. No differentiation is pos sible between different instances of one type. -------------------------------------------------------------------
----------------------------------------------------------------- Command Tr-Signal / Tr-S Parameters <Signal name> <flag> or * <flag> Type Remote Description This command defines the trace for one or all signals in the system. It is applied in the target (remote command), so that the communications interface's traffic load can be reduced interac tively. The signal name is the one from the SDL sys tem. No qualifiers are possible, which means, that signal names have to be unique for the whole SDL system. The flag may be 0 (trace off) or any other value (trace on). If an asterisk is specified for signal name, then flag is applied to all signal types. The command works for SDL output only. -----------------------------------------------------------------
----------------------------------------------------------------- Command Rec-off Parameters (None) Type Remote Description Switches the Cmicro Recorder off. This com mand may be specified any time during a record ing session. It can be used in order to reduce the amount of information sent via the communica tions interface. -----------------------------------------------------------------
--------------------------------------------------------------- Command Rec-on Parameters (None) Type Remote Description Switch Cmicro Recorder to record mode. It is not a good idea to enter that command, when the SDL system is currently processing transitions, and is not idle. Furthermore, the question is, whether it makes sense to start a record session in the middle of an SDL execution or from the startup of the SDL system. ---------------------------------------------------------------
--------------------------------------------------------------- Command Rec-play Parameters (None) Type Remote Description The Cmicro Recorder's play mode will be set. This command can be entered in a few states of the Cmicro Kernel only. A negative confirmation is displayed if necessary. The same explanations as for Rec-on apply. ---------------------------------------------------------------
--------------------------------------------------------------------- Command Continue / Co Parameters (None) Type Remote Description This command can be used to continue process ing, i.e. after a breakpoint was hit, or if the single step mode is active. A negative confirmation is printed out, when the command cannot be pro cessed within the target system. ---------------------------------------------------------------------
------------------------------------------------------------------ Command Next-Step / Next-St Parameters (None) Type Remote Description This command performs one step, if single step is active, or if a breakpoint was encountered. The Single-Step command must be given previ ously, if neither single step is active, nor a break point was hit. ------------------------------------------------------------------
--------------------------------------------------------------- Command Shutdown / Sh Parameters (None) Type Remote Description The command tries to shutdown the system, which means normally to exit the main program. The user can define the actions on exit within the target. The same explanations as for the rein itialization command apply. ---------------------------------------------------------------
------------------------------------------------------------- Command Single-Step / Si Parameters (None) Type Remote Description This command switches the single step mode on. Either Next-Step or Continue may follow. -------------------------------------------------------------
------------------------------------------------------------------ Note: Timers are checked normally during single step and may expire, as documented for the Disable-Timer and Enable-Timer commands. It might be better to disable the timers (with Disable-Timer) before going into single step. ------------------------------------------------------------------
----------------------------------------------------------------- Command Suspend Parameters (None) Type Remote Description Disable Cmicro Kernel from scheduling. The transition currently running will not be affected and will be ended first, before the command is accepted. The suspended SDL system cannot process any signals, neither internal signals, nor signals coming from the environment. This may lead to a queue overflow. It is recommended to disable the timers to prevent this. -----------------------------------------------------------------
---------------------------------------------------------------- Command ?All-Processes / ?A Parameters (None) Type Remote Description The states of all process instances in the system will be displayed on the screen. It is imple mented as a procedure, which is controlled by sdtmt. Depending on the traffic load on the com munications interface the responses may be delayed. ----------------------------------------------------------------
------------------------------------------------------------------- Caution! The results printed on screen may be inconsistent. That depends on what the SDL system is doing during the query procedure. The re sults will be correct, however, if the whole SDL system is idle. -------------------------------------------------------------------
----------------------------------------------------------------- Command ?Errors / ?E Parameters (None) Type Remote Description Query last occurred error. The target system traces the last error within the SDL execution and stores it. The result will be displayed on the screen, both as a decimal value, and as ASCII text with an explanation of the error situation. Especially, when the SDL system is executed for the first time in a new hardware environment, the command may help in finding problems. In addi tion, after a long execution of the SDL system any error situation arising may be detected. All the errors, warnings and information, which are handled by the ErrorHandler can be asked (please see the explanations in the subsection "User defined Actions for System Errors - the ErrorHandler ()" on page 2769 in chapter 45, The Cmicro Library). -----------------------------------------------------------------
----------------------------------------------------------------- Command ?Timer-Table / ?Ti Parameters (None) Type Remote Description Some characteristics of the current timer tables are displayed. The command is useful in order to inspect the state of the SDL system, or to see, if it is hanging. -----------------------------------------------------------------
Example 368After typing the command, informations are printed on screen, which may look like:
Current Timer states: SDL NOW :9147,d Timer dimensioned to :6 Currently :0 timer(s) active Timer memory location at :36bf0014,Where SDL NOW represents the amount of units since system start. The value of 6 then tells the maximum of timer instances in the system. The third is self explaining. The last gives the physical memory allocation of the timer linked lists which may easy debugging.
--------------------------------------------------------------- Command ?Process-State / ?P Parameters <Processtype:Instance> Type Remote Description The state of the given SDL process instance will be displayed in its symbolic representation for that process type. If a symbol file has been spec ified, the Processtype and Instance are both checked. ---------------------------------------------------------------
-------------------------------------------------------------- Command ?Queue / ?Q Parameters (None) Type Remote Description Some characteristics of the queue will be dis played. The command is very useful in order to dimension the queue. There is a peak hold, which tells, how many entries in the queue have been used at maximum since system start. --------------------------------------------------------------
Example 369After typing the command, informations are printed on screen, which may look like:
Current Queue state: Queue size dimensioned to:Max.20 entries Peak hold :1 entry/entries Currently :0 entry/entries in queue Queue memory location at :36a40010,xThe explanations for this is: A maximum of 20 entries in the queue can be handled by the system. Since system start, there was never more than one entry being used. Currently, no signal instance had been detected in any process input port. The last value displays the physical memory allocation of the queue, which helps in debugging.
In such situations, the possibility to set breakpoints in the target may be quite helpful. It is extremely powerful in its use in realtime target systems, because the breakpoint logic, which is implemented of course as software within the target, doesn't considerably affect the realtime properties in the target (a few statements only are necessary to check if a breakpoint is set and if it is hit).
The number of breakpoints selectable is user definable.
---------------------------------------------------------- Command BA Parameters (None) Type Remote Description This command requests to clear all the break points in the break list. ----------------------------------------------------------
---------------------------------------------------------------- Command BC Parameters <breakpoint-number> (depends on max. break points) Type Remote Description This command requests to clear the given break point number from the breakpoint list. ----------------------------------------------------------------
------------------------------------------------------------------------- Command BP Parameters <Processtype:Instance> <SignalName> <State Name> Type Remote Description This command sets a breakpoint, both on the input and the nextstate of a given process. After setting the breakpoint, try to query the break list with the command ?Breaklist. No parameter is optional. These combinations are allowed: processname:nr * statename - >Use command BPS processname:nr signalname * - >Use command BPI processname:nr * * processname:nr signalname statename -------------------------------------------------------------------------
----------------------------------------------------------------- Command BPI Parameters <Processtype:Instance> <SignalName> Type Remote Description This command sets a breakpoint on the input of a given process. No parameter is optional. These combinations are allowed: processname:nr * processname:nr signalname processname * processname signalname -----------------------------------------------------------------
--------------------------------------------------------------- Command BPS Parameters <Processtype:Instance> <StateName> Type Remote Description This command sets a breakpoint on the state of a given process. A negative confirmation is given, when the command cannot be processed within the target system. No parameter is optional. These combinations are allowed: processname:nr statename processname * processname statename processname:nr * ---------------------------------------------------------------
------------------------------------------------------------------ Command ?Breaklist / ?B Parameters (None) Type Remote Description This command requests the current breaklist from the target and displays it on the screen as it was entered. If a symbol file has been specified during the invocation of sdtmt, then process-IDs, signal-IDs and state-IDs are displayed with their symbolic value. ------------------------------------------------------------------
------------------------------------------------------------------ Command Active-Timer / Ac Parameters <Processtype:Instance> timername Type Remote Description Check, if a specific timer is set by a process, and has not been expired. ------------------------------------------------------------------
------------------------------------------------------------------ Command Create / Cr Parameters <Parent-Processtype:Parent-Processinstance> <Created-Processtype> Type Remote Description This command creates an SDL Process of the given type. The type-ID of the creating process must be specified in param 1. The instance-ID must be specified in param 2. If there is a free process instance, which is currently dormant, this one will be created and the start transition will be executed, which can be seen in the trace. If the system is under break condition, the com mand will be ignored, because it is not possible to send signals (dynamic creation uses signal mechanism) in that case. ------------------------------------------------------------------
--------------------------------------------------------------------- Note: Please specify the <Parent-Processtype:Parent-Processinstance> according to the SDL system. There is no check, if the parent is specified correctly from the semantic point of view. ---------------------------------------------------------------------
----------------------------------------------------------------- Command Disable-Timer / Dis Parameters (None) Type Remote Description This command disables the processing of timers. The command affects the SDL-timers only! However, timers which are already expired and are in the queue, will be input as normal. Keep in mind, that the disabling of timers changes the system behavior. -----------------------------------------------------------------
--------------------------------------------------------------- Command Enable-Timer / En Parameters (None) Type Remote Description This command enables the processing of timers again, when it was previously disabled with the command Disable-Timers. Due to the fact, that time cannot be stopped, it might occur that all the previously set timers may expire at the same moment. This may cause illegal system behav ior, i.e. a queue overflow and the call of the ErrorHandler or another illegal behavior. ---------------------------------------------------------------
---------------------------------------------------------------- Command Stop / St Parameters <Processtype:Instance> Type Remote Description This command stops an SDL Process according to the SDL semantics, no matter if the system is suspended or under break condition. The com mand is, after it was received, directly executed within the target. All signals, which are in the queue for this process are removed, including a possible create signal. ----------------------------------------------------------------
------------------------------------------------------------------- Command Nextstate Parameters <Processtype:Instance> <Statename> Type Remote Description This command sets the state of the given process instance to the value of <Statename>. <State name> must be one of the states which are defined for the corresponding process type in SDL. Normally, that only makes sense if the sys tem is under break condition, or is idle. -------------------------------------------------------------------
----------------------------------------------------------------- Command Reinitialize / Re Parameters (None) Type Remote Description This command tries to reinitialize the system. The reinitialization may fail, if the hardware drivers cannot be reinitialized again. Further more, all global auto variables in the C program parts of the user cannot be reinitialized. How ever, if there is a clean implementation of driver initialization and deinitialization, and initializa tion of global variables, the command will work very well. -----------------------------------------------------------------
---------------------------------------------------------------- Command Reset-All-Timers / Reset-A Parameters <Processtype:Instance> Type Remote Description This command resets all SDL timers of the given process instance. ----------------------------------------------------------------
---------------------------------------------------------------- Command Reset-Timer / Reset-T Parameters <Processtype:Instance> timername Type Remote Description This command resets a specific SDL timer of the given process instance. ----------------------------------------------------------------
------------------------------------------- Note: Timers with parameters are not implemented. -------------------------------------------
------------------------------------------------------------- Command Resume / Resu Parameters (None) Type Remote Description Resume Cmicro Kernel, after a suspend has been accepted. The same explanations as for the Sus pend command apply. -------------------------------------------------------------
--------------------------------------------------------- Command Remove-Queue Parameters (None) Type Remote Description All signal instances in the queue will be removed. The signal queue will be empty. ---------------------------------------------------------
------------------------------------------------------------ Command Remove-All-Signals / Remove-A Parameters <Processtype:Instance> Type Remote Description Remove all signals of the given receiver from the signal queue. ------------------------------------------------------------
------------------------------------------------------------- Command Remove-Signal / Remove-S Parameters <Processtype:Instance> signalname Type Remote Description Remove a specific signal of the given receiver from the queue. -------------------------------------------------------------
----------------------------------------------------------------- Command Scale-Timers / Sc Parameters <factor> Type Remote Description Scale time when setting a timer. Often there is a need to simulate time during an SDL execution. By specifying this command, it is possible to make the run of SDL timers faster or slower. The command is applied on newly set timers only. I.e. if a timer is already running, then it remains unaffected from the time scale. Due to that fact, the command should only be given at the start of the SDL system. In record mode the scaled time will be stored, this results in time being scaled in play mode. It is impossible to scale time manually in play mode! -----------------------------------------------------------------
----------------------------------------------------------------- Command Set-Timer / Se Parameters <Processtype:Instance> time value timer name Type Remote Description Set an SDL Timer for the given process instance with the given value in units. The time value is a long value, which you may specify in hex or decimal as C long value. The long value carries the same units as you specified within the SDL system, so that you have to recalculate it. -----------------------------------------------------------------
Example 370set <Processtype:Instance> 4711 < timername>
set <Processtype:Instance> 0x0815 < timername>
-------------------------------------------------------------- Command Line / Li Parameters (None) Type Local Description The command displays the line status of the communications interface. It can be used in order to see, if characters, frames, and XONs / XOFFs have been received / transmitted, and what kind of device is actually connected. --------------------------------------------------------------
------------------------------------------------------------- Command Remove-Command Parameters (None) Type Local Description For each command, which is sent to the target, sdtmt waits for an explicit acknowledgment. The last command can be removed, so that sdtmt does not wait for that acknowledgment. That can be used, when the communication is hanging for any reason, for example, when the command could not be sent to the target, or wasn't received by the target, or the acknowl edgment couldn't be received in sdtmt. -------------------------------------------------------------
------------------------------------------------------------------ Command Synchronize-Coder / Sync Parameters (None) Type Local Description The command tries to synchronize the message coder of sdtmt with the target. It might be useful, when the target is reset again or already running, when you invoke sdtmt. ------------------------------------------------------------------If the message
The decoder is out of synchronization. Try SYNC command.is displayed during an sdtmt session, then the Sync command will help sdtmt to understand the messages sent from target to host, and it will enable sdtmt to send messages to the target with the correct format.
After entering the command sdtmt searches for the file sdtmt.stt in the sdtmt directory. That file is automatically generated, if one trace has been successfully generated. The file contains information about the target, and is wanted within sdtmt in order to produce printable trace output, and to enable remote commands. If sdtmt wasn't able to find the file, then the following message will be displayed:
Unable to restore rules from file sdtmt.stt. Resynchronization is impossible.Typing a command during sdtmt not being synchronized with the target, this message will appear:
Sorry. The current mode of sdtmt doesn't allow you to enter that command. The command has been ignored.---------------------------------------------------------------------------- Caution! If you alter from one type of target to another, you must ensure, that sdtmt uses the right sdtmt.stt file. If you are not sure if it is the right one, then delete the file sdtmt.stt. Reset the target, while sdtmt is al ready running. The file will now be created with correct information contents. If you are sure, that the different targets use the same mes sage coding, then it is possible to reuse an sdtmt.stt file. ----------------------------------------------------------------------------------------------------------------------------------------- Command User-Command / Us Parameters (None) Type Local Description The command lets sdtmt alter to the user input mode. The command only makes sense, if the SDL environment, or any user environment is compiled and linked together with sdtmt. Using the delivered sdtmt executable, the command will not work. -------------------------------------------------------------
In all these situations, the possibility to set breakpoints in the target may be quite helpful.
Here are some examples:
Is any signal input in any process at any time?
BPI *:* * *Is any signal output to the environment?
No possibility, because the environment performs no input action and breakpoints only can be set on inputs. A possible work-around is to trace the input in the C function xOutEnv. Then a breakpoint can be set as usual.
Does a specific process instance (pid) receive any signal?
BPI processname:nr *Does a specific process instance (pid) receive a specific signal?
BPI processname:nr signalnameDoes any instance of a given process type receive any signal?
BPI processname *Does any instance of a given process type receive a specific signal?
BPI processname signalnameDoes a specific process instance (pid) go into any state (does it end any transition)?
BPS processname:nr *Does a specific process instance (pid) go into a specific state
(does it end any transition, which leads to that state)?
BPS processname:nr statenameDoes any instance of a given process type go into any state (does it end any transition)?
BPS processname *Does any instance of a given process type go into a specific state
(does it end any transition, which leads to that state)?
BPS processname statename
----------------------------------------------------------- Command Parameters ----------------------------------------------------------- Continue / Co None Exit / Ex None Help / He <commandname> or * for complete list History / Hi None Quit / Q None ! command line number from history !! None UNIX-command See operating system help / MSDOS-com mand -----------------------------------------------------------
-------------------------------------------------- Command Parameters -------------------------------------------------- ?Tracebuffer / ?Tr None Tr-Detail / Tr-D level Tr-off None Tr-on None Tr-Process / Tr-Pr Processtype:instance Bitmask Tr-Signal / Tr-S Signalname Flag --------------------------------------------------
--------------------- Command Parameters --------------------- Rec-off None Rec-on None Rec-play None ---------------------
----------------------------- Command Parameters ----------------------------- Next-Step / Next- None S Shutdown / Sh None Single-Step / S None Suspend None -----------------------------
--------------------------------------- Command Parameters ?All-Processes / None ?A ?Errors / ?E None ?Timer-Table / None ?Ti ?Process-State / Processtype:instance ?P ?Queue / ?Q None ---------------------------------------
------------------------------------------------------------- Command Parameters ------------------------------------------------------------- BA None BC Number of breakpoint to clear BP Processtype:instance <signalname> <state name> BPI Processtype:instance <signalname> BPS Process:instance <statename> ?Breaklist None -------------------------------------------------------------
--------------------------------------------------------------------- Command Parameters --------------------------------------------------------------------- Active-Timer / Processtype:instance <timername> Ac Create / Cr Parentprocesstype:instance childprocesstype Disable-Timer / None Dis Enable-Timer / None En Stop / St Processtype:instance Nextstate Processtype:instance <statement> Reinitialize / Re None Reset-All-Timers Processtype:instance / Reset-A Reset-Timer / Processtype:instance <timername> Reset- Resume / Resu None Remove-Queue None Remove-All- Processtype:instance Signals / Remove-A Remove-Signal / Processtype:instance <signalname> Remove-S Scale-Timers / Sc factor (100 - no scaling, <100 slower) Set-Timer / Se Processtype:instance timevalue <timername> ---------------------------------------------------------------------
--------------------------- Command Parameters --------------------------- Line / Li None Remove-Com None mand Synchronize- None Coder / Sync User-Command / None Us ---------------------------
Example 371 :The following trace was created for the Access Control example:
STATIC CREATE: process :Central_0 TASK: process :Central_0 NextFree := ... NEXTSTATE: process :Central_0 state :Idle STATIC CREATE: process :PanelController_0 OUTPUT: signal :Display prio :100 snd :PanelController_0 rec :ENVIRONMENT time :0 parameters : 00 01 .. NEXTSTATE: process :PanelController_0 state :Idle
In order to use all the options, the host library must be compiled with the right switches.
Here the application program interface (API) of sdtmt is explained. A specific subsection is dedicated to the compilation of the host library.
It is not delivered and listed for some internal reasons only.
It is not delivered and listed for some internal reasons only.
It is not delivered and listed for some internal reasons only.
It is not delivered and listed for some internal reasons only.
void xInitEnvHost ( void )This function is called by sdtmt during the initialization phase of the system. The function is to be filled up by the users.
The function is called only, if the flag
XMK_USE_SDL_ENV_ON_HOSTis set in the configuration file ml_mcf.h.
int xInEnvHost ( int MessageClass, int Messagetag, int MessageLength, char *p_info, char *p_RAWBuffer )This function is called by sdtmt, after a message has been received from the communications interface, which cannot be passed to the Cmicro Tester. The function is to be filled up by the users. The user has to define actions upon the reception of such a message.
The first 3 parameters contain the values of Message class, Messagetag and Message length from the header of the data link frame of the Cmicro Protocol.
Parameter 4 points to the first character of the data field of the message.
Parameter 5 points to the first character of the whole message, i.e. the message class.
You should use the decoding functions from ml_dec, in order to make the decoding of information independent from the system which sent the message.
The function is called only, if the flag
XMK_USE_SDL_ENV_ON_HOSTis set in the configuration file ml_mcf.h.
void xCyclic ( void )This function is called once per main loop in sdtmt. The function is to be filled up by the users. It is possible to introduce the SDL environment here, or any other kind of communications interface.
The function is called only, if the flag
XMK_USE_SDL_ENV_ON_HOSTis set in the configuration file ml_mcf.h.
void xCloseEnvHost ( void )This function is called before exiting sdtmt. The function is to be filled up by the users.
The function is called only, if the flag
XMK_USE_SDL_ENV_ON_HOSTis set in the configuration file ml_mcf.h.
int xmk_HostEncode ( int MessageClass, int Messagetag, char *p_struct , int struct_length)This is a free to use function for the host side, which encodes the given information into a data link frame of the Cmicro protocol format and sends it via the communications interface.
MessageClass may be in the range from 0 to 250,
Messagetag may be of any value.
p_struct is a pointer to a C structure which is to be transferred via the communications link.
struct_length is the result of the sizeof operator applied on this structure.
-------------------------------------------------------------- Note: The decoding of structures is not implemented in this release. --------------------------------------------------------------
int xmk_decode_uchar(char *p_RAWBuffer, int cnt, unsigned char * char_val )This is a free to use function for the host side, which decodes a character from a raw buffer into the C value according to the defined coding rules. The function returns the amount of characters to skip in the raw buffer.
int xmk_decode_schar(char *p_RAWBuffer, int cnt, char * char_val )This is a free to use function for the host side, which decodes a character from a raw buffer into the C value according to the defined coding rules. The function returns the amount of characters to skip in the raw buffer.
int xmk_decode_ushort ( char *p_RAWBuffer, int cnt, unsigned short * short_val )This is a free to use function for the host side, which decodes an integer from a raw buffer into the C value according to the defined coding rules. The function returns the amount of characters to skip in the raw buffer.
int xmk_decode_sshort ( char *p_RAWBuffer, int cnt, short * short_val )This is a free to use function for the host side, which decodes an integer from a raw buffer into the C value according to the defined coding rules. The function returns the amount of characters to skip in the raw buffer.
int xmk_decode_uint (char *p_RAWBuffer, int cnt, unsigned int * int_val )This is a free to use function for the host side, which decodes an integer from a raw buffer into the C value according to the defined coding rules. The function returns the amount of characters to skip in the raw buffer.
int xmk_decode_sint ( char *p_RAWBuffer, int cnt, int * int_val )This is a free to use function for the host side, which decodes an integer from a raw buffer into the C value according to the defined coding rules. The function returns the amount of characters to skip in the raw buffer.
int xmk_decode_ulong ( char *p_RAWBuffer, int cnt, unsigned long * long_val )This is a free to use function for the host side, which decodes a long from a raw buffer into the C value according to the defined coding rules. The function returns the amount of characters to skip in the raw buffer.
int xmk_decode_slong ( char *p_RAWBuffer, int cnt, long * long_val )This is a free to use function for the host side, which decodes a long from a raw buffer into the C value according to the defined coding rules. The function returns the amount of characters to skip in the raw buffer.
int xmk_decode_char_buffer ( unsigned char *p_RAWBuffer, int RAWBufferLength, unsigned char *p_dest, int *p_dest_length)This is a free to use function for the host side, which decodes a char array with RAWBufferLength elements from the raw buffer given in parameter 1 into the C value in parameter 3, according to the defined coding rules. Parameter 4 must specify the remaining space in the destination buffer when the function is called. After returning, parameter 4 contains the amount of elements which are decoded into the destination buffer.
The function returns the amount of characters to skip in the raw buffer.
int xmk_decode_pointer ( char *p_RAWBuffer, int cnt, long * ptr_val )The function is used for internal purposes only and should not be called by the user.
It decodes a pointer value from the raw buffer into the C value according to the defined coding rules.
Its purpose is to skip a pointer value in the raw buffer, in order to enable the decoding of the parameters following that pointer value. The result value in *ptr_val is a physical address within the memory space of the target. That pointer should never be used, except to display the address on screen.
The function returns the amount of characters to skip in the raw buffer.
-------------------------------------------------------------- Note: The encoding of structures is not implemented in this release. --------------------------------------------------------------
int xmk_encode_uchar ( unsigned char char_val, char *p_RAWBuffer, int max )This is a free to use function for the host side, which encodes a C char value into a given raw buffer according to the defined coding rules. Max is the remaining place in p_RAWBuffer and is checked. If an error occurs, the C function xHostErrorHandler will be called.
The function returns the amount of characters which are encoded into the raw buffer.
int xmk_encode_schar ( char char_val, char *p_RAWBuffer, int max )This is a free to use function for the host side, which encodes a C char value into a given raw buffer according to the defined coding rules. Max is the remaining place in p_RAWBuffer and is checked. If an error occurs, the C function xHostErrorHandler will be called.
The function returns the amount of characters which are encoded into the raw buffer.
int xmk_encode_ushort ( unsigned short short_val, char *p_RAWBuffer, int max )This is a free to use function for the host side, which encodes a C short value into a given raw buffer according to the defined coding rules. Max is the remaining place in p_RAWBuffer and is checked. If an error occurs, the C function xHostErrorHandler will be called.
The function returns the amount of characters which are encoded into the raw buffer.
int xmk_encode_sshort ( short short_val, char *p_RAWBuffer, int max )This is a free to use function for the host side, which encodes a C short value into a given raw buffer according to the defined coding rules. Max is the remaining place in p_RAWBuffer and is checked. If an error occurs, the C function xHostErrorHandler will be called.
The function returns the amount of characters which are encoded into the raw buffer.
int xmk_encode_uint ( unsigned int int_val, char *p_RAWBuffer, int max )This is a free to use function for the host side, which encodes a C int value into a given raw buffer according to the defined coding rules. Max is the remaining place in p_RAWBuffer and is checked. If an error occurs, the C function xHostErrorHandler will be called.
The function returns the amount of characters which are encoded into the raw buffer.
int xmk_encode_sint ( int int_val, char *p_RAWBuffer, int max )This is a free to use function for the host side, which encodes a C int value into a given raw buffer according to the defined coding rules. Max is the remaining place in p_RAWBuffer and is checked. If an error occurs, the C function xHostErrorHandler will be called.
The function returns the amount of characters which are encoded into the raw buffer.
int xmk_encode_ulong (unsigned long long_val, char *p_RAWBuffer, int max )This is a free to use function for the host side, which encodes a C long value into a given raw buffer according to the defined coding rules. Max is the remaining place in p_RAWBuffer and is checked. If an error occurs, the C function xHostErrorHandler will be called.
The function returns the amount of characters which are encoded into the raw buffer.
int xmk_encode_slong ( long long_val, char *p_RAWBuffer, int max )This is a free to use function for the host side, which encodes a C long value into a given raw buffer according to the defined coding rules. Max is the remaining place in p_RAWBuffer and is checked. If an error occurs, the C function xHostErrorHandler will be called.
The function returns the amount of characters which are encoded into the raw buffer.
int xmk_encode_char_buffer(unsigned char *buffer, int length, unsigned char *p_RAWBuffer, int maxThe function is used only for internal purposes and should not be called by the user.
It encodes the given buffer in parameter 1 with the given amount of characters in parameter 2 (length), into the raw buffer according to the defined coding rules. The value of max defines the destination buffer size in p_RAWBuffer. It is checked within the function. The C function xHostErrorHandler will be called, if there is not enough space in the destination buffer.
The function returns the amount of characters which are encoded into the raw buffer.
int xmk_encode_pointer ( long ptr_val, char *p_RAWBuffer, int max )The function is used only for internal purposes and should not be called by the user.
It encodes a pointer value into the raw buffer according to the defined coding rules.
Its purpose is to skip a pointer value which has to be in the raw buffer, in order to enable the target to access the parameters which follow the pointer value in a C structure.
------------------------------------------------------------------- Caution! The encoded value in ptr_val is interpreted in the target as a phys ical address within the memory space of the target. That pointer should never be used within the target! -------------------------------------------------------------------
void xHostErrorHandler ( int ErrorNumber )The function is called on the host side at some places in sdtmt or the member modules of sdtmt with an error number defined in ml_err.h. The function maps this error number to an appropriate reaction, e.g. a printf for warnings, and a process termination for fatal errors.
Here is a first idea of what you have to set in the configuration file ml_mcf.h (please view the subsection "Configurations / the File ml_mcf.h" on page 2762 in chapter 45, The Cmicro Library).
#define XMK_ADD_MICRO_TESTER
#define XMK_USE_CONFIG5
#define XMK_USE_ON_HOST
#define XMK_USE_COMMUNICATION
#define XMK_ADD_STDIO
-------------------------------------------------------------------- Note: If any buffer is dimensioned too small or inconsistently, that will lead to an error message on screen. --------------------------------------------------------------------The following defines exists to dimension buffers.
Recommendation:
#define XMK_MAX_TSDL_PARAM 255
Recommendation:
#define XMK_MAX_PRINT_STRING 255
Recommendation:
#define XMK_MAX_LEN_SYMBOL_NAME 255The transmit and receive buffers of the default communications link software must be configured in the data link (dl) module, via the following defines:
Transmitter buffer:
#define MAX_SEND_ONE_ENTRY 255 #define MAX_SEND_ENTRIES 100Receiver buffer:
#define MAX_RECEIVE_ONE_ENTRY 255 #define MAX_RECEIVE_ENTRIES 100where *_ONE_ENTRY is the dimensioning of one message, and *_ENTRIES is the maximum amount of entries in the message FIFO of the data link module. Note, that *_ONE_ENTRY must be greater than the greatest of the XMK_MAX_* defines above, plus an reserve of 6 bytes.
In order to use the options of sdtmt or the host library, the target library must be configured accordingly.
A lot of defines make it possible to reduce the Cmicro Testers functions within the target, so that memory requirements can be reduced when scarce.
Following, are explanations of the file structure, the application program interface (API) within the target. Specific subsection is dedicated to the compilation of the host library.
Figure 590 : Files of Cmicro Library ----- (fig) -----
------------------------------------------------------------------------ Caution! The file always carries the same name, for each SDL system gener ated and is stored into the currently active directory (use pwd to de termine). It comes to conflicts, if you try to generate several systems into the same directory. Be sure to use different working directories for each SDL system, otherwise, you'll possibly get unpredictable results during runtime of the generated code, because then some automatic scalable fea tures are possibly not compiled ------------------------------------------------------------------------
Options are to be specified in order to reduce the traffic load of the system, especially where a slow communications interface is involved, and where the user wants to test in realtime.
One simple exception may be valid: If a user writes SDL processes by hand, or uses C code in SDL tasks, he can possibly use two C functions exported by this module, namely
The module is common for all the trace methods mentioned above. The functions exported here are called directly by the Cmicro Kernel, if the Cmicro Tester or part of the Cmicro Tester are involved when executing the SDL system.
Due to the possibility to run the Cmicro Kernel / the Cmicro Tester on different systems, and the possibilities to direct the trace output to different devices (like HDD, screen, serial interface, RAM and MSC editor) the module offers a lot of functionality.
There is also a part included, which is compiled for the host system, if executing in a distributed environment.
The simplest method, however, is to set some options before initializing the SDL system, and hold these options during the whole runtime. A more comfortable method is to set some options before initializing the SDL system, and then change the options in an SDL process, when a specific situation is detected. By using this method, it is possible to reduce the amount of information and to make it easier to find unwanted behavior or an erroneous situation in a trace. This can be achieved, for example by writing the necessary C function call(s) into an SDL task symbol, using the #CODE directive.
The following pages introduce the C function interface, which must be used in the target, to set the options to trace.
------------------------------------------------------------------------ Caution! Pay attention to the correct values of the parameters of the different functions in order to get the right results. Evaluate the return values of those functions, which are returning one. ------------------------------------------------------------------------
void xmk_InitOptions ( void )Initialization is absolutely necessary and is to be done before any other initialization, directly before the C function call xmk_InitSDL.
The Cmicro Tracer is initialized, so that trace is in principle possible. Nothing happens before the C function xmk_OptionsSymbol is called, and xmk_TracerActive is set to XMK_TRUE.
xmk_TracerActive = XMK_TRUE | XMK_FALSEIn order to get an execution trace, it is absolutely necessary to switch it on. This should normally be done after the C function xmk_InitOptions.
The different options set or unset with the functions whose names begin with xmk_Options* remain unaffected when changing the above flag.
The flag is not set per default.
xmk_OPT_INT xmk_OptionsSymbol (This function is absolutely necessary to be called, in order to begin the execution trace of one, a subset of, or all SDL symbols. Per default, no symbol is selected.
unsigned char process-type-id, long bitmask )
Select the trace for process-type-id, set or unset different symbols with the bit mask. If anything goes wrong, the function will return XMK_ERROR, else XMK_OKAY.
It is possible to specify bit mask values for a specific SDL process, for all SDL processes, for the environment and for the kernel part of the Cmicro Library. The last is necessary to allow the optional trace for system events like error trace and trace of scheduling events.
Allowed values for process-type-id:
-------------------------------------------------------------------- 0 First process-type-id, XPTID_ from sdl_cfg.h 1 Second..... N-1 Last... (N is the max number of process types) xNULLTYPE specify trace for all processes any other value The environment MICROKERNEL specify trace for Cmicro Kernel ENV Indicates the SDL environment --------------------------------------------------------------------Allowed values for bit mask:
---------------------------------------- SDL symbols System events ---------------------------------------- TSDL_STATE TSYS_SCHEDULE TSDL_INPUT TSYS_ERROR TSDL_SAVE TSYS_SHOWPRIO TSDL_OUTPUT TSDL_CREATE TSDL_STOP TSDL_STATIC_CREATE TSDL_DYNAMIC_CREATE TSDL_DECISION TSDL_TASK TSDL_PROCEDURE TSDL_RESULT TSDL_TIMER TSDL_SET TSDL_RESET TSDL_ACTUAL_RESET TSDL_SIGNALPARAMS TSDL_DISCARD TSDL_IMPLICIT_CONSUMPTION ----------------------------------------
xmk_OPT_INT xmk_OptionsMSC ( unsigned char flag )This function is used in order to ensure all information necessary for an MSC trace being transferred via the communications link. By calling this function, the minimum trace information for the MSC editor can be set appropriately, The following options exist:
The MSC trace is affected by the flag xmk_TracerActive, too.
xmk_OPT_INT xmk_OptionsSignal ( xmk_T_SIGNAL signal id, unsigned char bitmask )This function is optionally called, because the trace of all SDL signals is switched on per default.
Select the trace for signal id, set or unset different symbols with bit mask. If anything went wrong, the function will return XMK_ERROR, else XMK_OKAY.
It is possible to specify "off" for all signals, "on" for all signals, "off" for a specific signal, and "on" for a specific signal.
Allowed values for signal-id:
-------------------------------------------------------- 0 First signal-id, #define from generated C code and <systemname>.ifc 1 Second..... N-1 Last..... XMK_ALLOW_NO Specify trace for all processes XMK_ALLOW_ALL Specify trace for Cmicro Kernel --------------------------------------------------------Allowed values for bitmask:
Example 372 #include "sdl_cfg.h" #include "ml_typ.h" ... main ( ... ) { extern int xmk_TracerActive ; long bitmask = 0 ; int result = XMK_OKAY ; /* Initialize Cmicro Tester */ xmk_InitOptions ( ); /* Set all options ON */ result = xmk_OptionsSymbol (xNULLPID, 0xffffffff); if (result != XMK_OKAY) ErrorInUsage (); /* Set some options ON */ bitmask = TSDL_INPUT ; bitmask |= TSDL_STATE ; bitmask |= TSDL_OUTPUT ; /* +---- Proces-Type - Id (see automatically */ /* | generated file *.ifc) */ /* V */ result = xmk_OptionsSymbol (0, bitmask ); if (result != XMK_OKAY) ErrorInUsage (); result = xmk_OptionsSymbol (1, 0x00000000 ); if (result != XMK_OKAY) ErrorInUsage (); /* S w i t c h o n t h e t r a c e */ xmk_TracerActive = XMK_TRUE ; /* Template to set options to filter signals */ /* */ /* +---- Allow all Signals to be traced */ /* V */ xmk_OptionsSignal (XMK_ALLOW_NO, 0); /* +---- Signal id is to be set correctly ! */ /* | according to the automatically */ /* | generated *.ifc - file */ /* V */ xmk_OptionsSignal (1, 0xff); xmk_OptionsSignal (2, 0xff); xmk_OptionsSignal (3, 0xff); /* I n i t i a l i z e m i C r o K e r n e l */ xmk_InitSDL () /* R u n m i C r o K e r n e l */ if (xmk_RunSDL (0xff) != XMK_STOP); exit (0); }
There are two C functions which enable a work around:
xmk_PrintString ('Hello SDL world')looks like:
USER: Hello SDL worldThe strings have to be unique, in order to distinguish a trace of one process from another. Another difference between the above function is, that the C function xmk_PrintString does not check if a trace is wanted or not. The trace will be done unconditionally via the Cmicro Testers communications link.
Of course, the function may also be applied in non SDL program parts.
xmk_OPT_INT xmk_SetRecorderMode ( int mode )This function must be called by the user in order to:
void xInEnv ( void )This function is called each time the Cmicro Kernels main loop is entered. Here it is possible to read the communications interface by calling the C function xmk_dl_read, if the data link module of the Cmicro Package is used. After reading a message from the interface, it can be decoded by calling the C function xmk_Cod_Decode, which is described a few steps later. A more detailed description of the C function xInEnv can be found in the Cmicro Library reference manual part.
int xOutEnv ( xmk_T_SIGNAL sig, xmk_T_PRIO prio, xmk_T_MESS_LENGTH data_len, void *p_data, xPID Receiver )This function is called each time the SDL system wants to output a signal to the environment. If the environment should be another system (e.g., an MS DOS PC), the signal can be sent directly by calling the C function xmk_Cod_Encode, which is described in the following section. A more detailed description of the C function xOutEnv can be found in the Cmicro Library reference manual part.
int xmk_Cod_Decode ( char *p_RAWBuffer, In int *p_MessageClass, Out int *p_Messagetag, Out int *p_MessageLength, Out char *p_dest, In/Out int dest_len ) InThis is a free to use function for the target side, which decodes a given data link frame in the Cmicro Protocol format into the different informations. MessageClass may be in the range from 0 to 249, Messagetag may be of any value. p_struct is a pointer to a C structure which is to be transferred via the communications link. Struct_length is the result of the sizeof operator applied to this structure.
The function is the counterpart to the C function xmk_Cod_Encode.
int xmk_Cod_Encode ( int MessageClass, int Messagetag, char *p_data, int length )This is a free to use function for the target side, which encodes the given information into a data link frame of the Cmicro Protocol format and sends it via the communications interface. MessageClass may be in the range from 0 to 249, Messagetag may be of any value. P_struct is a pointer to a C structure which is to be transferred via the communications link. Struct_length is the result of the sizeof operator applied to this structure.
The function is the counterpart to the C function xmk_Cod_Decode.
--------------------------------------------------------------- Note: The maximum amount of characters which can be transferred is re stricted to 255 per default. ---------------------------------------------------------------
Here is a first idea of what you have to set in the configuration file ml_mcf.h:
#define XMK_ADD_MICRO_TESTER
#define XMK_USE_CONFIG5
#define XMK_USE_ON_TARGET
#define XMK_ADD_V24_TRACE
#define XMK_USE_COMMUNICATION
It is not necessary to recompile the host executables again, if these are using a particular functionality, which is not compiled within the target.
For instance, if the recorder isn't compiled within the target, the user may not use the functions of the Cmicro Recorder on host side.
#undef XMK_ADD_MICRO_TESTER
#define XMK_ADD_MICRO_TESTER. #undef XMK_ADD_MICRO_TRACER
#define XMK_ADD_MICRO_TESTER. #undef XMK_ADD_MICRO_RECORDERIn order to use both record and play mode, the following must be defined:
#define XMK_ADD_MICRO_TESTER. #define XMK_ADD_MICRO_RECORDER #define XMK_ADD_MICRO_PLAY
#definef XMK_ADD_MICRO_TESTER. #undef XMK_ADD_MICRO_COMMANDPartial functionality may be left out by undefining one of the defines described under "Message Transfer and Presentation of Messages" on page 3064.
The reason behind this is, that the Cmicro Tester uses an efficient way to handle those buffers, which is of great importance especially for micro controllers.
Additionally, these buffers must be dimensioned consistently. For instance, the message buffer of the communications link must be able to handle the largest parameter list of a signal from SDL. The same situation arises in the trace of SDL tasks and procedure names.
--------------------------------------------------------------------- Caution! If any buffer is dimensioned too small, this may result in a runtime error. ---------------------------------------------------------------------The following defines exists to dimension buffers.
The transmit and receive buffers of the default communications link software must be configured in the data link (dl) module, via the following defines:
Transmitter buffer:
#define MAX_SEND_ONE_ENTRY 80 #define MAX_SEND_ENTRIES 100Receiver buffer:
#define MAX_RECEIVE_ONE_ENTRY 80 #define MAX_RECEIVE_ENTRIES 100where *_ONE_ENTRY is the dimensioning of one message, and *_ENTRIES is the maximum amount of entries in the message fifo of the data link module. Note, that *_ONE_ENTRY must be greater than the greatest of the XMK_MAX_* defines above, plus a reserve of 6 bytes.
Figure 591 : Structure of the communications link software ----- (fig) -----The following subsections describe the current implementation and how to implement a new communications link software.
For the messages carrying parameters, there is always (no exception), a special _CNF message which carries these back to the requestor. The requestor mostly is the host, or indirectly, the user which holds the session at the host.
For the messages, which do not carry parameters, a positive confirmation is done via the message CMD_OKAY_CNF.
If a message can't be recognized or processed within the target, a negative confirmation CMD_ERROR_CNF is used in all cases.
Each _REQ message must be confirmed first, before the next one can be sent.
Messages with an _IND suffix are mostly sent from target to host in order to indicate a specific situation. For these messages, the sender is always the originator.
Each typedef shown below is packed into a data link frame in its target representation.
That means, a simple memcpy (destbuffer,struct,sizeof(struct)) is performed to copy a structure to/from the data link frame.
On host side, it is therefore necessary to perform message coding and message decoding.
Messageclass :XMK_MICRO_COMMAND Meaning :Request coding rules from target Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:-Message description: Normally, it is not mandatory to use this command. The target always sends the correct information as initiated by itself using CMD_START_IND. The host library doesn't use the command.
Message tag: CMD_START_IND
Messageclass :XMK_MICRO_COMMAND Meaning :Indicate coding rules to host Sent when :automatically at start Direction :T->H Typedefinition :xmk_TST_STRUCTURE Conditional compile:-Message description: This message is sent automatically from target to host at the beginning of a trace session or any session with the Cmicro Tester.
Messageclass :currently Meaning :unused Sent when :Indicate current traceoptions to host Direction :T->H Typedefinition :- Conditional compile:-Message description: This command is currently not implemented.
Message tag: CMD_TTASK
Messageclass :XMK_MICRO_TRACER Meaning :Trace of SDL Task Sent when :Execution of that SDL symbol Direction :T->H Typedefinition :xmk_TSDL_NAME Conditional compile:XMK_ADD_TNAMEMessage description: The message is sent, when a task symbol is entered in generated C Code and when the trace is set for this symbol. Furthermore, the trace must be active.
Message tag: CMD_TSET
Messageclass :XMK_MICRO_TRACER Meaning :Trace of SDL Set Sent when :Execution of that SDL symbol Direction :T->H Typedefinition :xmk_TSDL_SET Conditional compile:XMK_ADD_TSETMessage description: The message is sent, when a timer set is performed in generated C Code and when the trace is set for this symbol. Furthermore, the trace must be active.
Message tag: CMD_TRESET
Messageclass :XMK_MICRO_TRACER Meaning :Trace of SDL Reset Sent when :Execution of that SDL symbol Direction :T->H Typedefinition :xmk_TSDL_RESET Conditional compile:XMK_ADD_TRESETMessage description: The message is sent, when a timer reset is performed in generated C Code and when the trace is set for this symbol. Furthermore, the trace must be active.
Message tag: CMD_TSTOP
Messageclass :XMK_MICRO_TRACER Meaning :Trace of SDL Stop Sent when :Execution of that SDL symbol Direction :T->H Typedefinition :xmk_TSDL_STOP Conditional compile:XMK_ADD_TSTOPMessage description: The message is sent, when an SDL process stop is performed, and when the trace is set for this symbol. Furthermore, the trace must be active.
Message tag: CMD_TSTATE
Messageclass :XMK_MICRO_TRACER Meaning :Trace of SDL State Sent when :Execution of that SDL symbol Direction :T->H Typedefinition :xmk_TSDL_STATE Conditional compile:XMK_ADD_TSTATEMessage description: The message is sent, when an SDL nextstate is performed, and when the trace is set for this symbol. Furthermore, the trace must be active.
Message tag: CMD_TSTATIC_CREATE
Messageclass :XMK_MICRO_TRACER Meaning :Trace of SDL Static create Sent when :Execution of that SDL symbol Direction :T->H Typedefinition :xmk_TSDL_STATICCREATE Conditional compile:XMK_ADD_TSTATICCREATEMessage description: The message is sent for each statically created SDL process, for which the start transition is executed, and for which the trace is set for this symbol. Furthermore, the trace must be active.
Message tag: CMD_TCREATE
Messageclass :XMK_MICRO_TRACER Meaning :Trace of SDL Create Sent when :Execution of that SDL symbol Direction :T->H Typedefinition :xmk_TSDL_CREATE Conditional compile:XMK_ADD_TCREATEMessage description: The message is sent, when the SDL action create is performed, and when the trace is set for this symbol. Furthermore, the trace must be active.
Message tag: CMD_TDYNAMIC_CREATE
Messageclass :XMK_MICRO_TRACER Meaning :Trace of SDL Dynamic create Sent when :Execution of that SDL symbol Direction :T->H Typedefinition :xmk_TSDL_DYNAMICCREATE Conditional compile:XMK_ADD_TDYNAMICCREATEMessage description: The message is sent for each dynamically created SDL process, when its start transition is executed, and when the trace is set for this symbol. Furthermore, the trace must be active.
Message tag: CMD_TDECISION
Messageclass :XMK_MICRO_TRACER Meaning :Trace of SDL Decision Sent when :Execution of that SDL symbol Direction :T->H Typedefinition :xmk_TSDL_DecisionValue Conditional compile:XMK_ADD_TDecisionValueMessage description: The message is sent, when an SDL decision is executed, and when the trace is set for this symbol. Furthermore, the trace must be active.
Message tag: CMD_TSAVE
Messageclass :XMK_MICRO_TRACER Meaning :Trace of SDL Save Sent when :Execution of that SDL symbol Direction :T->H Typedefinition :xmk_TSDL_SAVE Conditional compile:XMK_ADD_TSAVEMessage description: The message is sent, when a signal save is performed, and when the trace is set for this symbol. Furthermore, the trace must be active.
Message tag: CMD_TTIMER
Messageclass :XMK_MICRO_TRACER Meaning :Trace of SDL Timer Sent when :Execution of that SDL symbol Direction :T->H Typedefinition :xmk_TSDL_TIMER Conditional compile:XMK_ADD_TTIMERMessage description: The message is sent, when an SDL timer had been expired and is input in the owner process, and when the trace is set for this symbol. Furthermore, the trace must be active.
Message tag: CMD_TINPUT
Messageclass :XMK_MICRO_TRACER Meaning :Trace of SDL Input Sent when :Execution of that SDL symbol Direction :T->H Typedefinition :xmk_TSDL_INPUT Conditional compile:XMK_ADD_TINPUTMessage description: The message is sent, when an SDL input is performed, and when the trace is set for this symbol. Furthermore, the trace must be active.
Message tag: CMD_TPROCEDURE
Messageclass :XMK_MICRO_TRACER Meaning :Trace of SDL Procedure Sent when :Execution of that SDL symbol Direction :T->H Typedefinition :xmk_TSDL_NAME Conditional compile:XMK_ADD_TNAMEMessage description: The message is sent, when an SDL procedure is entered, and when the trace is set for this symbol. Furthermore, the trace must be active.
Message tag: CMD_TOUTPUT
Messageclass :XMK_MICRO_TRACER Meaning :Trace of SDL Output Sent when :Execution of that SDL symbol Direction :T->H Typedefinition :xmk_TSDL_OUTPUT Conditional compile:XMK_ADD_TOUTPUTMessage description: The message is sent, when an SDL output is performed, and when the trace is set for this symbol. Furthermore, the trace must be active.
Message tag: CMD_TDISCARD
Messageclass :XMK_MICRO_TRACER Meaning :Trace of SDL Discard Sent when :Execution of that SDL symbol Direction :T->H Typedefinition :xmk_TSDL_DISCARD Conditional compile:XMK_ADD_TDISCARDMessage description: The message is sent, when an SDL discard has been detected, and when the trace is set for this symbol. Furthermore, the trace must be active.
Message tag: CMD_TIMPLICIT_CONSUMPTION
Messageclass :XMK_MICRO_TRACER Meaning :Trace of SDL Implicit consumption Sent when :Implicit consumption occurs Direction :T->H Typedefinition :xmk_TSDL_IMPLICIT_CONSUMPTION Conditional compile:XMK_ADD_TIMPLICIT_CONSUMPTIONMessage description: The message is sent, when an SDL implicit consumption is performed, and when the trace is set for this symbol. Furthermore, the trace must be active.
Message tag: CMD_TACTUAL_RESET
Messageclass :XMK_MICRO_TRACER Meaning :Trace of SDL Actual reset Sent when :SDL timer is actually reset Direction :T->H Typedefinition :xmk_TSDL_ACTUAL_RESET Conditional compile:XMK_ADD_TACTUAL_RESETMessage description: The message is sent, when an SDL timer is actually reset, and when the trace is set for this symbol. Furthermore, the trace must be active. An actual reset applies only, if a timer was previously set and has not been expired.
Message tag: CMD_TSYS_ERROR
Messageclass :XMK_MICRO_TRACER Meaning :Trace of system error Sent when :Any kind of systemerror was detected Direction :T->H Typedefinition :xmk_TSYS_ERROR Conditional compile:XMK_ADD_TERRORMessage description: The message is sent, when a system error of any type has been detected, and when the trace is set for this event. Furthermore, the trace must be active.
Message tag: CMD_TSYS_SCHEDULE
Messageclass :XMK_MICRO_TRACER Meaning :Trace of system schedule event Sent when :When scheduling is performed Direction :T->H Typedefinition :xmk_TSYS_SCHEDULE Conditional compile:XMK_ADD_TSCHEDULEMessage description: The message is sent, when the Cmicro Kernel begins scheduling, and when the trace is set for this event. Furthermore, the trace must be active.
Message tag: CMD_TSYS_SHOWPRIO
Messageclass :XMK_MICRO_TRACER Meaning :Trace of system event : change priority level Sent when :When changing to another prioritylevel Direction :T->H Typedefinition :xmk_TSYS_SHOWPRIO Conditional compile:XMK_ADD_TSHOWPRIOMessage description: The message is sent, when the Cmicro Kernel schedules from one priority level to another, and when the trace is set for this event. Furthermore, the trace must be active.
Message tag: CMD_PRINT_STRING
Messageclass :XMK_MICRO_TRACER Meaning :User command Print string Sent when :Execution of fct.xmk_PrintString() Direction :T->H Typedefinition :xmk_T_PrintString Conditional compile:XMK_ADD_CPRINT_STRINGMessage description: The message is sent unconditionally, when the C function xmk_PrintString is called by the user.
Messageclass :XMK_MICRO_RECORDER Meaning :Show recorded event counter to host Sent when :When ENV->SDL stimuli detected Direction :T->H Typedefinition :xmk_TREC_EVENT_COUNTER Conditional compile:XMK_ADD_MICRO_RECORDERMessage description: The message is sent, when the Cmicro Recorder is active and is in record mode. It is sent together with, but always before CMD_RECORD_OUTPUT_ENV2SDL.
Message tag: CMD_RECORD_OUTPUT_ENV2SDL
Messageclass :XMK_MICRO_RECORDER Meaning :Indicate stimuli ENV->SDL to host Sent when :When ENV->SDL stimuli detected Direction :T->H Typedefinition :xmk_TSDL_OUTPUT Conditional compile:XMK_ADD_MICRO_RECORDERMessage description: The message is sent, when the Cmicro Recorder is active and is in record mode. It is sent after CMD_RECORD_COUNT_IND.
Message tag: CMD_RECORD_OUTPUT_SDL2ENV
Messageclass :XMK_MICRO_RECORDER Meaning :unused Sent when :- Direction :T->H Typedefinition :- Conditional compile:XMK_ADD_MICRO_RECORDERMessage description: This message is currently unused and is never sent.
Message tag: CMD_PLAY_SECTION_REQ
Messageclass :XMK_MICRO_RECORDER Meaning :Request next sections from host Sent when :When current cnt reaches debit cnt Direction :H->T Typedefinition :- Conditional compile:XMK_ADD_MICRO_RECORDER&XMK_ADD_MICRO_PLAYMessage description: The message is sent, when the Cmicro Recorder is active and is in play mode. It is sent, if the target has to put in the next stimuli (an environment signal).
Message tag: CMD_PLAY_COUNT
Messageclass :XMK_MICRO_RECORDER Meaning :Transfer Debitcounter to target Sent when :When target requests next sections Direction :H->T Typedefinition :xmk_TREC_EVENT_COUNTER Conditional compile:XMK_ADD_MICRO_RECORDER&XMK_ADD_MICRO_PLAYMessage description: The message is sent, when the Cmicro Recorder is active and is in play mode. It is sent, if the target requests the next stimuli (an environment signal). It is also sent in the initialization phase of the play mode. Outside the initialization phase, it is always sent together with, but behind CMD_PLAY_OUTPUT_ENV2SDL.
Message tag: CMD_PLAY_OUTPUT_ENV2SDL
Messageclass :XMK_MICRO_RECORDER Meaning :Transfer stimuli ENV->SDL to target Sent when :When target requests next sections Direction :H->T Typedefinition :xmk_TSDL_OUTPUT Conditional compile:XMK_ADD_MICRO_RECORDER&XMK_ADD_MICRO_PLAYMessage description: The message is sent, when the Cmicro Recorder is active and is in play mode. It is sent together with, but always before CMD_PLAY_COUNT, if the target request the next stimuli (an environment signal).
Message tag: CMD_PLAY_OUTPUT_SDL2ENV
Messageclass :XMK_MICRO_RECORDER Meaning :unused Sent when :- Direction :H->T Typedefinition :- Conditional compile:XMK_ADD_MICRO_RECORDER&XMK_ADD_MICRO_PLAYMessage description: This message is currently unused and is never sent.
Message tag: CMD_RECORDER_OFF
Messageclass :XMK_MICRO_RECORDER Meaning :Switch off recorder Sent when :When at end of replay session detected Direction :H->T Typedefinition :- Conditional compile:XMK_ADD_MICRO_RECORDER&XMK_ADD_MICRO_PLAYMessage description: This message is sent, if the host detected an end of file, after the target requests the next stimuli (an environment signal). It switches the Cmicro Recorder within the target off and execution returns from simulation to realtime.
Messageclass :XMK_MICRO_COMMAND Meaning :Suspend Cmicro Kernel Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:XMK_ADD_CSUSPENDMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_RESUME_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Resume Cmicro Kernel Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:XMK_ADD_CRESUMEMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_SYSTEM_REINIT_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Reinitialize SDL system Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:XMK_ADD_CREINITMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_SYSTEM_SHUTDOWN_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Shutdown SDL system Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:XMK_ADD_CSHUTDOWNMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_SINGLE_STEP_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Go into single step Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:XMK_ADD_CSINGLE_STEPMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_DISABLE_TIMER_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Disable processing of timers Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:XMK_ADD_CDISABLE_TIMERMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_ENABLE_TIMER_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Enable processing of timers Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:XMK_ADD_CENABLE_TIMERMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_NEXT_STEP_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Execute next step Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:XMK_ADD_CNEXT_STEPMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_SYSTEM_CONTINUE_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Continue system, if halted Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:XMK_ADD_CCONTINUEMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_SET_BREAKPOINT_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Set breakpoint Sent when :User typed in command Direction :H->T Typedefinition :xmk_T_DebBreakpoints Conditional compile:XMK_ADD_CBREAK_LOGICMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_BREAK_INPUT_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Set breakpoint on SDL input Sent when :User typed in command Direction :H->T Typedefinition :xmk_T_BreakInputReq Conditional compile:XMK_ADD_CBREAK_LOGICMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_BREAK_STATE_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Set breakpoint on nextstate Sent when :User typed in command Direction :H->T Typedefinition :xmk_T_BreakStateReq Conditional compile:XMK_ADD_CBREAK_STATEMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_CLEAR_BREAKPOINT_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Clear specified breakpoint from list Sent when :User typed in command Direction :H->T Typedefinition :xmk_T_ClearBreakpoint Conditional compile:XMK_ADD_CBREAK_LOGICMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_CLEAR_ALL_BREAKPOINT_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Clear all breakpoints Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:XMK_ADD_CBREAK_LOGICMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_QUERY_BREAKPOINT_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Query the breakpoint list Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:XMK_ADD_CBREAK_LOGICMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_QUERY_ERROR_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Query last error occured in system Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:XMK_ADD_CQUERY_ERRORMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_NEXT_STATE_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Modify processstate to value Sent when :User typed in command Direction :H->T Typedefinition :xmk_T_NextStateReq Conditional compile:XMK_ADD_CNEXTSTATEMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_CREATE_PROCESS_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Create SDL process Sent when :User typed in command Direction :H->T Typedefinition :xmk_T_CreateProcessReq Conditional compile:XMK_ADD_CCREATE_PROCESSMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_TBUF_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Query Tracebuffer Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:XMK_ADD_CTBUFMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_KILL_PROCESS_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Kill process Sent when :User typed in command Direction :H->T Typedefinition :xmk_T_KillProcessReq Conditional compile:XMK_USE_CMD_KILL&XMK_ADD_CKILL_PROCESSMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_PCO_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Define PCO Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:-Message description: This message is currently not implemented and is never sent.
Message tag: CMD_QUERY_PROCESS_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Query process state Sent when :User typed in command Direction :H->T Typedefinition :xmk_T_QueryProcessReq Conditional compile:XMK_ADD_CQUERY_PROCESSMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_QUERY_QUEUE_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Query all queues Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:XMK_ADD_CQUERY_QUEUEMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_RMQUEUE_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Flush all queues Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:XMK_ADD_CRM_QUEUEMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_SET_TIMER_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Set SDL timer Sent when :User typed in command Direction :H->T Typedefinition :xmk_T_SetTimerReq Conditional compile:XMK_ADD_CSET_TIMERMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_RESET_TIMER_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Reset SDL timer Sent when :User typed in command Direction :H->T Typedefinition :xmk_T_ResetTimerReq Conditional compile:XMK_ADD_CRESET_TIMERMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_QUERY_TIMER_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Query timertables Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:XMK_ADD_CQUERY_TIMERMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_ACTIVE_TIMER_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Query, if timer active Sent when :User typed in command Direction :H->T Typedefinition :xmk_T_ActiveTimerReq Conditional compile:XMK_ADD_CACTIVE_TIMERMessage description: Message tag: CMD_FLUSH_SIGNAL_BY_SID_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Flush signals with given ID Sent when :User typed in command Direction :H->T Typedefinition :xmk_T_FlushSignalBySIDReq Conditional compile:XMK_ADD_CFLUSH_SIGNAL_BY_SIDMessage description:This message is sent, if the user typed in the appropriate command.
Message tag: CMD_FLUSH_SIGNALS_BY_PID_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Flush signals of process Sent when :User typed in command Direction :H->T Typedefinition :xmk_T_FlushSignalsByPIDReq Conditional compile:XMK_ADD_CFLUSH_SIGNALS_BY_PIDMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_RESET_ALL_TIMERS_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Reset all timers Sent when :User typed in command Direction :H->T Typedefinition :xmk_T_ResetAllTimersReq Conditional compile:XMK_ADD_CRESET_ALL_TIMERSMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_SCALE_TIMER_REQ
Messageclass :XMK_MICRO_COMMAND Meaning :Scale timers Sent when :User typed in command Direction :H->T Typedefinition :xmk_T_ScaleTimerReq Conditional compile:XMK_ADD_CSCALE_TIMERMessage description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_REC_OFF
Messageclass :XMK_MICRO_COMMAND Meaning :Switch recorder off Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:-Message description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_REC_PLAY
Messageclass :XMK_MICRO_COMMAND Meaning :Switch recorder to play mode Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:-Message description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_REC_RECORD
Messageclass :XMK_MICRO_COMMAND Meaning :Switch recorder to record mode Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:-Message description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_TRACE_ON
Messageclass :XMK_MICRO_COMMAND Meaning :Switch trace on in general Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:-Message description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_TRACE_OFF
Messageclass :XMK_MICRO_COMMAND Meaning :Switch trace off in general Sent when :User typed in command Direction :H->T Typedefinition :- Conditional compile:-Message description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_TRACE_PROCESS
Messageclass :XMK_MICRO_COMMAND Meaning :Modify traceoptions for process Sent when :User typed in command Direction :H->T Typedefinition :xmk_T_TraceProcessReq Conditional compile:-Message description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_TRACE_SIGNAL
Messageclass :XMK_MICRO_COMMAND Meaning :Modify traceoptions for signal Sent when :User typed in command Direction :H->T Typedefinition :xmk_T_TraceSignalReq Conditional compile:-Message description: This message is sent, if the user typed in the appropriate command.
Message tag: CMD_BREAK_HIT_IND
Messageclass :XMK_MICRO_COMMAND Meaning :Indicate breakpoint hit to host Sent when :Breakpoint hit in target Direction :T->H Typedefinition :xmk_T_BreakHitInd Conditional compile:XMK_ADD_CBREAK_LOGICMessage description: This message is sent, if one of the a breakpoints defined in the breaklist has been hit. The SDL system is halted and waits on the next commands from that point on.
Message tag: CMD_ERROR_CNF
Messageclass :XMK_MICRO_COMMAND Meaning :Negative acknowledge on command Sent when :A command couldn't be executed Direction :T->H Typedefinition :xmk_T_ESTATE Conditional compile:unconditionalMessage description: This message is sent, if the target wasn't able to respond to a command from the user.
Message tag: CMD_TBUF_CNF
Messageclass :XMK_MICRO_COMMAND Meaning :Indicate Tracebuffercontents Sent when :Response to user command Direction :T->H Typedefinition :xmk_TBF_ENTRY Conditional compile:-Message description: This message is currently not implemented and will never be sent.
Message tag: CMD_OKAY_CNF
Messageclass :XMK_MICRO_COMMAND Meaning :Command acknowledge Sent when :Command correctly executed Direction :T->H Typedefinition :- Conditional compile:unconditionalMessage description: This message is sent from target to host, as a response for all commands, which do not carry parameters or any kind. It is used within the host library as a general confirmation of most messages.
Message tag: CMD_QUERY_PROCESS_CNF
Messageclass :XMK_MICRO_COMMAND Meaning :Indicate process state Sent when :Response to user command Direction :T->H Typedefinition :xmk_T_PSTATE Conditional compile:XMK_ADD_CQUERY_PROCESSMessage description: This message is sent as a reaction to the message CMD_QUERY_PROCESS_REQ. It carries information about the process state.
Message tag: CMD_QUERY_QUEUE_CNF
Messageclass :XMK_MICRO_COMMAND Meaning :Indicate queue states Sent when :Response to user command Direction :T->H Typedefinition :xmk_T_QSTATE Conditional compile:XMK_ADD_CQUERY_QUEUEMessage description: This message is sent as a reaction to the message CMD_QUERY_QUEUE_REQ. It carries information about the queue state.
Message tag: CMD_QUERY_TIMER_CNF
Messageclass :XMK_MICRO_COMMAND Meaning :Indicate timer table Sent when :Response to user command Direction :T->H Typedefinition :xmk_T_TSTATE Conditional compile:XMK_ADD_CQUERY_TIMERMessage description: This message is sent as a reaction to the message CMD_QUERY_TIMER_REQ. It carries information about the timer tables.
Message tag: CMD_ACTIVE_TIMER_CNF
Messageclass :XMK_MICRO_COMMAND Meaning :Indicate, if timer is active Sent when :Response to user command Direction :T->H Typedefinition :xmk_T_ActiveTimerCnf Conditional compile:XMK_ADD_CACTIVE_TIMERMessage description: This message is sent as a reaction to the message CMD_ACTIVE_PROCESS_REQ. It carries information about the state of a timer according to SDL semantics.
Message tag: CMD_QUERY_BREAKPOINT_CNF
Messageclass :XMK_MICRO_COMMAND Meaning :Indicate breaklist to host Sent when :Response to user command Direction :T->H Typedefinition :xmk_T_DebBreakpoints [XMK_MAXBREAKPOINTS] Conditional compile:-Message description: This message is sent as a reaction to the command CMD_QUERY_BREAKPOINT_REQ. It carries the breaklist from target to host.
Message tag: CMD_QUERY_ERROR_CNF
Messageclass :XMK_MICRO_COMMAND Meaning :Indicate last error occured Sent when :Response to user command Direction :T->H Typedefinition :xmk_T_ESTATE Conditional compile:-Message description: This message is sent as a reaction to the message CMD_QUERY_ERROR_REQ. It carries information about the last error which has occurred in the target.
Each frame consists of the following items:
Example 373 :Coding for MSDOS PCThe functions described in "The API on Target" on page 3052 and the functions described within section "The Host Library" on page 3035 can be used to encode / decode these frames.-------------------------------------------------------------- Message- Message-
SYNC Message- -any kind of data- CRC class tag length 0xF1 0x06 0xAA 0x02 0x?? --------------------------------------------------------------
The data link uses the services and functions of the physical layer in order to transmit and receive information.
The data link offers functionality that makes it possible to send and to receive messages via the physical layer assigned to the data link. This functionality can be used by all programs (if implemented so). Mainly, it is the Cmicro Tester, which uses the data link layer services in order to send and to receive messages. But also, users may want to send and receive messages. This is possible by using the data link layer functions and by regarding the defined protocol used for each message.
The data link layer offers the following functionalities:
------------------------------------------------ xmk_dl_init Initialization of data link xmk_dl_query Polling the receiver of data link xmk_dl_read Reading a message from data link xmk_dl_write Writing a message to data link xmk_dl_deinit Deinitialization of data link ------------------------------------------------
The physical layer of the communications link normally handles the bytewise transfer of messages from host to target and the other way around.
It uses the services of the underlaying hardware, like interrupts, CPU registers or memory mapped I/O.
The physical layer offers functionality to the data link in order to make it possible to transfer any kind of information, including Cmicro Tester data and / or user data.
The physical layer offers the following functionalities:
Both modules are mainly of interest for the host machine. Both transfer directions are supported. However, if the target machine is the same one as the host machine, the modules may be used in the following combinations (the left side should always be considered as host):
UNIX <-> Cmicro Controller
PC <-> Cmicro Controller
UNIX <-> UNIX
PC <-> PC
UNIX <-> PC
Look at the modules. There are some options to be selected:
Baudrate : 9600 Baud recommended, 19200 Baud also allowed under some circumstances
Com : Com1 or Com2 interface of the MS DOS PC
other flags :......please inspect ml_com.c and ml_v24ux.c
The physical interface uses a modified XON/XOFF and allows the transfer of binary data by escaping control characters.
The data link module delivered with the Cmicro Tester uses the following C functions:
--------------------------------------------------------- xmk_com_Init Initialization of physical layer xmk_com_Query Polling the receiver of physical layer xmk_com_Receive Receiving a message on physical layer xmk_com_Send Sending a message via physical layer xmk_com_Deinit Denationalization of physical layer ---------------------------------------------------------
To avoid problems, users must not use SDL charstring, whenever it is of interest to send / receive them via the communications link (e.g. Cmicro Tracer or Cmicro Recorder functionality).
An explanation follows:
Each message is transferred as:
Header + Data + CRCThe length field contained in the header may represent the values from 0 to 255. If the MSB in the Messagetag is set to '1', then the length field is expected to be a 2 octet values, which makes it possible to represent the values from 256 to 65535.
However, the length field consisting of 2 octets is currently not implemented.
As a fact, no message may be greater than 4 + 255 + 1 = 260 characters in total (1 character normally is equal to 1 Byte, which consists of 8 Bit).
If the communications link which is delivered as default, and therefore the software representing it, doesn't fulfill the users needs, it is possible to reimplement parts of it.
To do so, you should first read the introduction at the beginning of this section "Structure of Communications Link Software" on page 3063.
Second, you must have good knowledge in C programming and also must know details concerning the Cmicro Tester and Cmicro Library.
It is possible to reimplement the data link layer only, the physical layer only, or both together.
In most, both parts are to be reimplemented when a new type of communications link is to be implemented.
For instance, it may be necessary for a particular physical layer to introduce a ACK/NACK or a Retry-Request/Retry-Confirm mechanism.
The Cmicro Tester uses only these functions, which are described within the subsection "The Data Link Layer" on page 3085. Users therefore only have to reimplement the body of these functions.
As a possibility, users can use the functions of the default physical layer, as they are described within the subsection "The Physical Layer" on page 3086.
The functions of the physical layer are called within the data link layer (described within the subsection "The Data Link Layer" on page 3085).
Users therefore only have to reimplement the body of the physical layer functions.
It may - on the other hand - be hard to implement these functions for a specific micro controller. Users should pay extra attention to restrictions concerning the hardware which is to be used (e.g. Interrupts, processor registers).
Some tips can be found in the following subsection.
However, if considering timing constraints, critical paths, interrupts and similar things, users have to note the following.
Critical paths may occur at any place in the software, which accesses global C variables.
The beginning of each critical path must be blocked with something like "disable interrupts". The end of a critical path must be released with something like "enable interrupts".
In order to use the open interface in this way, this is of interest:
The host side must send each message in target representation.
For instance, if the target system uses integers as 2 octet values in the ordering higher octet first, then the host must send an integer value with higher octet and then lower octet, irrespective of its own layout.
For the other direction (reception of messages at host side), the host also must map the information according to the target memory layout to its own internal representation.
Example 374 #define HelloWorldTag <AnyValueAllowed> char buffer [20]; char helloworld [15]; int length = 0; strcpy (helloworld, 'Hello World'); buffer [0] = 0x11; length ++; /* any value for Messageclass, except */ /* reserved values for Cmicro Tester */ /* reserved values begin from 250 to 255 */ buffer [1] = HelloWorldTag; length ++; /* any value for Messagetag */ /* Messagetag is made unique together */ /* with Messageclass, so that no */ /* conflict occurs. */ buffer [2] = strlen (helloworld); length ++; /* length of data for this message */ /* length is given without calculating */ /* the CRC field */ memcpy (buffer [3], helloworld, strlen (helloworld); length += strlen (helloworld); /* It is assumed, that no stringterminator */ /* is included in the message (the length */ /* can be calculated from Messagelength) */ buffer [length] = xmk_EvalChkSum (buffer, length); /* Evaluate the checksum of current buffer */ xmk_dl_write (buffer, 5 + strlen (helloworld)); /* transmit buffer via communications link */The user can receive informations from the communication link by calling the C function xmk_dl_read with appropriate parameters, e.g. within the C function xInEnv.
Example 375 xInEnv (): char buffer [256]; int result; int MessageClass; int Messagetag; int MessageLength; char *p_data; int signalid; p_data = xmk_dl_read () ; if (p_data != (char *) NULL) { /* if anything received, decode it */ /* according to Cmicro Protocol */ result = xmk_Cod_Decode (p_data, &MessageClass, &Messagetag, &MessageLength, buffer, sizeof (buffer)); if (MessageClass == XMK_MICRO_COMMAND) { result = xmk_HandleCmd ( Messagetag, (xmk_U_CMDS*) buffer ); return; } /* ** Received user message */ if (MessageClass != 0x11) { ErrorHandler (-7777); return ; } if (HelloWorldTag == Messagetag) { /* HelloWorldTag is used in this example to */ /* identify the hello world message */ /* The user can choose any value for the */ /* Message tag */ char helloworld [15]; memset (helloworld, 0, sizeof (helloworld)); memcpy (helloworld, buffer, MessageLength); printf ('%s', helloworld); }The above examples assume, that the Cmicro protocol, which is described in within subsection "Used Default Protocol" on page 3083, is used.
If the startup record neither can be found in this file sdtmt.stt, nor can be read from the communications link, then sdtmt is not able to work.
If the file sdtmt.stt was created in earlier sessions, it will not be overwritten. It is assumed, that the file always carries the information of the target, which sdtmt is communicating with in the current session.
As an example, the file contains this record (from an 80186 controller):
The first 4 octets and the last one (CRC) represent a typical data link frame. The octets following the first 4 octets represent information about types and memory layout of C variables which are interpreted by the decoder in sdtmt.
There is no exception: The format of the information stored in <infile> or <outfile> is exactly the same as the format of the Cmicro Protocol. So, these files are using the memory layout of the target system.
The reason for this is, that binary files are always more compact than readable ASCII files.
The message decoder of the host must be active only when information are to be converted, for example, if they are to be displayed. That can decrease the performance a little.
/****************************************************** ** Symbol trace table ******************************************************/ #ifdef XMK_ADD_TEST_OPTIONS XSYMTRACETBL *xSYMTRACETBL[MAX_SDL_PROCESS_TYPES+1] = { (XSYMTRACETBL_ENTRY *) NULL, ........... .......... (XSYMTRACETBL_ENTRY *) NULL, X_END_SYMTRACE_TABLE }; #endif
description : description expression | /* NULL */ expression : ProcessDescr | SignalDescr | StateDescr; ProcessDescr : BEGIN_PROCESSES ProcessList END_PROCESSES SignalDescr : BEGIN_SIGNALS SignalList END_SIGNALS StateDescr : BEGIN_STATES StateList END_STATES ProcessList : ProcessListElem | ProcessListElem ProcessList SignalList : SignalListElem | SignalListElem SignalList StateList : StateListElem | StateListElem StateList ProcessListElem : PROCESS '(' PROCESS_NAME ',' PROCESS_TYPE_ID ',' MAXINST ')' SignalListElem : SIGNAL '(' SIGNAL_NAME ',' SIGNAL_C_NAME ',' SIGNAL_ID ')' | TIMER '(' SIGNAL_NAME ',' SIGNAL_C_NAME ',' SIGNAL_ID ')' StateListElem : STATE '(' PROCESS_TYPE_ID_ST ',' STATE_NAME ',' STATE_ID ')' PROCESS_NAME : CHARSTRING PROCESS_TYPE_ID : DECIMAL PROCESS_TYPE_ID_ST : DECIMAL MAXINST : DECIMAL SIGNAL_NAME : CHARSTRING SIGNAL_C_NAME : C_NAME SIGNAL_ID : DECIMAL STATE_NAME : CHARSTRING STATE_ID : DECIMAL DECIMAL : [0-9]+ C_NAME : [a-zA-Z_]+ CHARSTRING : "\".*\"" Example 376 : Generation for "AccessControl": /* File generated for system AccessControl */ BEGIN_PROCESSES PROCESS ("Central", 0, 1) PROCESS ("PanelController", 1, 1) PROCESS ("DoorController", 2, 4) PROCESS ("DoorMonitor", 3, 1) PROCESS ("Controller", 4, 1) END_PROCESSES BEGIN_SIGNALS TIMER ("MyTimer", MyTimer, 1) TIMER ("PanelTimer", PanelTimer, 2) TIMER ("DoorTimer", DoorTimer, 3) TIMER ("MyTimer", MyTimer, 4) SIGNAL ("Allocate", Allocate, 5) SIGNAL ("Doornb", Doornb, 6) SIGNAL ("Allocated", Allocated, 7) SIGNAL ("NotAllocated", NotAllocated, 8) SIGNAL ("Code", Code, 9) SIGNAL ("PrefDoor", PrefDoor, 10) SIGNAL ("Abort", Abort, 11) SIGNAL ("Opened", Opened, 12) SIGNAL ("Open", Open, 13) SIGNAL ("Close", Close, 14) SIGNAL ("Display", Display, 15) SIGNAL ("Card", Card, 16) SIGNAL ("KeyStroke", KeyStroke, 17) SIGNAL ("CardAndCode", CardAndCode, 18) SIGNAL ("Ok", Ok, 19) SIGNAL ("NotOk", NotOk, 20) SIGNAL ("Registered", Registered, 21) SIGNAL ("NotRegistered", NotRegistered, 22) SIGNAL ("StartRegister", StartRegister, 23) END_SIGNALS BEGIN_STATES STATE (0, "Idle", 1) STATE (0, "WaitRegister", 2) STATE (1, "Idle", 1) STATE (1, "WaitDisplay", 2) STATE (1, "WaitKeyStroke", 3) STATE (1, "WaitOk", 4) STATE (1, "WaitSelectDoor", 5) STATE (1, "WaitOpened", 6) STATE (2, "WaitDoorTimer", 1) STATE (2, "created", 2) STATE (2, "Idle", 3) STATE (3, "Idle", 1) STATE (4, "WaitAllocated", 1) STATE (4, "Idle", 2) STATE (4, "WaitCode", 3) STATE (4, "WaitCentral", 4) STATE (4, "WaitPrefDoor", 5) STATE (4, "WaitOpened", 6) END_STATES
The following three SDL objects are treated:
That's why the amount of stored information is to be kept very small. Of course, this leads to the problem, that not all types of errors can be found with the Cmicro Recorder, but there is a good chance to find most of them. The information, which the Cmicro Recorder produces at target side, and which the Cmicro Recorder uses at host side, cannot be configured in their dimension. The packets, which are to be transmitted via the communications link, are always the same. During the next subsections, a technical description follows.
These are special events for the Cmicro Recorder.
In that case, the Cmicro Recorder at the target side sends the following messages to the host:
Host <-------- <Counter value> ------------ Target Host <-------- <Event> -------------------- TargetBoth messages are stored in the <outfile> on the host.
The counter is reset to zero again and the procedure restarts by counting the "counted" symbols and sending the above messages to the host, either when an environment signal is sent from the environment to a process in the SDL system, or until the first timer expires within the SDL system.
The <outfile> is closed, when the user terminates the record mode on the host side, i.e. it is not possible to close the file by ending the record mode on the target side. The record mode can be finished at any time.
After the record mode has been switched off, it is not allowed to switch the record mode or the play mode on again.
The <outfile> on the host now contains messages like this:
<trace event 1> .... <trace event N> <Counter value> <Event> <trace event N+1> .... <trace event N+1+M> <Counter value> <Event>As you can see, the following sections are stored in the file, whereas each section is optional:
For all events in the target [Store trace section] [Store Counter value section] [Store Event section]
------------------------------------------------------- STATE The SDL nextstate operation INPUT The SDL input operation SAVE The SDL save operation CREATE The SDL create operation STOP The SDL stop operation STATIC CREATE Used at system start, appears for each statically created pro cess DYNAMIC CREATE Used at start of a dynamically created process DECISION SDL decision TASK SDL task (not C Code) OUTPUT The SDL output operation (see remarks below) PROCEDURE SDL procedure call SET SDL action: Set timer RESET SDL action: Reset timer DISCARD SDL Discard. IMPLICIT CONSUMPTION - SDL implicit transition -------------------------------------------------------A special case is the SDL output operation:
If the output is done from one process in the SDL system to another process in the SDL system, or, if the output is from one SDL process in the SDL system to the environment, the occurrence of this symbol is counted.
Else, if the output is from the environment to a process within the SDL system, this is a special event for the Cmicro Recorder like the timer expiry is.
C code in an SDL task is normally not counted when recording. The users are free to count C code by calling:
xmk_Record (CMD_TTASK) for the record mode and
C code written into an SDL Task (i.e. by using the #CODE directive)
xmk_Play (CMD_TTASK) for the play mode.
---------------------------------------------------------------- Caution! No environment signals may be handled by the user in the C func tion xInEnv! At the beginning of xInEnv, there should be a state ment like if (xmk_RecorderMode == XMK_RECORDER_PLAY) return (XMK_OKAY)); In addition, no signal may be sent by any other environment func tion (like ISR's) to the SDL system. ----------------------------------------------------------------At the beginning of the play mode, the host reads the first <counter value> from the <infile> and sends it to the target.
Host -------- <Counter value> ---------------> TargetThe meaning of this is: Please execute the amount of "counted" symbols as indicated in the <counter value>. The target executes the start transitions of all statically created processes (startup-phase). When preemption is used, it might be the case, that a transition, which is not a start transition, is executed. Each "counted" symbol increments a counter value which is compared against the debit, which was indicated by <counter value>.
If the current counter value reaches the debit counter value, then an environment signal (or timer expiry) plus the next <counter value> is requested by the Cmicro Recorder.
Host <------- <Request> ---------------------- Target Host ---------------- <Event> ---------------> Target Host -------- <Counter value> ---------------> TargetIf the target has requested the next <Event> and <Counter value>, the target is waiting for these messages only and is not able to handle other messages. This is not a restriction, because the environment is disabled in play mode in the target.
If the end of file of <infile> has been reached, the host indicates the end of the play mode to the target. <Counter value> and <event> are always stored together in record mode. So, the end of file can only be reached after reading an EnvSig or Timer expiry an
Host -------- <Play mode off> ---------------> Target---------------------------------------------------------------- Note: After the play mode has been switched off, it is not allowed to switch the record mode or the play mode on again. ----------------------------------------------------------------
Firstly, you have to ensure to use the same configurations for hardware and software, in order to allow the comparison between the results of a recorded session with the ones of the replayed session. That is only a general recommendation. Possibly you even would like to compare two different hardware configurations, and the Cmicro Recorder is supposed to help you finding the differences between these. As a more general recommendation we could say: You should compare only those configurations, from which you know, that they are comparable.
Secondly, starting and ending the record and the play mode must be as described. Host and target are to be synchronized. In the default solution, which we show here, the synchronization is performed by the low level protocol with XON / XOFF: Both sides, host and target, do not send any information, before they have received an XON character.
Therefore, sdtmt should be started first.
If the target is started (e.g. reset-button), it has to wait on sdtmt, before transmitting information. It depends on the implementation within the target, what you have to do now:
Therefore, sdtmt should be started first.
If the target is started (e.g. reset-button), it has to wait for sdtmt, before transmitting information. It depends on the implementation within the target, what you have to do now:
Internally, a timestamp is stored for each environment signal, which is compared within the target with the current value of SDL now. SDL now- and therefore the timestamps in the signals are calculated with the value 0 from system reset on. The target generates the now values in any case.
Of course, the processing power of host and target together must be large enough, in order to handle this. As a rule of thumb, the recorded environment signals may not be sent to the SDL system more often than one per a few hundred microseconds. But that - of course - also depends on the communications link in use.
This means, that the play mode may produce another system behavior than the recorded one.
The only alternative to implement an exact reproduction of the recorded session would be the use of a special debugger hardware, which is not possible as a general solution from our point of view.
It is mainly used internally by the Cmicro Tester to write and read trace information into/from a first in-first out buffer within the RAM.
The functions are also free for users.
Three functions are implemented representing the low level functions. Each entry has to be of the same size, because the handling is in principle similar to an array. The type of each entry is not relevant. In addition, the caller of the functions contained in this module defines the memory for the trace buffer as well as a control structure representing all the internal data and variables necessary to administrate the trace buffer.
As a result, users are free to have more than 1 instance of this buffer type.
Some functions are compiled, too if sdtmt is built without any communications interface.
Some functions are compiled also, if a sdtmt is linked without any communications interface.
This page intentionally left blank