swiflash - command line tool (linux host)

Apr 25, 2018 - Author: Sierra Wireless - Version 4.6 - 12292 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/swiflash/swiflash_latest.deb -O /tmp/swiflash_latest.deb
sudo apt-get install /tmp/swiflash_latest.deb

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)


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 the following modules: ar768x

-m "<module>" Specifies the target module type.
Allowed values are: ar86, ar7, ar758x, wp85, wp750x, wp76xx, wp77xx, fx30_wp85

-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 "wp85" -r

Download reference device image on a Legato device

swiflash -m "wp85" -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

©2018 Sierra Wireless. All rights reserved.
You have been successfully unsubscribed to this product. To access your subscription click here.