pyocd / pyOCD

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

DISCO-F746NG - "No cores were discovered!" #863

Open georgejourneaux opened 4 years ago

georgejourneaux commented 4 years ago

Sorry if this is the wrong place for this, first experience with pyOCD. Using it through Mbed Studio on the DISCO-F746NG and I get the following:

0000379:INFO:board:Target type is stm32f746ng
0000385:INFO:coresight_target:Asserting reset prior to connect
0000388:INFO:dap:DP IDR = 0x5ba02477 (v2 rev5)
0000397:INFO:ap:AP#0 IDR = 0x74770001 (AHB-AP var0 rev7)
0000405:INFO:rom_table:AP#0 ROM table #0 @ 0xe00fd000 (designer=020 part=449)
0000410:INFO:rom_table:[0]
0000410:INFO:rom_table:  AP#0 ROM table #1 @ 0xe00fe000 (designer=43b part=4c8)
0000414:INFO:rom_table:  [0]
0000414:INFO:rom_table:    AP#0 ROM table #2 @ 0xe00ff000 (designer=43b part=4c7)
0000420:ERROR:ap:Transfer error while reading AP#0 ROM table: SWD/JTAG Transfer Fault @ 0xe000efbc-0xe000f043
0000421:CRITICAL:__main__:No cores were discovered!
Traceback (most recent call last):
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\__main__.py", line 343, in run
    self._COMMANDS[self._args.cmd](self)
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\__main__.py", line 571, in do_gdbserver
    with session:
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\core\session.py", line 287, in __enter__
    self.open()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\core\session.py", line 367, in open
    self._board.init()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\board\board.py", line 83, in init
    self.target.init()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\core\coresight_target.py", line 164, in init
    seq.invoke()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\utility\sequencer.py", line 208, in invoke
    resultSequence = call()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\core\coresight_target.py", line 298, in check_for_cores
    raise exceptions.DebugError("No cores were discovered!")
DebugError: No cores were discovered!

Any ideas?

Thanks!

jhd25 commented 4 years ago

Exactly the same error on a stm32f746zg

0000571:INFO:board:Target type is stm32f746zg 0000667:INFO:coresight_target:Asserting reset prior to connect 0000728:INFO:dap:DP IDR = 0x5ba02477 (v2 rev5) 0000885:INFO:ap:AP#0 IDR = 0x74770001 (AHB-AP var0 rev7) 0000897:INFO:rom_table:AP#0 ROM table #0 @ 0xe00fd000 (designer=020 part=449) 0000899:INFO:rom_table:[0] 0000899:INFO:rom_table: AP#0 ROM table #1 @ 0xe00fe000 (designer=43b part=4c8) 0000902:INFO:rom_table: [0] [] 0000903:INFO:rom_table: AP#0 ROM table #2 @ 0xe00ff000 (designer=43b part=4c7) [] 0000906:ERROR:ap:Transfer error while reading AP#0 ROM table: SWD/JTAG Transfer Fault @ 0xe000efbc-0xe000f043 [] 0000907:CRITICAL:main:No cores were discovered!

flit commented 4 years ago

This is a known issue with the STM32F7 series. This series (and the H7 series) requires some special handling to recover from low power modes that other STM32 device don't. @bartek-w created a solution for the F767 that is merged into master and will be in the next release. This might be usable for the F746 as it is. And in any case, support will be extended to other F7 and H7 devices when time permits.

Suggestions:

(And this is absolutely the right place for your report! 😄 )

jhd25 commented 4 years ago

Using -t stm32f767zi on my NUCLEO-F746ZG : cmd, erase , flash and gdbserver all seem to work - debugging in Mbed Studio works if the latest pyocd is installed and the target file for 767 duplicated for the 746 and target init edited to add.

This error: 0000609:ERROR:target_STM32F767xx:Dual bank configuration detected [FLASH_OPTCR=0xc0ffaafd]. Currently only single bank configuration is fully supported! is raised but operation continues. Thanks !!

bartek-w commented 4 years ago

You man take a look into https://www.st.com/resource/en/application_note/dm00266999-stm32f7-series-flash-memory-dual-bank-mode-stmicroelectronics.pdf

First configuration: Project configured in the single bank mode and nDBANK = 0
As the project is configured in the single bank mode, the user must erase 1 sector
(32 Kbytes), but with nDBANK = 0 the Flash interface is configured in the dual bank
mode, therefore 1 sector = 16 Kbytes. The result is that only 16 Kbytes are erased and
4 Kbytes are missed.

So overall be careful - probably you are not erasing enough sectors before programming. You can solve it in one of 3 ways:

stephenstarkie commented 3 years ago

Any news on this - it seems to have been around for a long time and is quite painful!