# Pico setup for Windows

> [!IMPORTANT]
> In the future, the pico-setup-windows installer will not be supported. Instead, use the official Visual Studio Code extension available at https://marketplace.visualstudio.com/items?itemName=raspberry-pi.raspberry-pi-pico. This extension handles setup on multiple platforms, including Linux, macOS, and Windows.
>
> To learn more, follow the [Getting Started with Raspberry Pi Pico-series](https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf) tutorial.


# Previous Contents

[Download the latest release](https://github.com/raspberrypi/pico-setup-windows/releases/latest/download/pico-setup-windows-x64-standalone.exe)

This project aims to create an easy-to-use installer to get started on Windows (using the C/C++ SDK) with [Raspberry Pi Pico](https://www.raspberrypi.com/products/raspberry-pi-pico/) and other RP2040-based boards. It is inspired by, and is roughly equivalent to, the [pico-setup](https://github.com/raspberrypi/pico-setup) project for Linux systems.

The installer automates the prerequisite installation on Windows, as explained in the official [Getting started with Raspberry Pi Pico](https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf) guide.

The rest of this README document is about developing the installer itself. If you just want to install and use the compilers and toolchain, download the release linked to above. Further information for users is in the [tutorial](docs/tutorial.md).

## Included software

- [Arm GNU Toolchain](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads)
- [CMake](https://cmake.org/download/)
- [Ninja](https://github.com/ninja-build/ninja/releases)
- [Python 3.9](https://www.python.org/downloads/windows/)
- [Git for Windows](https://git-scm.com/download/win)
- [Visual Studio Code](https://code.visualstudio.com/)
- [OpenOCD](https://github.com/openocd-org/openocd/)

# Building

You will need PowerShell 7.2 or newer in order to run the build script. See [Installing PowerShell on Windows](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows) for download links and instructions. Note that this is needed only for building the installer itself, and not for end-user machines where the installer will be run.

The installers are built with [NSIS 3](https://nsis.sourceforge.io/Download). The NSIS script is generated by [build.ps1](build.ps1) when provided with a JSON configuration file. The build script automatically downloads a local copy of NSIS to use for the build.

Only x86-64 builds are supported at this time.

Compiling OpenOCD and other tools (picotool, pioasm, elf2uf2) requires an installation of [MSYS2](https://www.msys2.org/). The build script automatically downloads and installs a local copy of MSYS2. You can specify a path to an existing copy of MSYS2 using the `-MSYS2Path` option. The build script will install a copy of MSYS2 at this path if it doesn't find an existing copy.

It is highly recommended to use a dedicated copy of MSYS2 for this build.

To build:

```powershell
.\build.ps1 .\config\x64-standalone.json -MSYS2Path ~\Downloads\msys64
```

The built installers will be saved to the `bin` directory.

# Tests

There are tests for some parts of the build scripts. You can run them like this:

```powershell
Install-Module Pester -Force
Import-Module Pester -PassThru # Check the version of the imported module -- we need v5 or greater
Invoke-Pester -Output Detailed
```
