Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMSIS Pack for STM32F7/H7 broken? #727

Closed
Funky185540 opened this issue Sep 12, 2019 · 8 comments
Closed

CMSIS Pack for STM32F7/H7 broken? #727

Funky185540 opened this issue Sep 12, 2019 · 8 comments

Comments

@Funky185540
Copy link

Hi there,

I'm not sure if this is the right place to post this (guess so from reading the docs ) but I suspect that currently the CMSIS packs for the STM32F7 and STM32H7 aren't functional.

Here's the output of pyocd pack -u:

> pyocd pack -u
0000419:INFO:__main__:Updating pack index...
Sep 12 09:18:27.751 ERRO download of "https://www.keil.com/pack/Keil.STM32H7xx_DFP.pdsc" failed: unexpected end of file
Sep 12 09:18:27.771 ERRO download of "https://www.keil.com/pack/Keil.STM32G0xx_DFP.pdsc" failed: unexpected end of file
Sep 12 09:18:27.771 ERRO download of "https://www.keil.com/pack/Keil.STM32F7xx_DFP.pdsc" failed: unexpected end of file
Sep 12 09:18:28.351 WARN expecting </META> found </HEAD>
Sep 12 09:18:29.506 ERRO when trying to parse component: child element "description" not found in "component" element, Package: nRF_DeviceFamilyPack, Vendor: NordicSemiconductor
Sep 12 09:18:29.516 ERRO when trying to parse component: child element "description" not found in "component" element, Package: nRF_DeviceFamilyPack, Vendor: NordicSemiconductor
Sep 12 09:18:29.516 ERRO when trying to parse component: child element "description" not found in "component" element, Package: nRF_DeviceFamilyPack, Vendor: NordicSemiconductor
Sep 12 09:18:29.516 ERRO when trying to parse component: child element "description" not found in "component" element, Package: nRF_DeviceFamilyPack, Vendor: NordicSemiconductor
Sep 12 09:18:29.516 ERRO when trying to parse component: child element "description" not found in "component" element, Package: nRF_DeviceFamilyPack, Vendor: NordicSemiconductor
Sep 12 09:18:29.516 ERRO when trying to parse component: child element "description" not found in "component" element, Package: nRF_DeviceFamilyPack, Vendor: NordicSemiconductor
Sep 12 09:18:29.516 ERRO when trying to parse component: child element "description" not found in "component" element, Package: nRF_DeviceFamilyPack, Vendor: NordicSemiconductor
Sep 12 09:18:29.516 ERRO when trying to parse component: child element "description" not found in "component" element, Package: nRF_DeviceFamilyPack, Vendor: NordicSemiconductor
Sep 12 09:18:29.526 ERRO when trying to parse component: child element "description" not found in "component" element, Package: nRF_DeviceFamilyPack, Vendor: NordicSemiconductor
Sep 12 09:18:29.526 ERRO when trying to parse component: child element "description" not found in "component" element, Package: nRF_DeviceFamilyPack, Vendor: NordicSemiconductor
Sep 12 09:18:29.526 ERRO when trying to parse component: child element "description" not found in "component" element, Package: nRF_DeviceFamilyPack, Vendor: NordicSemiconductor
Sep 12 09:18:29.526 ERRO when trying to parse component: child element "description" not found in "component" element, Package: nRF_DeviceFamilyPack, Vendor: NordicSemiconductor
Sep 12 09:18:31.485 WARN No Core found!, Package: CMSIS, Vendor: ARM
Sep 12 09:18:31.595 WARN invalid digit found in string, Package: TLE984x_DFP, Vendor: Infineon

Thus, I am not able to use pyocd for these targets. I have tried downloading the pack files manually from the site (which, as such, worked) and supplying them to pyocd through the --pack option, but that didn't work either. Here is the output:

> pyocd gdb --pack C:/Users/ahartmann/Downloads/PyOCD_PACKS/Keil.STM32F7xx_DFP.2.12.0.pack
  #   Probe                           Unique ID
