RadioOperator / CMSIS-DAP_for_STLINK-V3MINI

High-Speed CMSIS-DAP for STLINK-V3MINI ARM Debugger STM32F723IEK6
Apache License 2.0
178 stars 81 forks source link

CMSIS-DAP_for_STLINK-V3MINI compiled with IROM1 @ 0x08020000 #10

Closed buildxyz-git closed 1 year ago

buildxyz-git commented 2 years ago

Awesome project!

I'm building a utility which implements the ST USB DFU protocol and encryption, it can already flash YAB without issues. But when I flash YAB (@0x08020000) + slv3app1.bin (@0x08040000) it does not jump to the app and remains in YAB mode. I've also tried flashing slv3app1.bin directly to 0x08020000 over USB and it does work likely because the target IROM settings.

I cannot compile the project myself without a license though to resolve the issue. Would you be able to compile the The CMSIS apps to run at 0x08020000 and push them here?

RadioOperator commented 2 years ago

Hi, easy, new bin code attached, with:

  1. start address 0x08020000.
  2. update all software pack to latest.
  3. VCP uart part using DMA mode, if you have problem on VCP, please let me know
  4. not tested

Btw, your new DFU works with latest version stlink-v3-mini device? Thanks. slv3app1.zip

buildxyz-git commented 2 years ago

Awesome! Thanks so much!

You had me worried that ST made changes to the boot loader in the new version as I had not tested that yet. I have now using stsw-link007-v3.9.3 to update my probe to version V3J9M3 which is the latest. Still works.

I was starting to work on some ugly patches for YAB but this is so much better. This will install the slv3app1.bin (STLINKv3DAPv1_HID+VCP) automatically:

❯ stloader flash --dapv1
Probe successfully placed into Loader mode
  [------------------------------------]    0% Setting up device for flashing
  [####################################]  100%          
Flashing slv3app1.bin to 0x08020000
  [####################################]  100%          
Finishing up
  [####################################]  100%          
Flashing complete!
❯ dmesg
...
[166666.318629] usb 2-4.1: New USB device found, idVendor=0483, idProduct=572c, bcdDevice= 1.00
[166666.318632] usb 2-4.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[166666.318634] usb 2-4.1: Product: HighSpeed-HID CMSIS-DAP
[166666.318635] usb 2-4.1: Manufacturer: RadioOperator
[166666.318636] usb 2-4.1: SerialNumber: 0001A0000000
...

The tool will be uploaded to pypi and install with a simple pip command. you can also use it to restore the ST factory firmware or install YAB. It can also encrypt/decrypt arbitrary files using the hardcoded bootloader AES keys.

Do you know a good resource which details all the differences between dapv1 vs dapv2 and also all the features like VCP, HID, WinUSB, and mass storage and why someone my want to install one over the other? I think this would be helpful documentation.

Also, if you can compile the rest of the apps with the same settings, I will integrate them as options in the stloader tool with their own command switches:

STLINKv3DAPv1_HID+VCP -------- PID 0x572C
STLINKv3DAPv2_WinUSB+VCP --- PID 0x572D
STLINKv3DAPv2_WinUSB ---------- PID 0x572E
STLINKv3DAP_v1+v2 -------------- PID 0x572F
buildxyz-git commented 2 years ago

Though STLINKv3DAPv1_HID+VCP doesn't seem to work with pyOCD:

 self._has_swo_uart = (self._capabilities & Capabilities.SWO_UART) != 0
TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'

I 'm wondering if it does not advertise it's cablities properly or as pyOCD expects here?

RadioOperator commented 2 years ago

I do not know what INFOs expected by pyOCD SWO function, my cmsis-dap code from ARM official many years and ok on other IDEs. If you know how to change my code to meet pyOCD requirement, please tell me. Or maybe you patch pyOCD to do right.

Attached is the code, not tested. STLINKv3DAP_08020000.zip