When I try to load the compiled firmware into a STM32F746 target with a segger JTAG debugger. Mbed studio can recognize the debugger, but cannot flash the firmware. The studio always stays in the state of ‘Background Tasks: Erasing’.
I also occasionally encounter this problem but with onboard ST-link. Usually it occurs, after few deploying of program, probably 5+ attempts.
At first I thought it cannot connect to the debugger because of some port issue. But if I let the process go on for a long time (about 3 minutes), then the errasing process was completed.
This “delay” was always solved with restart of PC.
Mbed Studio does not officially support external probes other than STLink. That being said Studio is also not preventing form trying other probes. We are aware of an issue in pyOCD (tool used in Studio for flashing and debugging a program on the board) with JLink support. Mbed Studio 1.4.0 that will be released soon is updating pyOCD to latest version (0.30.2). It contains a fix for JLink and other probes. It may be worth rechecking this problem then.
I changed to a STLink. It is not working either. But when I tried to use pyocd from terminal, I can erase and program my board, whatever Segger or STLink debugger is connected.
I am pretty sure this is a bug in the ‘Manage custom target’ page.
File “c:\programdata\mbed studio\mbed-studio-tools\python\lib\site-packages\pyocd\flash\file_programmer.py”, line 169, in _program_bin*
raise exceptions.TargetSupportError(“No boot memory is defined for this device”)* pyocd.core.exceptions.TargetSupportError: No boot memory is defined for this device
0006184 - INFO - pyocd.board.board - Target type is stm32f746ng
0006288 - INFO - pyocd.coresight.coresight_target - Asserting reset prior to connect
0006376 - CRITICAL - pyocd.tool - uncaught exception: ‘JLinkHardwareStatus’ object is not callable
Traceback (most recent call last):
File “c:\programdata\mbed studio\mbed-studio-tools\python\lib\site-packages\pyocd_main_.py”, line 402, in run
self.COMMANDSself._args.cmd
File "c:\programdata\mbed studio\mbed-studio-tools\python\lib\site-packages\pyocd_main.py", line 572, in do_flash
with session:
File “c:\programdata\mbed studio\mbed-studio-tools\python\lib\site-packages\pyocd\core\session.py”, line 339, in enter
self.open()
File “c:\programdata\mbed studio\mbed-studio-tools\python\lib\site-packages\pyocd\core\session.py”, line 457, in open
self._board.init()
File “c:\programdata\mbed studio\mbed-studio-tools\python\lib\site-packages\pyocd\board\board.py”, line 85, in init
self.target.init()
File “c:\programdata\mbed studio\mbed-studio-tools\python\lib\site-packages\pyocd\core\soc_target.py”, line 117, 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\coresight\coresight_target.py”, line 105, in pre_connect
self.dp.assert_reset(True)
File “c:\programdata\mbed studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\dap.py”, line 520, in assert_reset
is_asserted = self.is_reset_asserted()
File “c:\programdata\mbed studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\dap.py”, line 537, in is_reset_asserted
return self.probe.is_reset_asserted()
File “c:\programdata\mbed studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\jlink_probe.py”, line 275, in is_reset_asserted
status = self._link.hardware_status()
TypeError: ‘JLinkHardwareStatus’ object is not callable
Thanks. Studio team has finished testing release 1.4.0. It will be released on Monday. It contains pyOCD 0.32.0.
It seems that we are getting somewhere. Can you please let me know which argument frequency or -O connect_mode=under-reset is causing the error you posted above?
Thank you @ysfand . Your help investigating this issue is much appreciated. I’ll reach out to pyOCD team and ask about it. Mbed Studio is setting -O connect_mode=under-reset for all ST targets. Which explains why it doesn’t work.
In the meantime, I recommend looking at Custom targets - Supported and custom targets | Mbed Studio Documentation
Custom targets feature will allow you to override debug flags that are passed to pyOCD.
You should be also able to update pyOCD version used in Studio by opening a new terminal inside a Studio and running: pip install pyocd==0.32.0