Package: mbed-flasher
# mbed-flasher## Descriptionmbed-flasher is a simple Python-based tool for flashing single or multiple boards.It provides a simple Command Line Interface and Python API for flashing.The purpose is to provide a clean and simple library that is easy to integrate to other tools.It can be easily developed further to support flashing in mbed OS and other platforms.Developers can also use it as a standalone tool for flashing their development boards.## InstallationTo install the flasher, use:`python setup.py install`To install the flasher in development mode:`python setup.py develop`To use JLink flashing, additional package needs to be installed from [here](https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack).JLinkExe must be found from PATH for flasher to be able to use it.To use STLink flashing (windows only), additional package needs to be installed from [here](https://www.st.com/en/development-tools/stsw-link004.html#sw-tools-scroll).`ST-LINK_CLI.exe` must be found from PATH for flasher to be able to use it.## UsageThis tool has been tested and verified to work with Windows 7 and Ubuntu (14.04 LTS) Linux.Devices used in verification: NXP K64F, Nucleo F401RE, BBC micro:bit.See the actual usage documentation [here](doc/usage.md).## Help**Main help**```/> mbedflash --helpusage: mbedflash [-h] [-v] [-s] <command> ...For specific command help, run: mbedflash <command> --helpoptional arguments:-h, --help     show this help message and exit-v, --verbose  Verbose level... repeat up to three times.-s, --silent   Silent - only errors will be printed.command:<command>      command helplist         Prints a list of supported platforms.flashers     Prints a list of supported flashers.version      Display version informationflash        Flash given resourcereset        Reset given resourceerase        Erase given resource```**Flash help**```/>mbedflash flash --helpusage: mbedflash flash [-h] [-i INPUT] [--tid TARGET_ID] [-t PLATFORM_NAME][--no-reset][method]positional arguments:method                <simple|pyocd|edbg>, used for flashingoptional arguments:-h, --help            show this help message and exit-i INPUT, --input INPUTBinary input to be flashed.--tid TARGET_ID, --target_id TARGET_IDTarget to be flashed, ALL will flash all connecteddevices with given platform-name, also multipletargets can be given. Does not continue flashingnext device in case of failures. Short target_idmatches boards by prefix--target_filename TARGET_FILENAMECustom target filename-t PLATFORM_NAME, --platform_name PLATFORM_NAMEPlatform of the target device(s)--no-reset            Do not reset device before or after flashing````--target_filename TARGET_FILENAME` -option is used to select customtarget filename when source file is copied to mbed targete.g.```$ mbedflash flash simple --tid 0240000032254e45000f800ab529001f3f31000097969900 -i setup.hex --target_filename asd.hex```input file in above example would be `setup.hex`, that must exists and filenamethat is created for target mount point would be `asd.hex`.**Erase help**```c:\>mbedflash erase --helpusage: mbedflash erase [-h] [--tid TARGET_ID] [method]positional arguments:method                <simple|pyocd|edbg>, used for eraseoptional arguments:-h, --help            show this help message and exit--tid TARGET_ID, --target_id TARGET_IDTarget to be erased or ALL, also multiple targets canbe given. Short target_id matches boards by prefix```**Reset help**```c:\>mbedflash reset --helpusage: mbedflash reset [-h] [--tid TARGET_ID] [method]positional arguments:method                <simple|pyocd|edbg>, used for resetoptional arguments:-h, --help            show this help message and exit--tid TARGET_ID, --target_id TARGET_IDTarget to be reset or ALL, also multiple targets canbe given. Short target_id matches boards by prefix```## Running unit testsRequired pre-installed packages: coverage, mock```sudo pip install coverage mock```Execute all tests:```coverage run -m unittest discover -s test```Execute hardware tests:```coverage run -m unittest discover -s test.hardware```Execute non-hardware tests:```coverage run -m unittest discover -s test.non_hardware```Generate a coverage report:```coverage html```## Creating the installer**For Windows:**```python setup.py buildpython setup.py bdist_msi```**For Linux:**```python setup.py build//for rpm packagepython setup.py bdist_rpm```Read [more on installers](https://docs.python.org/2/distutils/builtdist.html).