pyocd / pyOCD

Open source Python library for programming and debugging Arm Cortex-M microcontrollers
https://pyocd.io
Apache License 2.0
1.1k stars 477 forks source link

Support for STM32U5 #1351

Closed daniel-merrick closed 2 years ago

daniel-merrick commented 2 years ago

Are there any plans to add support for STM32U5 NUCLEO boards?

https://www.st.com/en/evaluation-tools/nucleo-u575zi-q.html

flit commented 2 years ago

The STM32U5xx parts are supported via the Keil.STM32U5xx_DFP CMSIS-Pack unless there is a strong reason to have built-in support, like the Packs don't work. (CMSIS-Packs are the preferred way to add new targets unless there are barriers to doing so.)

Note that I haven't yet been able to test with a U5 since I don't have a board (yet).

daniel-merrick commented 2 years ago

Ah I see - So I download the Keil.STM32U5xx_DFP.1.1.1.pack from https://www.keil.com/dd2/pack/#!#eula-container then pass ''--pack=Keil.STM32U5xx_DFP.1.1.1.pack'' to the PYOCD command.

Thank you!

flit commented 2 years ago

Actually you can use pyocd pack install u575 to install the pack and not have to download it manually. This also makes the target types available without needing the --pack argument.

The target support documentation has all the details.

daniel-merrick commented 2 years ago

Installing like that doesn't seem to work properly: This is the error I receive

pyocd pack install u575
0000741 W No matching devices. Please make sure the pack index is up to date. [pack_cmd]
flit commented 2 years ago

That's odd. I just tried it again and it worked fine, even without have a pack index installed previously. I guess it's possible you have an out of date pack index from before the U5xx pack was added?