----------------------------------------------------------------
  0   NUCLEO-F303RE [stm32f303re]     066FFF504955657867091142
  1   NUCLEO-F767ZI [stm32f767zi]     0676FF504955857567171922
  2   NUCLEO-H743ZI [stm32h743zitx]   066CFF545257717867101851
  3   NUCLEO-L073RZ [stm32l073rz]     0674FF333036434B43055429

Enter the number of the debug probe or 'q' to quit> 1
0004324:INFO:board:Target type is stm32f767zi
0004474:INFO:dap:DP IDR = 0x5ba02477 (v2 rev5)
0004634:INFO:ap:AP#0 IDR = 0x74770001 (AHB-AP var0 rev7)
0004634:WARNING:rom_table:Invalid coresight component, cidr=0x0
0004634:WARNING:rom_table:Warning: ROM table @ 0xe00fd000 has unexpected CIDR component class (0x0)
0004634:CRITICAL:__main__:No cores were discovered!
Traceback (most recent call last):
  File "c:\users\ahartmann\appdata\local\programs\python\python37-32\lib\site-packages\pyocd\__main__.py", line 343, in run
    self._COMMANDS[self._args.cmd](self)
  File "c:\users\ahartmann\appdata\local\programs\python\python37-32\lib\site-packages\pyocd\__main__.py", line 571, in do_gdbserver
    with session:
  File "c:\users\ahartmann\appdata\local\programs\python\python37-32\lib\site-packages\pyocd\core\session.py", line 287, in __enter__
    self.open()
  File "c:\users\ahartmann\appdata\local\programs\python\python37-32\lib\site-packages\pyocd\core\session.py", line 367, in open
    self._board.init()
  File "c:\users\ahartmann\appdata\local\programs\python\python37-32\lib\site-packages\pyocd\board\board.py", line 83, in init
    self.target.init()
  File "c:\users\ahartmann\appdata\local\programs\python\python37-32\lib\site-packages\pyocd\core\coresight_target.py", line 162, in init
    seq.invoke()
  File "c:\users\ahartmann\appdata\local\programs\python\python37-32\lib\site-packages\pyocd\utility\sequencer.py", line 201, in invoke
    resultSequence = call()
  File "c:\users\ahartmann\appdata\local\programs\python\python37-32\lib\site-packages\pyocd\core\coresight_target.py", line 242, in check_for_cores
    raise exceptions.DebugError("No cores were discovered!")
pyocd.core.exceptions.DebugError: No cores were discovered!

For reference I tried a STM NUCLEO-F303RE that I had lying around. That shows up in my local pack index and is correctly recognized by PyOCD. No issues here.
I also tried using an older version of the STM32F7 pack files (Version 2.11.0 instead of the current 2.12.0), but to no extent. The result is the same.

Can anybody reproduce this issue?
Or tell me how to reach the pack vendor (ST, I guess?) so I can report to them?

I'm using the Python 3 verion of PyOCD, PyOCD Version is 0.22.0.
Host OS is Windows 10 for anybody who might find it to be of interest.

@jeromecoutant
Copy link
Contributor

Hi

On my side (python 2.7 + Windows 10), I could connect my NUCLEO-F767ZI:

