ARMmbed / mbed-os

Arm Mbed OS is a platform operating system designed for the internet of things
https://mbed.com
Other
4.66k stars 2.97k forks source link

PyOCD deploy failed, deploying using mass storage device... #12586

Closed Hammie217 closed 3 years ago

Hammie217 commented 4 years ago

Description of defect

After compilation of my c++ code after trying to upload to the device I get the error PyOCD deploy failed, deploying using mass storage device... It started happening out of nowhere and I've tried different boards and windows resorting to deleting sections of code to no avail.

The code can be found here: https://github.com/Hammie217/NXPCupGroupProject/blob/master/main.cpp

Target(s) affected by this defect ?

KL25z K64f

Toolchain(s) (name and version) displaying this defect ?

ARMC6

What version of Mbed-os are you using (tag or sha) ?

mbed-os-5.15.1

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

Mbed Studio (PC and Mac)

How is this defect reproduced ?

Trying to run the program on windows or mac.

0xc0170 commented 4 years ago

After compilation of my c++ code after trying to upload to the device I get the error PyOCD deploy failed, deploying using mass storage device...

How are you uploading it to the device? I don't recall seeing before "PyOCD deploy failed" so wondering where this error comes from - please add more details that should help us to reproduce.

Is this related to the example above (I don't find there anything specific to flash or something that could break the board), or blinky as well?

Hammie217 commented 4 years ago

Hi 0xc0170,

I'm uploading to the device directly over USB, I've tried on both macOS and Windows and get the same error. If you'd like to reproduce I'm sure compiling the linked code onto a similar NXP board will generate the same result.

When I run Blinky it seems to compile, upload and run fine.

Thanks,

adbridge commented 4 years ago

What version of Mbed-os are you using (tag or sha) ? 5.15.1

@Hammie217 For future reference '5.15.1' is not a valid sha or release tag and cannot thus be interpreted by our automation. Please provide the actual tag or a valid sha. E.g

absd1234 or mbed-os-x.y.z

Thank you

adbridge commented 4 years ago

Also:

Toolchain(s) (name and version) displaying this defect ? MBED Desktop, PC and Mac

This is not a toolchain. We would expect something like 'ARMCC' , 'GCC' or 'IAR'

What version(s) of tools are you using. List all that apply (E.g. mbed-cli) MBED Desktop, PC and Mac

This is not a tool set. How are you compiling? If you are using mbed-cli to compile then that should be added in this field.

Please update the template header with the correct information so that we can try and replicate the problem. Thanks.

Hammie217 commented 4 years ago

Apologies find the correct formats below.

Version: mbed-os-5.15.1

Toolchain: ARMC6

Tool versions: Mbed Studio (PC and Mac)

Thanks,

nevenaaak commented 4 years ago

Hello @Hammie217 , I am experiencing the same problem. I was wondering if you have found any solution.

Thanks

Hammie217 commented 4 years ago

Hey @nevenaaak , unfortunately not. I had others have the same issue and again unable to fix.

Apologies,

yvanjo commented 4 years ago

hi @Hammie217 , i also have the same problem right now. Have you fix it please?

Neuromod commented 4 years ago

Same problem here, Cypress PSOC 6 WiFi-BT Pioneer Kit, ARMC 6.13, Mbed Studio 0.91, Mbed 5.15.0

ParamDeshpande commented 4 years ago

Same issue, using Nucleo F411RE , mbed studio 1.1.0 , mbed-os 6.2.0

vishnumaiea commented 4 years ago

Same issue. pyOCD is failing to launch due to which uploading falls back to mass storage method. Debugging is also not working.

image

Here's an excerpt from the Mbed Studio log file,

[2020-08-04T11:53:25.385] [ERROR] MbedStudio - Request deploy failed with error: PyOCD failed to flash the device, please check the logs for more information [ 'Error: PyOCD failed to flash the device, please check the logs for more information\n    at PyocdDeployer.<anonymous> (C:\\Program Files\\Mbed Studio\\resources\\app\\node_modules\\@mbed\\mbs-deploy\\lib\\backend-electron\\deployers\\pyocd-deployer.js:168:31)\n    at step (C:\\Program Files\\Mbed Studio\\resources\\app\\node_modules\\@mbed\\mbs-deploy\\lib\\backend-electron\\deployers\\pyocd-deployer.js:48:23)\n    at Object.throw (C:\\Program Files\\Mbed Studio\\resources\\app\\node_modules\\@mbed\\mbs-deploy\\lib\\backend-electron\\deployers\\pyocd-deployer.js:29:53)\n    at rejected (C:\\Program Files\\Mbed Studio\\resources\\app\\node_modules\\@mbed\\mbs-deploy\\lib\\backend-electron\\deployers\\pyocd-deployer.js:21:65)' ]
[2020-08-04T11:53:25.401] [INFO] root/mbs-deploy - d:\Magnimous\Development\Mbed-Studio\Hello-World\BUILD\NRF52_DK\ARMC6\Hello-World.hex > J:\Hello-World.hex []
[2020-08-04T11:53:25.403] [INFO] root/mbs-deploy - PyOCD deploy failed, deploying using mass storage device... []
[2020-08-04T11:53:25.421] [INFO] root/mbs-deploy - Hello-World deployed, board may require restarting []
[2020-08-04T11:53:25.422] [INFO] root/mbs-core - Updating CoreMbedApplicationState with updateType: RUN_SESSION, update: false []
[2020-08-04T11:53:25.424] [INFO] root/mbs-core - Determining program buttons status: {"BUILD":{"type":"BUILD","typeString":"BUILD","isDisabled":false,"tooltip":"Build program"},"DEBUG":{"type":"DEBUG","typeString":"DEBUG","isDisabled":false,"tooltip":"Debug program"},"RUN":{"type":"RUN","typeString":"RUN","isDisabled":false,"tooltip":"Run program"}} []
[2020-08-04T11:53:31.422] [INFO] root/mbs-debug - cmd -W -c reset --uid 000682006630 --target nrf52 []
[2020-08-04T11:53:31.423] [DEBUG] root/process - Starting raw process: c:\ProgramData\Mbed Studio\mbed-studio-tools\python\Scripts\pyocd.exe, with args: cmd -W -c reset --uid 000682006630 --target nrf52,  with options: {"cwd":"c:\\ProgramData\\Mbed Studio\\mbed-studio-tools\\python\\Scripts"} []
[2020-08-04T11:53:31.424] [INFO] root/mbs-core - Updating CoreMbedApplicationState with updateType: DEBUG_SESSION, update: true []
[2020-08-04T11:53:31.425] [INFO] root/mbs-core - Determining program buttons status: {"BUILD":{"type":"BUILD","typeString":"BUILD","isDisabled":true,"tooltip":"Debug in progress"},"DEBUG":{"type":"DEBUG","typeString":"DEBUG","isDisabled":true,"tooltip":"Debug in progress"},"RUN":{"type":"RUN","typeString":"RUN","isDisabled":true,"tooltip":"Debug in progress"}} []
[2020-08-04T11:53:31.426] [INFO] root/mbs-debug - Resetting target for debug... []
[2020-08-04T11:53:33.714] [DEBUG] root/process - Process 1916 has exited with code 0. [ 'c:\\ProgramData\\Mbed Studio\\mbed-studio-tools\\python\\python.exe',
  [ '-u',
    'c:\\ProgramData\\Mbed Studio\\mbed-studio-tools\\clangd\\generate_compile_commands.py',
    '--compilation_database_path',
    'c:\\Users\\VISHNU-MAGNIMOUS\\AppData\\Local\\Mbed Studio\\programs\\Hello-World_1168230571',
    '--path',
    'd:\\Magnimous\\Development\\Mbed-Studio\\Hello-World',
    '--toolchain',
    'ARMC6',
    '--target',
    'NRF52_DK',
    '--tools',
    'c:\\ProgramData\\Mbed Studio\\mbed-studio-tools',
    '--profile',
    'c:\\Users\\VISHNU-MAGNIMOUS\\AppData\\Local\\Mbed Studio\\programs\\Hello-World_1168230571\\profile.json' ] ]
[2020-08-04T11:53:33.715] [DEBUG] root/process - Unregistering process. [ID: 57] []
[2020-08-04T11:53:33.715] [DEBUG] root/process - The process was successfully unregistered. [ID: 57] []
[2020-08-04T11:53:33.728] [DEBUG] root/process - Starting raw process: c:\ProgramData\Mbed Studio\mbed-studio-tools\clangd\clangd.exe, with args: -log=error,  with options: undefined []
[2020-08-04T11:53:33.729] [DEBUG] MbedStudio - Opening channel for service path '/services/languages/cpp/28'. [ID: 93] []
[2020-08-04T11:53:33.810] [DEBUG] root/process - Process 8412 has exited with code 1. [ 'c:\\ProgramData\\Mbed Studio\\mbed-studio-tools\\python\\Scripts\\pyocd.exe',
  [ 'cmd',
    '-W',
    '-c',
    'reset',
    '--uid',
    '000682006630',
    '--target',
    'nrf52' ] ]
[2020-08-04T11:53:33.810] [DEBUG] root/process - Unregistering process. [ID: 59] []
[2020-08-04T11:53:33.811] [DEBUG] root/process - The process was successfully unregistered. [ID: 59] []
[2020-08-04T11:53:33.811] [ERROR] root/mbs-debug - 0001371:WARNING:jlink:Out of sync , resynchronizing...
0001373:WARNING:jlink:Out of sync , resynchronizing...
0001379:WARNING:jlink:Out of sync , resynchronizing...
0001393:CRITICAL:__main__:Cannot connect to J-Link
Traceback (most recent call last):
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\jlink_probe.py", line 137, in open
    self._link.open(self._serial_number)
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pylink\jlink.py", line 692, in open
    raise errors.JLinkException(result.decode())
pylink.errors.JLinkException: Cannot connect to J-Link

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\__main__.py", line 362, in run
    self._COMMANDS[self._args.cmd](self)
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\__main__.py", line 725, in do_commander
    PyOCDCommander(self._args, cmds).run()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\tools\pyocd.py", line 754, in run
    if not self.connect():
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\tools\pyocd.py", line 817, in connect
    resume_on_disconnect=False,
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\core\helpers.py", line 237, in session_with_chosen_probe
    unique_id=unique_id,
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\core\helpers.py", line 138, in choose_probe
    allProbes = ConnectHelper.get_all_connected_probes(blocking=blocking, unique_id=unique_id)
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\core\helpers.py", line 82, in get_all_connected_probes
    allProbes = DebugProbeAggregator.get_all_connected_probes(unique_id=unique_id)
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\aggregator.py", line 34, in get_all_connected_probes
    probes += cls.get_all_connected_probes()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\jlink_probe.py", line 62, in get_all_connected_probes
    return [cls(str(info.SerialNumber)) for info in jlink.connected_emulators()]
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\jlink_probe.py", line 62, in <listcomp>
    return [cls(str(info.SerialNumber)) for info in jlink.connected_emulators()]
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\jlink_probe.py", line 96, in __init__
    self.open()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\jlink_probe.py", line 155, in open
    six.raise_from(self._convert_exception(exc), exc)
  File "<string>", line 3, in raise_from
pyocd.core.exceptions.ProbeError: Cannot connect to J-Link
 []
[2020-08-04T11:53:33.811] [ERROR] MbedStudio - Request reset failed with error: PyOCD failed to reset the target, please check the logs for more information [ 'Error: PyOCD failed to reset the target, please check the logs for more information\n    at ElectronDeviceService.<anonymous> (C:\\Program Files\\Mbed Studio\\resources\\app\\node_modules\\@mbed\\mbs-debug\\lib\\backend-electron\\electron-device-service.js:115:31)\n    at step (C:\\Program Files\\Mbed Studio\\resources\\app\\node_modules\\@mbed\\mbs-debug\\lib\\backend-electron\\electron-device-service.js:49:23)\n    at Object.throw (C:\\Program Files\\Mbed Studio\\resources\\app\\node_modules\\@mbed\\mbs-debug\\lib\\backend-electron\\electron-device-service.js:30:53)\n    at rejected (C:\\Program Files\\Mbed Studio\\resources\\app\\node_modules\\@mbed\\mbs-debug\\lib\\backend-electron\\electron-device-service.js:22:65)' ]
[2020-08-04T11:53:33.848] [ERROR] root/mbs-debug - Could not complete debug: Request reset failed with message: PyOCD failed to reset the target, please check the logs for more information
Error: {"code":-32603} []
[2020-08-04T11:53:33.849] [INFO] root/mbs-core - Updating CoreMbedApplicationState with updateType: DEBUG_SESSION, update: false []
[2020-08-04T11:53:33.850] [INFO] root/mbs-core - Determining program buttons status: {"BUILD":{"type":"BUILD","typeString":"BUILD","isDisabled":false,"tooltip":"Build program"},"DEBUG":{"type":"DEBUG","typeString":"DEBUG","isDisabled":false,"tooltip":"Debug program"},"RUN":{"type":"RUN","typeString":"RUN","isDisabled":false,"tooltip":"Run program"}} []
[2020-08-04T11:53:33.924] [DEBUG] root/mbs-cpp-config - Show CppBuildConfigurationsStatus []
[2020-08-04T11:53:33.925] [INFO] root/mbs-cpp-config - Updating C++ config: {"name":"Hello-World","directory":"c:\\Users\\VISHNU-MAGNIMOUS\\AppData\\Local\\Mbed Studio\\programs\\Hello-World_1168230571"} []
[2020-08-04T11:53:34.033] [DEBUG] MbedStudio - Closing channel on service path '/services/languages/cpp/28'. [ID: 93] []
[2020-08-04T11:53:34.049] [DEBUG] root/process - Starting raw process: c:\ProgramData\Mbed Studio\mbed-studio-tools\clangd\clangd.exe, with args: -log=error,  with options: undefined []
[2020-08-04T11:53:34.050] [DEBUG] MbedStudio - Opening channel for service path '/services/languages/cpp/29'. [ID: 94] []
[2020-08-04T11:53:34.050] [DEBUG] root/process - Process 15856 has exited with code undefined, signal: SIGTERM. [ 'c:\\ProgramData\\Mbed Studio\\mbed-studio-tools\\clangd\\clangd.exe',
  [ '-log=error' ] ]
[2020-08-04T11:53:34.051] [DEBUG] root/process - Unregistering process. [ID: 60] []
[2020-08-04T11:53:34.051] [DEBUG] root/process - The process was successfully unregistered. [ID: 60] []
[2020-08-04T11:53:34.149] [WARN] MbedStudio - Error: Possible Emitter memory leak detected. 31 listeners added. Use event.maxListeners to increase the limit (30)
    at e.checkMaxListeners (file:///C:/Program%20Files/Mbed%20Studio/resources/app/lib/bundle.js:1:64957)
    at Object._event._event.Object.assign.maxListeners (file:///C:/Program%20Files/Mbed%20Studio/resources/app/lib/bundle.js:1:64500)
    at e.value (file:///C:/Program%20Files/Mbed%20Studio/resources/app/lib/bundle.js:12:284379)
    at e.value (file:///C:/Program%20Files/Mbed%20Studio/resources/app/lib/bundle.js:12:284242)
    at t.value (file:///C:/Program%20Files/Mbed%20Studio/resources/app/lib/bundle.js:12:306432)
    at file:///C:/Program%20Files/Mbed%20Studio/resources/app/lib/bundle.js:12:296879 []
[2020-08-04T11:53:34.150] [DEBUG] root/mbs-cpp-config - Show CppBuildConfigurationsStatus []
[2020-08-04T11:53:46.411] [INFO] root/mbs-about - Opening feedback dialog []
[2020-08-04T11:53:46.414] [INFO] root/mbs-about - Mbed Studio version: 1.1.0 []
[2020-08-04T11:53:46.424] [INFO] root/mbs-about - Mbed Studio platform: Windows []

Target : nRF52-DK Target interface : USB Target interface MCU firmware : J-LINK OB (J-Link OB-SAM3U128-V2-NordicSemi 170724.bin) Mbed Studio version : 1.1.0 Operating System : Windows 10, 10.0.18363

Debugging works when latest DAPLink firmware is flashed onto the interface MCU.

@adbridge May be this will help.

thegecko commented 4 years ago

Your logs show you are running J-Link firmware on your device which Mbed Studio doesn't support. I recommend you use the DAPLink firmware for your target hardware:

https://armmbed.github.io/DAPLink/

ciarmcom commented 3 years ago

Thank you for raising this detailed GitHub issue. I am now notifying our internal issue triagers. Internal Jira reference: https://jira.arm.com/browse/IOTOSM-2282

adbridge commented 3 years ago

Solution to this was provided by @thegecko so closing this.