Please try adding -u or --update to the command line: pyocd pack install -u u575. This will ensure the pack index is up to date before checking (you'll get a bunch of warnings for XML formatted errors in the numerous packs).

You can also try: pyocd pack clean ; pyocd pack update, then run the install command. This will completely erase and re-download the pack index before attempting to install. (It should be more or less equivalent to the -u argument, but could fix an index that was somehow corrupted.)

daniel-merrick commented 2 years ago

The second method did seem to work however the first failed. Here are outputs of both in case others run into the same problem:

here is the output of the first try:

$ pyocd pack install -u u575
0000625 I Updating pack index... [pack_cmd]
17:01:44 [WARN] XML error: UTF8 error: invalid utf-8 sequence of 1 bytes from index 6
17:01:44 [WARN] XML error: UTF8 error: invalid utf-8 sequence of 1 bytes from index 6
17:01:45 [WARN] XML error: Only Comment, CDATA and DOCTYPE nodes can start with a '!'
17:01:45 [WARN] XML error: Only Comment, CDATA and DOCTYPE nodes can start with a '!'
17:01:46 [WARN] XML error: Expecting </link> found </head>
17:01:46 [WARN] No Core found!
17:01:47 [WARN] Device found without a processor ATSAME70J19
17:01:47 [WARN] Device found without a processor ATSAMS70J19
17:01:47 [WARN] Device found without a processor ATSAMV71J19
17:01:47 [WARN] Device found without a processor ATSAMV70J19
17:01:47 [WARN] XML error: Expecting </P> found </BODY>
17:01:47 [WARN] XML error: Expecting </P> found </BODY>
17:01:47 [WARN] XML error: Expecting </P> found </BODY>
17:01:47 [WARN] XML error: Expecting </P> found </BODY>
17:01:47 [WARN] XML error: Expecting </P> found </BODY>
17:01:47 [WARN] XML error: Expecting </P> found </BODY>
17:01:47 [WARN] XML error: Expecting </P> found </BODY>
17:01:47 [WARN] XML error: Expecting </P> found </BODY>
17:01:47 [WARN] XML error: Expecting </P> found </BODY>
17:01:47 [WARN] XML error: Expecting </P> found </BODY>
17:01:47 [WARN] XML error: Expecting </P> found </BODY>
17:01:47 [WARN] XML error: Expecting </P> found </BODY>
17:01:48 [WARN] XML error: Expecting </P> found </BODY>
17:01:48 [WARN] XML error: Expecting </P> found </BODY>
17:01:48 [WARN] XML error: Expecting </P> found </BODY>
17:01:48 [WARN] XML error: Expecting </P> found </BODY>
17:01:48 [WARN] XML error: Expecting </P> found </BODY>
17:01:48 [WARN] XML error: Expecting </P> found </BODY>
17:01:48 [WARN] XML error: Expecting </P> found </BODY>
17:01:49 [WARN] XML error: Expecting </P> found </BODY>
17:01:49 [WARN] XML error: Expecting </P> found </BODY>
17:01:49 [WARN] XML error: Expecting </P> found </BODY>
17:01:49 [WARN] XML error: Expecting </P> found </BODY>
17:01:49 [WARN] cannot parse integer from empty string
17:01:49 [WARN] cannot parse integer from empty string
17:01:49 [WARN] cannot parse integer from empty string
17:01:49 [WARN] cannot parse integer from empty string
17:01:49 [WARN] cannot parse integer from empty string
17:01:49 [WARN] cannot parse integer from empty string
17:01:49 [WARN] XML error: Expecting </P> found </BODY>
17:01:49 [WARN] XML error: Expecting </P> found </BODY>
17:01:49 [WARN] XML error: Expecting </P> found </BODY>

0023435 W No matching devices. Please make sure the pack index is up to date. [pack_cmd]

This is the output with the second try

$ pyocd pack clean
0000590 I Removing all pack data... [pack_cmd]

$ pyocd pack update
0000597 I Updating pack index... [pack_cmd]
17:04:06 [ERROR] download of "https://realtimelogic.com/downloads/arm-mdk-packs/RealTimeLogic.SharkSSL-Lite.pdsc" failed: https://realtimelogic.com/downloads/arm-mdk-packs/RealTimeLogic.SharkSSL-Lite.pdsc: error trying to connect: No such host is known. (os
error 11001)
17:04:06 [ERROR] download of "https://realtimelogic.com/downloads/arm-mdk-packs/RealTimeLogic.SMQ.pdsc" failed: https://realtimelogic.com/downloads/arm-mdk-packs/RealTimeLogic.SMQ.pdsc: error trying to connect: No such host is known. (os error 11001)
17:05:57 [WARN] XML error: Only Comment, CDATA and DOCTYPE nodes can start with a '!'
17:05:57 [WARN] XML error: UTF8 error: invalid utf-8 sequence of 1 bytes from index 6
17:05:57 [WARN] XML error: UTF8 error: invalid utf-8 sequence of 1 bytes from index 6
17:05:57 [WARN] XML error: Only Comment, CDATA and DOCTYPE nodes can start with a '!'
17:05:58 [WARN] XML error: Expecting </link> found </head>
17:05:58 [WARN] No Core found!
17:05:59 [WARN] Device found without a processor ATSAME70J19
17:05:59 [WARN] Device found without a processor ATSAMV71J19
17:05:59 [WARN] Device found without a processor ATSAMS70J19
17:05:59 [WARN] Device found without a processor ATSAMV70J19
17:05:59 [WARN] No Core found!
17:06:01 [WARN] No Core found!
17:06:01 [WARN] cannot parse integer from empty string
17:06:01 [WARN] cannot parse integer from empty string
17:06:01 [WARN] cannot parse integer from empty string
17:06:01 [WARN] cannot parse integer from empty string
17:06:01 [WARN] cannot parse integer from empty string
17:06:01 [WARN] cannot parse integer from empty string

pyocd pack install u575
Downloading packs (press Control-C to cancel):
    Keil.STM32U5xx_DFP.1.1.1
Downloading descriptors (001/001)

Thanks again!

flit commented 2 years ago

Very interesting! Thanks for trying and I'm glad it worked eventually…

One strange thing is that the warnings are different between the 2 pack updates, and also different from my own tests.