Application Note: neuralSPOT and Windows
The neuralSPOT development environment is based on GCC and Python - compiling and deploying has been tested on MacOS 12+, Windows 11, and Ubuntu Linux. Most developers have a preferred environment, and there are thousands of combinations, so neuralSPOT aims to be as agnostic as possible, as long as the following tools are available on the platform:
- ARM's GCC-based crosscompiler toolchain
- GNU Make or a compatible equivalent
- Python 3.10+ with pip support
- SEGGER Jlink
However, neuralSPOT was developed on Linux and Mac, so there are some toolchain and requirement differences for Windows. This document describes the 'bare minimum' installation and compilation process for neuralSPOT, including eRPC and RPC-based neuralSPOT tools.
NOTE NeuralSPOT has experimental support for Arm's proprietary compiler, armclang. Armclang requires an Arm license to run, and has only been tested on Windows.
Compiling neuralSPOT
First we need to prepare the compile toolchain and environment. In summary:
- Install a Terminal application (we've tested Microsoft Terminal)
- Install ARM tools
- Install GNU Make (ironically, installing this simple tool is the most convoluted step of the process)
- Install git
- Configuring shells and paths
- Compile
Installing ARM Toolchain
The ARM toolchain is needed to compile and link neuralSPOT binaries for ARM processors. Installation is via a Windows Installer located here. We've tested 10.3-2021.10, which is the latest stable release.
The installer will add the tools to your PATH environment variable as an option (this makes things simpler).
Installing GNU Make
GNU Make is a version of the venerable Unix make tool. neuralSPOT's toolchain is based on this version of make. There are many ways of installing this on Windows. We found that using Chocolatey (a Windows tool package manager) is straightforward. The trickiest part of the process is installing Chocolatey itself.
The instructions for installing Chocolatey are a bit convoluted, since it is a shell-based install (on the other hand, once you have that running you can use it to install many other tools easily). What we found worked was:
- Download the script linked to from their instructions (here) to somewhere you can access from the Windows Terminal.
- Start a Terminal in "Administrative Mode"
- Set execution permissions as per Chocolatey's instructions (linked above)
- Execute the script you download in step 1
Once you have Chocolatey installed, installing GNU Make is easy. From the Terminal, run:
choco install make
Installing Git
Git is a source code management tool, and the simplest way to access projects on GitHub - it isn't strictly needed since GitHub allows you to download projects as Zip or Tar packages, but installing git will make it easier to pull updates, track any changes you make to the code locally, and submit code back to GitHub.
Installing git is straightforward via their installer, located here.
This robust installer will give you many configuration options as it progresses - the default options will work, but if you are an experienced windows and/or git user feel free to modify. We found the following settings helpful:
- "Add a Git Bash Profile to Windows Terminal" (select this)
- "Use Git and optional Unix tools from the Command Prompt" (adds stuff to Path, so only do this if you understand the implications).
Shells and Paths
The neuralSPOT Makefile makes use of a few unix-style commands (such as mkdir -p
and cp -R
) which behave differently on Windows, depending on which shell is being used and how the PATH environment variable is configured. We recommend one of:
- Use git bash - this is installed as part of Git, and is a special CLI that replicates common Unix Bash shell commands. Launching and using git bash is the easiest path to compiling neuralSPOT. See here for instructions on how to use it.
- Let git modify the Path to point to common unix replacements for windows commands (see option 2 above) when installing Git.
Compiling neuralSPOT
Now that we have all the essential tools installed, you're ready to download and compile neuralSPOT:
$> git clone https://github.com/AmbiqAI/neuralSPOT.git
$> cd neuralSPOT
$> make
For more compilation options, visit our main README.
Installing eRPC and neuralSPOT RPC
Using RPC in neuralSPOT requires Python and some Python libraries. In summary:
- Install Python
- Install neuralSPOT required libraries
- Run RPC client example
Installing Python
There are hundreds of ways to install Python on Windows, but we found that using Window Store's Python worked well and included everything needed.
Installing neuralSPOT Libraries
neuralSPOT includes a sample Python application which requires some Python libraries to be installed (besides eRPC). The simplest way to install these is using pip
:
$> cd .../neuralSPOT
$> python setup.py install
Running neuralSPOT RPC
An EVB running RPC-enabled code will show up as a USB TTY device. On Windows this will be one of the COMx: ports. The easiest way to identify which COM port to use is to look at the device manager GUI while resetting the EVB (after you have flashed an RPC-capable image) - after the reset, two COM ports will show up, one for Jlink's USB and the other for the RPC TTY port. You can also see these ports from the command line via the following command:
wmic path Win32_SerialPort
If the port is (for example) COM3, the command to start neuralSPOT's Python application as a server would be:
python -m generic_data -t COM3: -o myaudio.wav -m server