| 1 | --- |
| 2 | title: Installing on non-x86 platforms |
| 3 | --- |
| 4 | |
| 5 | pyOCD itself is pure Python and should run on any platform with a modern Python installation. |
| 6 | However, it has several dependencies with binary backends that cause trouble on non-x86 platforms or |
| 7 | alternative operating systems (i.e., not macOS, Linux, or Windows). The most common "non-standard" |
| 8 | system that users would like to run pyOCD on is the Raspberry Pi, as well as similar, Arm-based |
| 9 | single-board computers. |
| 10 | |
| 11 | |
| 12 | ## cmsis-pack-manager |
| 13 | |
| 14 | The main dependency that causes trouble is |
| 15 | [cmsis-pack-manager](https://github.com/pyocd/cmsis-pack-manager/). It has a backend written in |
| 16 | the Rust language to greatly improve performance. Unfortunately, wheels are not available for |
| 17 | non-x86 systems. And, worse, the Rust compiler runs out of memory and dies when attempting to build |
| 18 | on small platforms such as the Raspberry Pi. (Cross-compilation may be an option but has not been |
| 19 | sufficiently investigated.) |
| 20 | |
| 21 | The good news is that cmsis-pack-manager is optional for pyOCD. Although it is listed as a required |
| 22 | dependency in `setup.py` (so the vast majority of users benefit from it), pyOCD can run without it |
| 23 | with minimal loss of functionality. The `pack` subcommand is disabled, which removes automatic |
| 24 | CMSIS-Pack download and management. But you can still use CMSIS-Packs manually with the `--pack` |
| 25 | option, as described in [Target support]({% link _docs/target_support.md %}). |
| 26 | |
| 27 | To install pyOCD on such a system, you need to use the `pip install --no-deps` option. This will |
| 28 | install the core pyOCD package only, so all additional requirements must be manually installed. |
| 29 | You can either run `pip install` with an explicit list of the requirements from `setup.py`, or |
| 30 | copy those requirements to a requirements text file and run `pip install -r reqs.txt`. Of course, |
| 31 | be sure to exclude cmsis-pack-manager! (The requirements are not listed here lest they get out of |
| 32 | sync with `setup.py`.) |
| 33 | |
| 34 | Once pyOCD is successfully installed, you will need to run it as a module using the `python` |
| 35 | executable as `python -mpyocd` rather than running the `pyocd` executable directly. This is because |
| 36 | the `pyocd` executable, which is auto-generated by the install process, verifies dependencies and |
| 37 | will error out due to the missing cmsis-pack-manager. But when run through `python`, dependencies |
| 38 | are not checked and pyOCD can handle the lack of cmsis-pack-manager gracefully. |
| 39 | |
| 40 | |
| 41 | ## USB interfaces |
| 42 | |
| 43 | The other dependencies that might be problematic are those for USB communications. pyOCD uses |
| 44 | three USB libraries: |
| 45 | |
| 46 | - pyusb and libusb: CMSIS-DAPv1 on Linux, CMSIS-DAPv2 and STLink on all OSes |
| 47 | - hidapi: CMSIS-DAPv1 on macOS |
| 48 | - pywinusb: CMSIS-DAPv1 on Windows |
| 49 | |
| 50 | Thankfully, libusb is provided by default on most Linux systems, including Raspberry Pi and similar |
| 51 | platforms. So on almost all platforms, USB is not a real problem. |
| 52 | |
| 53 | If you are using an alternative OS, you may have trouble finding a functional USB library. In this |
| 54 | case, the options would be to port libusb and/or hidapi to your OS, or even to extend pyOCD with |
| 55 | support for another USB interface package. |
| 56 |