swiflash - command line tool (linux host)

Aug 16, 2017 - Author: Sierra Wireless - Version 4.0.8 - 7212 Views

swiflash - command line

swiflash allows to flash images into WP/AR products through USB port. This is a recovery tool that can be used even if the device is not booting anymore. This tool is platform specific (only for WP/AR Series).


Ubuntu/Debian Distributions

Follow these instructions for Ubuntu/Debian distributions

wget http://updatesite.sierrawireless.com/legato-spm/debian/legato-spm.list -O - | sudo tee /etc/apt/sources.list.d/legato-spm.list
wget http://updatesite.sierrawireless.com/legato-spm/debian/legato-spm.key -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install swiflash

Alternate Distributions

  • Download swiflash tool archive from this link
  • Extract the archive to the location of your choice (e.g. unzip swiflash.zip -d $HOME/legato/swiflash)
  • Potentially add this location to your user's path (e.g. echo 'export PATH=$HOME/legato/swiflash:$PATH' >> $HOME/.bashrc)

Packages installed with Developer Studio or legato-spm

If you have installed Legato Application Development Kit with Developer Studio or legato-spm, swiflash is already installed, and can be invoked with $WP85_RECOVERY/swiflash comand from your build shell.


This is a recovery tool, that can be used to flash images even if the device is not booting anymore (because of corrupted configurations files in the root FS, badly customized Linux kernel or Legato framework, or whatever...).

Switching the module into bootloader mode (if necessary)

Most of times, the tool can be used without having to do any hardware manipulation, as soon as the DM USB port (download port) is available.
However, sometimes the module may be in a unrecoverable state (no DM port); in such cases, the module shall be switched in bootloader mode before the flashing operation.

Please follow these steps to switch your module in bootloader mode:

  • Use one of the following methods to toggle the bootloader mode:

    • Either toggle the TP1 pin to LOW or OFF position
      Please refer to your product PTS to know where this pin is connected
      (on mangOH boards, this is switch number 7)
      Then reboot the module

    • Or use the AT!BOOTHOLD AT command (this will perform a module reset).
      You can access to AT commands from the device Linux shell (UART or SSH) by using the microcom -E /dev/ttyAT command
  • Plug the device USB cable

  • Check that a /dev/ttyUSBX serial port is mounted on your system: this will be the DM port, necessary to handle the download.
Then you will be able to execute the swiflash command (see below).

Note: if you used the hardware switch to enter bootloader mode, you'll have to switch back to HIGH or ON position once the download is started.

Preliminary checks

On Linux, swiflash requires a udev rule to be installed on the system in order to run correctly. This rule:
  • provides read access to Legato device USB ports
  • blacklists Legato device from Modem Manager service (to prevent the Modem Manager to disturb the download process)
The rule is automatically installed from the Debian package, but it can be also installed manually (e.g. when installation is done from a zip archive):
sudo cp $ROOT/99-sierrawireless-modem.rules /etc/udev/rules.d
sudo service udev restart
(Assuming that $ROOT is the location where swiflash was installed)
Then, if your device is already plugged through USB, you will need to power cycle it.

The tool verifies the rule is present before running. Anyway, this check can be disabled by using the --force option.

Command options

Run swiflash --help for complete usage details.

swiflash [OPTION] -m "<module>" -i <image>
swiflash [OPTION] -m "<module>" -r


-i <image> Uses the provided image file (cwe or spk file) to flash the device

-r Restore the Linux root filesystem in its original state by erasing the USER1 partition (all filesystem updates will be lost)

Note: This option is not supported on WP76XX modules.

-m "<module>" Specifies the target module type.
Allowed values are: AR865X, AR755X, WP85XX, WP750X, WP76XX, FX30(WP85XX)

-f,--force Bypass preliminary checks for dialout group and ModemManager service, and launch the download anyway (see above)

-h,--help Display this message

Example commands

Reset user partition on a Legato device

swiflash -m "WP85XX" -r

Download reference device image on a Legato device

swiflash -m "WP85XX" -i $WP85_DEVICE_IMAGE/image.spk
where image.spk is the image to be used, according to your customer configuration

Related items

Legato Application Development Kit - Linux

Installation procedures for Linux host to develop Legato Applications.

swicwe - command line tool (linux host)

Create one single firmware image from several unitary components for WP/AR modules

©2017 Sierra Wireless. All rights reserved.
Get updates on this product
You have been successfully subscribed to this product. To access your subscription click here.
You have been successfully unsubscribed to this product. To access your subscription click here.