RUNSVF
The RUNSVF function is used to execute an SVF file and return the result. After execution of the SVF file, the JTAG chain is left undisturbed until XJTAG next accesses the JTAG chain.
The RUNSVF function cannot be used inside either a HOLDOFF block or a raw JTAG block.
N.B. XJTAG does not support PIOMAP or PIO commands in SVF files - these commands will be ignored.
The third parameter, options, can be omitted, but doing so is deprecated. A warning will be emitted and this ability will be removed in a future version.
Syntax
RUNSVF( STRING filename, STRING devices, INT options )
Parameters
- filename
- The filename of the SVF file to run.
- devices
- The devices on which the SVF file will operate. Other devices in the chain will be held in BYPASS. See Syntax of devices below.
- options
- Specifies how XJTAG should handle a change in TCK frequency and what will happen when the SVF file completes. See Options argument below.
Return value
An INT value containing the exit code from running the STAPL file. The possible values are:
Value | Meaning |
---|---|
0 | The file was executed successfully. |
1 | The file ran unsuccessfully; an error message with more information is printed to the output. |
2 | The file was unable to be opened or contained syntax errors; an error message with more information is printed to the output. |
Syntax of devices
SVF files can be generated for a single device, or can be generated to take into account other devices in the chain, typically putting the unused devices into BYPASS. The devices for which the SVF file has been generated therefore need to be specified. Devices must be consecutive in the JTAG chain, but can be specified in any order.
[boardName1.]deviceName1..[boardName2.]deviceName2 or [boardName1.]deviceName1[,[boardNameN.]deviceNameN]
boardName is necessary if you have more than one device with the same name (e.g. IC1), on different boards. Otherwise, it is optional.
If any of the devices are multicore devices then the name of the core must be specified as well:
[boardName.]deviceName.coreName
If the device range is constant, it will be checked at compile-time and if there is a syntax error or if any of the devices are not found or are ambiguous, an error is generated. However, if the string is not a constant (i.e. it is constructed from other arguments) it may not be possible to verify it at compile-time; instead an error will be displayed when the function is run and code execution will stop.
Options argument
There are two options available when running an SVF file:
- SVF_AUTOSKEW
SVF_AUTOSKEW controls what happens when the SVF file requests a change of the TCK frequency. The data in the JTAG chain can have an offset from the clock which is known as skew and is particularly likely when a long cable is used to connect to the target board. The XJTAG system normally compensates for this by applying an adjustment known as AutoSkew. However, this automatic adjustment can affect the running of a SVF file and therefore the user has the ability to enable or disable the AutoSkew procedure. AutoSkew can be enabled by specifying SVF_AUTOSKEW as the final parameter.
Whenever the AutoSkew procedure is applied, the skew value for the TCK frequency is recorded. Next time that TCK frequency is selected, the XJTAG system does not have to carry out the AutoSkew procedure and instead can apply the stored skew value. If an SVF file changes the TCK frequency and the AutoSkew procedure needs to be applied (because of a long cable for example) but this interferes with running of the SVF file, the user can run the AutoSkew procedure by selecting the required TCK frequency before running the SVF file (using SETFREQ). The user can then specify SVF_AUTOSKEW and the stored skew value will be used without interfering with the running of the SVF file.
- SVF_RESET
- SVF_RESET controls what happens when the SVF file has finished. When an SVF file is running, it is accessing the JTAG chain directly and can be used to configure devices in the JTAG chain. When the SVF file completes, the XJTAG system can either leave the JTAG devices as configured by the SVF or reset them using either a TMS reset or a reset sequence. This is controlled by the SVF_RESET option. Including SVF_RESET in the final parameter will reset the JTAG devices and restore the TCK frequency. The reset will not occur until the next JTAG access after the SVF file has completed.
If both options are required, then OR them together. If neither option is required then pass in a zero. It is possible to omit the options entirely, which is the same as passing in both of them, but this is deprecated and will be removed in a future version.
Example
GLOBAL RunSvfProgrammingFile()(INT result) CONST STRING svfFile := "programming.svf"; PRINT("Programming SVF File: ", svfFile, "\n"); result := RUNSVF(svfFile, "IC2..IC3", SVF_AUTOSKEW | SVF_RESET); IF result != 0 THEN PRINT("SVF Programming failed.\n"); ELSE PRINT("SVF Programming complete.\n"); END; END;
This will run the SVF file on all devices in the JTAG chain from IC2 to IC3. AutoSkew and reset are both enabled. Other devices in the chain will be held in BYPASS.
XJTAG v4.1.100