Skip to main content
Firmware Stable

SWTools, changes between SWTools 3.x and 4.0

The goal of SWTools 4.0 is to be multiplatform.

The main changes are in configuration and installation. Main application names and their usage are kept.

Briefly, the main changes are:

  • CLI application for firmware update is renamed from srm to bl_srm.

  • Configuration file and environment variables are used instead of Windows Registry. All parameters are set with configuration files and command line parameters.

  • Installation structure was reworked. All application executables are in one folder.

  • Interface libraries for communication with devices are renamed; usually only the name is needed to select one. (A full path is also possible, but is needed only for advanced usage.)

  • Applications support long options; short options are kept for compatibility.

  • All main tools use the same command line parameters to define communication with devices, and tools launched from another tool use the same configuration.

  • CLI and GUI applications have different default working folders. CLI applications use the current folder.

  • launchpad was reworked, and a new GUI application (SRM Device Updater) was created to update device firmware.

  • Return values of CLI applications are changed to be small positive numbers for errors, and zero for success. Negative return values are not used anymore. (This is important for scripts.)

  • Internally, UTF-8 is used for file names and paths.

  • Minor changes in some parameters in yosctl, mainly dash '-' is used instead of file name if stdin or stdout is wanted.

  • Protocol configuration file format and location is changed.

Configuration

SWTools configuration is set with configuration files, environment variables and command line parameters. The configuration file has the lowest priority, and command line parameters have the highest priority. All tools started from another tool start with the same configuration as the parent tool.

The configuration file is searched for in several paths. Only the first one is used. The searched paths are displayed if the debug level is 5 or greater. Another configuration file can be specified by the --config-file parameter; it can be set with a path (absolute or relative) or only a name (then it is searched in the same paths as the main configuration file). The searched paths are: current folder (only for CLI applications), user home folder for configuration files, SWTools installation folder.

The configuration file can be created and modified with the GUI launchpad in "Options..." dialog; use "Advanced" for more options. To manually edit the configuration file, use the distributed one as a template; it is self-documenting.

Working folder

The default for GUI applications is the "silixcon" folder in user documents; it can be changed in the configuration file. The default for CLI applications is the current folder.

Notes for CLI applications

CLI applications search for the configuration file in the current folder first, you can create multiple folders with different configuration files for different projects.

To temporarily change configuration for the current session, use swtset. It can set and display environment variables for the current session. (On Windows only CMD is supported. On other platforms swtset is an alias and should be created by calling swtools_setup_shell.sh, usually in .profile.)

A fully configured terminal is also possible through the launchpad "Command prompt"/"Terminal" button; it opens a terminal emulator (Command Prompt on Windows) with the same configuration as launchpad has and also sets PATH and environment variables for SWTools.

Interface libraries

Interface libraries are platform specific libraries for communication with devices. Platforms and supported interfaces are:

  • Windows: bt, kvaser, msg_dmsg, msg_fwd, pcan, serial, udp, usb.
  • macOS: serial, usb.
  • Linux: serial, sckcan, usb.

USB

USB interface uses libusb-1.0 library.

warning

USB driver in SWTools 4.0 is different and incompatible with the previous SWTools 3.x USB interface! During installation of SWTools 4.0 on Windows, the old driver is always removed.

Examples

Example 1

To show all configuration parameters really used with applications without a device connection, use:

$ yosctl -z5 if info

Example 2

All variants to select USB interface library, and target address 1, for term application:

  • Edit swtools.ini (default configuration file) in current folder. Good for permanent configuration. Minimal content to set interface and target address is:
[general]
if_name = "usb"

[if.usb]
target_address = "1"
$ # And run term without parameters, it will use configuration file in current folder.
$ term
  • Set environment variables, good for temporary configuration for the current session:
$ swtset --interface-name usb --target-address 1
$ # And run term without parameters, it will use environment variables for configuration.
$ term
  • Long options, good for temporary configuration for the current session, and for scripts. (Short options are also supported, but long options are clearer and better for scripts.):
$ # Long options
$ term --interface-name usb --target-address 1
  • Short options:
$ # Short options
$ term -i usb -a 1