===============
Firmware Update
===============

The Polaris firmware can be updated on ground using the provided Satlab JTAG/serial adapater. The update procedure requires a Linux development machine and OpenOCD version 0.10.0 or later, which can be installed from http://openocd.org/ or most distribution package managers. Please ensure that the ``udev`` permissions are also configured as described in :ref:`starting`. 

Firmware packages are distributed as a ``tar.xz`` archive. The package includes a script, ``flash.py``, which wraps the OpenOCD commands and flashes the board:

.. NOTE::
   For on-orbit updates, please see the :ref:`btp` and :ref:`polaris-adsb-bootloader` section.

.. code-block:: none

    satlab@satlab:~$ tar xvf polaris-adsb-v1.0.0.tar.xz
    polaris-adsb-v1.0.0/satlab-jtag.cfg
    polaris-adsb-v1.0.0/flash.py
    polaris-adsb-v1.0.0/polaris-adsb-v1.0.0.bin
    satlab@satlab:~$ cd polaris-adsb-v1.0.0
    satlab@satlab:~/polaris-adsb-v1.0.0$ ./flash.py polaris-adsb-v1.0.0.bin
    [+] Satlab firmware flash tool v1.1.0
    [+] Calling OpenOCD to flash polaris-adsb-v1.0.0.bin:
    [+] Succesfully flashed the firmare to the board