$ pyocd gdbserver --pack Keil.STM32F7xx_DFP.2.12.0.pack
0000857:INFO:board:Target type is stm32f767zi
0000878:INFO:dap:DP IDR = 0x5ba02477 (v2 rev5)
0000923:INFO:ap:AP#0 IDR = 0x74770001 (AHB-AP var0 rev7)
0000962:INFO:rom_table:AP#0 ROM table #0 @ 0xe00fd000 (designer=020 part=451)
0001006:INFO:rom_table:[0]<e00fe000:ROM class=1 designer=43b part=4c8>
0001008:INFO:rom_table:  AP#0 ROM table #1 @ 0xe00fe000 (designer=43b part=4c8)
0001025:INFO:rom_table:  [0]<e00ff000:ROM class=1 designer=43b part=4c7>
0001026:INFO:rom_table:    AP#0 ROM table #2 @ 0xe00ff000 (designer=43b part=4c7)
0001067:INFO:rom_table:    [0]<e000e000:SCS-M4 class=14 designer=43b part=00c>
0001078:INFO:rom_table:    [1]<e0001000:DWT class=14 designer=43b part=002>
0001128:INFO:rom_table:    [2]<e0002000:FPB class=14 designer=43b part=00e>
0001141:INFO:rom_table:    [3]<e0000000:ITM class=14 designer=43b part=001>
0001151:INFO:rom_table:  [1]<e0041000:ETM-M7 class=9 designer=43b part=975 devtype=13 archid=4a13 devid=0:0:0>
0001163:INFO:rom_table:[1]<e0040000:TPIU-M7 class=9 designer=43b part=9a9 devtype=11 archid=0000 devid=0:0:ca1>
0001173:INFO:cortex_m:CPU core #0 is Cortex-M7 r1p0
0001217:INFO:cortex_m:FPU present: FPv5
0001233:INFO:dwt:4 hardware watchpoints
0001253:INFO:fpb:8 hardware breakpoints, 1 literal comparators
0001330:INFO:server:Semihost server started on port 4444
0001331:INFO:gdbserver:GDB server started on port 3333

Maybe you could try to update the board ST Link FW: https://www.st.com/en/development-tools/stsw-link007.html

@Funky185540
Copy link
Author

Hi Jerome,

After updating the Firmware through the STM32 ST-Link Utility and erasing the chips flash pyocd works. It seems like the software I flashed previously somehow kept pyocd from reliably making a connection.

Yet the DFP for the STM32F7, H7 and G0 aren't properly downloaded by pyocd, thus keeping me from installing them through pyocd pack --install .... Any idea what to do about this? I have tried pyocd pack -c and pyocd pack -u various times, but that didn't improve the situation...
Anyways, will close this issue since pyocd works fine if you supply the CMSIS packs manually and update ST-Link Firmware.

Thank you very much!
Andreas

@whj4674672
Copy link

I met the same problem as you. Have you solved it?

@Funky185540
Copy link
Author

I met the same problem as you. Have you solved it?

Not really. I just went with downloading the CMSIS pack manually and erasing the STMs flash memory before flashing and/or using PyOCD. It's more of a workaround than a true "solution", but once you automate it you'll forget about it really.
I haven't looked into the issue since December because I'm working on other projects now. So unfortunately I'm not able to tell you any more about it...

@alexc-cazacu
Copy link

Hi, I have the same issue, how did you supply the CMSIS packs manually?

@flit
Copy link
Member

flit commented Apr 12, 2022

Please see the target support documentation for how to do this. In short, download packs from the pack list, then use --pack to use with pyocd.

Fyi, the pack download problem described by this issue is actually fixed. But there is a problem where pyocd/cmsis-pack-manager is too aggressive in parallelizing the index download. This triggers the servers' DoS protection and the requests are blocked. Only Keil and NXP servers seem to have this response. Documented in pyocd/cmsis-pack-manager#190.

@alexc-cazacu
Copy link

I'm trying to build and run code through MBed Studio, and when I try to build any program it compiles successfully, but when I try to run it I get the 'No cores were discovered' error. I don't really know if I can update the pyocd that is built in Mbed Studio unfortunately.

@flit
Copy link
Member

flit commented Apr 13, 2022

The STM32 F7xx and H7xx (and a few other recent families, I think) require DBGMCU registers to be written to enable clocks in order to be fully discoverable by debuggers. This is handled in CMSIS Packs via "debug sequences". Support for debug sequences is in the works for pyocd (at a painfully slow pace, though almost done).

Until that feature is merged, you'll have to configure DBGMCU yourself in a pyocd user script. It's just like any other debugger's init scripts, but in Python. See the Debug chapter of your STM32 device's RM, specifically the DBGMCU.CR register, for what settings to apply to enable all clocks.

I can't really help for the specifics of Mbed Studio integration since I'm not familiar with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants