vdudouyt / stm8flash

program your stm8 devices with SWIM/stlinkv(1,2)
GNU General Public License v2.0
404 stars 183 forks source link

Add support for STLink-V3 and STLink V2.1 #115

Closed martonmiklos closed 6 years ago

martonmiklos commented 6 years ago

Add support for the STLinkV3. This device uses the same protocol as the STLinkV2 just uses a different endpoint.

The STLink V2.1 can be found on newer Nucleo boards, it uses the same endpoint as the STLinkV3.

Many thanks to Antonio Borneo (who contributed the STLinkV3 support to the OpenOCD) for the help and hints!

Tested by reading and writing a STM8S003F3 board.

Fixes #90

spth commented 6 years ago

Thanks for implementing this. I have a few remaining questions:

1) Could you indicate if you agree to the GPLv2 -> GPLv2+ license change in the file LICENSE-CHANGE? 2) Antonio Borneo mentioned something about a "new command for version check" that stm8flash would need. Do we need it? If yes, where is it implemented? 3) I suggest to use the name "stlinkv21" in stead of "stlinkv2.1". ST documentation calls it "ST-LINK/V2-1", so stlinkv21 seems more consistent with the naming of the other variants. 4) I assume your test was done using STLINK-V3. I will test using ST-LINK/V2-1 later today today or on Tuesday.

Philipp

martonmiklos commented 6 years ago

Hello Phillipp

  1. I agree, where do I need to indicate this?

  2. I do not think that it is necessary for the stm8flash since the user explicitly specifies the programmer type. BTW. For long term I would recommend to adopt the code from OpenOCD. We could get rid from the magic constants, and we could have a single stlink programmer option with a single C file.

  3. Agree, commit ammended.

  4. Correct, I do not have any boards with ST-Link/V2-1 at hand so I would thank you for the testing.

spth commented 6 years ago
  1. You move the entry with your name from the the bottom list "Those that need to be contacted" to the top list "Authors that have agreed to change…".
  2. I just tested writing the flash on an STM8S208RB using an ST-LINK/V2-1. It worked.

Since the ST-LINK/V2-1 and STLINK-V3 are handled like the ST-LINK/V2, we should probably also change those lines in the README:

Support table
-------------

  * ST-Link V1: flash/eeprom/opt
  * ST-Link V2: flash2/eeprom2/opt2

to something like

Support table
-------------

  * flash/eeprom/opt: ST-LINK/V1
  * flash2/eeprom2/opt2: ST-LINK/V2, ST-LINK/V2-1 and STLINK-V3

Philipp

spth commented 6 years ago

Writing the flash of the STM8L152R8 via ST-LINK/V2-1 worked, too (you might want to add the ok entry in the README).

Philipp

martonmiklos commented 6 years ago

License change, README and the supported devices table updated.