| 1 | --- |
| 2 | title: Remote probe access |
| 3 | --- |
| 4 | |
| 5 | PyOCD provides a server and client for sharing and accessing debug probes across a TCP/IP |
| 6 | network connection. This can be used to provide shared debug access for multiple developers, to |
| 7 | simplify CI configurations, or simply to enable multiple applications or tools to simultaneously |
| 8 | access a probe. |
| 9 | |
| 10 | Here are some example use cases for remote probe access. |
| 11 | |
| 12 | 1. Debug a device that is in your office across a VPN connection from home. |
| 13 | |
| 14 | 2. Access a device from across the room while using a laptop on your couch. |
| 15 | |
| 16 | 3. While connected with pyOCD commander, upload new target firmware using the `pyocd flash` |
| 17 | subcommand. |
| 18 | |
| 19 | |
| 20 | Server |
| 21 | ------ |
| 22 | |
| 23 | The server side is quite simple. The `pyocd server` subcommand starts the server running for the |
| 24 | specified probe. |
| 25 | |
| 26 | The probe is selected via the usual connection-related command line arguments, |
| 27 | such as `--uid`. Also as usual, a console menu will be printed to allow you to choose a probe to |
| 28 | serve if multiple are available and a unique ID is not specified. |
| 29 | |
| 30 | The probe server's default port number is 5555. You can change the port by passing the `--port` |
| 31 | argument. The port the server uses will appear in the log when the server starts running. |
| 32 | |
| 33 | By default, the server disallows remote connections. That is, other devices on the network are not allowed to connect to |
| 34 | the server. This is fine if you don't need remote access to the server, for example if you are only connecting from |
| 35 | other processes running on the same computer as the server. It's also a secure default. |
| 36 | |
| 37 | To allow remote clients to connect, pass the `--allow-remote` argument. Be aware that if the server is exposed on the |
| 38 | Internet, then any other node on the Internet can connect to it, so please take appropriate protective measures. You |
| 39 | may want to ensure that your network's firewall blocks the port being used (default 5555). |
| 40 | |
| 41 | Example command line to start the server and allow remote connections: |
| 42 | |
| 43 | ``` |
| 44 | $ pyocd server --allow-remote |
| 45 | ``` |
| 46 | |
| 47 | This command does not specify a unique ID for a probe, so it will show the console probe selection |
| 48 | menu if there is more than one available. |
| 49 | |
| 50 | |
| 51 | Client |
| 52 | ------ |
| 53 | |
| 54 | Access to remote probes is available from all pyOCD commands. When using a remote probe, the |
| 55 | behaviour should be exactly as if the probe were being controlled directly. Of course, there may |
| 56 | be additional latency depending on network performance. For localhost-served probes, the connection |
| 57 | is nearly transparent. |
| 58 | |
| 59 | The remote probe is selected by specifying a unique ID with a prefix of "remote:", followed by the server IP address or |
| 60 | domain name. The port can be included by appending another colon and the port number. For instance, to connect to a |
| 61 | probe being served on the same computer, pass `--uid=remote:localhost` on the command line. With a custom port, this |
| 62 | would be `--uid=remote:localhost:1234`. |
| 63 | |
| 64 | **Important:** Currently you must always specify the target type for the remote device, even in |
| 65 | cases where the target type is automatically detected when you use the probe directly. To do this, |
| 66 | pass the `--target` argument followed by the target type. See [Target support]({% link _docs/target_support.md %}) |
| 67 | for more information about target types. |
| 68 | |
| 69 | Note that remote probes will not appear in the list when you run `pyocd list --probes`. |
| 70 | |
| 71 | Example command line for running the gdbserver locally for a probe on a remote machine: |
| 72 | |
| 73 | ``` |
| 74 | $ pyocd gdbserver -uremote:myserver.example.com |
| 75 | ``` |
| 76 |