ARMmbed / mbed-flasher

mbed device flasher application
Other
10 stars 10 forks source link

API update request #21

Closed jupe closed 8 years ago

jupe commented 8 years ago

Python API:

flasher.FLASHERS -->

>>> flasher.get_available_flashers()
['mbed', 'atmel']`

new:

>>> flasher.get_flasher('mbed')
<class 'FlasherMbed'>

flasher.SUPPORTED_TARGETS -->

>>> flasher.get_supported_targets(flasher=None) //optional only defined flasher
['NRF51822', 'K64F',..]

Flashing a single device

>>> flasher.flash(build="C:\\path_to_file\\myfile.bin", target_id="0240000028884e450019700f6bf0000f8021000097969900", platform_name="K64F")

optional

If all required fields are available do not call mbedls at all (possible to use without mbedls)

Flashing all devices by platform

>>> flasher.flash(build="C:\\path_to_file\\myfile.bin", platform_name="K64F")
Going to flash following devices:
0240000028884e450019700f6bf0000f8021000097969900
0240000028884e450031700f6bf000118021000097969900

-->

>>> flasher.flash(build="C:\\path_to_file\\myfile.bin", target_id="all", platform_name="K64F")
Going to flash following devices:
0240000028884e450019700f6bf0000f8021000097969900
0240000028884e450031700f6bf000118021000097969900

Flashing a device using pyOCD

>>> flasher.flash(build="C:\\path_to_file\\myfile.bin", target_id="0240000028884e450019700f6bf0000f8021000097969900", platform_name="K64F", pyocd=True)

-->

>>> flasher.flash(build="C:\\path_to_file\\myfile.bin", target_id="0240000028884e450019700f6bf0000f8021000097969900", platform_name="K64F", method="pyocd")

Command Line Interface

Command format:

>mbedflash <operation> {arguments}
operations: 
"flash"
  <--tid target_id|all> (--method pyocd|simple) <file> 
"reset"
  <--tid target_id|all> (--method pyocd|serial)
"erase"
  <--tid target_id|all> (--method pyocd|simple)

(Roman: edited the interface a little bit)

Flashing a single device

C:\>mbedflash flash c:\path_to_file\myfile.bin --tid 0240000028884e450019700f6bf0000f8021000097969900 -t K64F
C:\Temp>

**optional -t K64F

Flashing a device using pyOCD

C:\>mbedflash flash C:\path_to_file\myfile.bin --tid 0240000033514e45003f500585d4000ae981000097969900 -t K64F --pyocd
--method pyocd

New:

reset

erase

VeliMattiLahtela commented 8 years ago

@RomanSaveljev could you also take a look?

VeliMattiLahtela commented 8 years ago
>mbedflash <operation> {arguments}
operations: 
"flash"
  <--tid target_id|all> (--method pyocd|simple) <file> 
"reset"
  <--tid target_id|all> (--method pyocd|serial)
"erase"
  <--tid target_id|all> (--method pyocd|simple)

Should we have platform somewhere ?

RomanSaveljev commented 8 years ago

@VeliMattiLahtela yes, lets keep the old interface as close as possible to what it is

But, if there was no legacy, then I would say it is more important to support multiple --tid as it is the lowest common denominator for all kinds of filtering.

Different tool exists for discovering devices and it does it well. "One tool should do one thing and do it well"