Installation Guide

Requirements

  • Make sure to have Python 3.7+ installed (old version 2.x is not supported).

  • Create and activate a virtual environment (venv, pipenv, etc.)

  • Upgrade PyPI to the latest version

  • Install SPSDK

Warning

Please note that not all SPSDK dependencies might be distributed as wheels (built package format for Python). In this case please ensure that you have C compiler on your system. In some cases rust compiler is also needed

Windows

To install SPSDK under Windows follow:

python -m venv venv
venv\Scripts\activate
python -m pip install --upgrade pip
pip install spsdk
spsdk --help

SPSDK help for command-line applications should be displayed.

Note

In Windows OS you need to install Microsoft Visual C++ Build Tools

Linux

To install SPSDK under Linux follow:

python3 -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
pip install spsdk
spsdk --help

SPSDK help for command-line applications should be displayed.

UART under Linux

Several steps need to be performed before SPSDK can list and use NXP devices connected to the host PC under Linux using UART.

By default on Ubuntu tty serial devices are only accessible to users in group dialout. The permissions for /dev/ttyACM0 can be permanently solved by adding the user to the dialout group:

sudo usermod -a -G dialout $USER

Then the user has to perform logout and login from the system for the group changes to take effect. Afterward, the UART device could be shown in nxpdevscan and are ready for use.

USB under Linux

For SPSDK to access connected devices using USB, it is necessary to configure udev rules.

Note

NXP VIDs list - USB - VID & PID.

  1. Create a file for example 50-nxp.rules containing following rules:

SUBSYSTEM=="hidraw", KERNEL=="hidraw*", ATTRS{idVendor}=="0d28", MODE="0666"
SUBSYSTEM=="hidraw", KERNEL=="hidraw*", ATTRS{idVendor}=="1fc9", MODE="0666"
SUBSYSTEM=="hidraw", KERNEL=="hidraw*", ATTRS{idVendor}=="15a2", MODE="0666"
  1. To install rules copy the file to /etc/udev/rules.d:

sudo cp 50-nxp.rules /etc/udev/rules.d

sudo udevadm control --reload-rules

sudo udevadm trigger
  1. Plug your NXP device(s) and call nxpdevscan.

macOS @ Intel

To install SPSDK under macOS follow:

python3 -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
pip install spsdk
spsdk --help

SPSDK help for command-line applications should be displayed.

macOS @ M1

It’s recommended to use the pyenv package for Python installation. To install SPSDK follow those steps:

  1. Install homebrew. Homebrew is a package manager for macOS located here

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Install pyenv

$ brew update
$ brew install pyenv
  1. Enable pyenv, execute the following lines to set environment variables, assuming you are using zsh

$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zprofile
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zprofile
  1. Install Python

$ pyenv install 3.9.5
  1. Make pyenv Python global and rehash

$ pyenv global 3.9.5
$ pyenv rehash

Now you can use pip for package installation.

  1. Install rust compiler. To build some SPSDK dependencies a rust compiler is needed, to install it a rustup script could be used: https://rustup.rs.

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  1. Install Python build dependencies

$ brew install openssl readline sqlite3 xz zlib
  1. Export compiler flags for openssl

$ export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
$ export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
  1. Install SPSDK

$ pip install spsdk

GitHub

To install SPSDK form GitHub follow:

$ pip install -U https://github.com/NXPmicro/spsdk/archive/master.zip

GitHub - from sources

To install SPSDK from source code follow:

$ git clone https://github.com/NXPmicro/spsdk.git
$ cd spsdk
$ pip install -U -e .

Note

In case of problems during installation, please make sure that you have the latest pip version. You can upgrade pip using this command:

pip install --upgrade pip

PyInstaller

PyInstaller bundles SPSDK applications into executable binaries which might be executed without Python interpreter.

To bundle SPSDK applications into executables run the following line:

$ pyinstaller --clean --noconfirm apps.spec

Trust Provisioning

Extra dependencies must be installed in order to use Trust Provisioning. Also you will need swig compiler which is a requirement for pyscard

Note

In Mac OS you need to install gcc, swig (http://www.swig.org), and pcsc-lite (https://pcsclite.apdu.fr/). (brew install swig pcsc-lite) In Linux you need to install pcscd and libpcsclite-dev. (sudo apt install pcdcs libpcsclite-dev)

$ pip install 'spsdk[tp]'

This command will install SPSDK with Trust Provisioning support