This webpage walks you through installing the toolchain, SDK, Raspberry Pi examples, and Hunter's examples on your Windows machine. It then describes how to build those examples and load them onto the RP2040.
NOTE: Nikhil Dabas has created an easy-to-use automated installer (here) which automates the intallation of all the software described in this section.¶
NOTE: If you are an ECE 4760 student at Cornell, the toolchain is already installed on the laboratory PC's in Phillips 238.¶
During installation, make sure to tick the box to register the path to the ARM compiler as an environment variable in the Windows shell when prompted to do so. See the image below.
Third checkbox is checked, adding path to environment variable
When prompted by the Built Tools for Visual Studio installer, you need to install the C++ build tools only.
You must install the full "Windows 10 SDK" package as the SDK will need to build the pioasm and elf2uf2 tools locally. Removing it from the list of installed items will mean that you will be unable to build Raspberry Pi Pico binaries.
This takes a while.
Note checkboxes on right side of image during Build Tools install
When prompted by the installer, add Python 3.7 to the system PATH for all users.
4th checkbox from top
You should be additionally disable the MAX_PATH length when prompted at the end of the installation.
When installing, choose 'Custom installation,' click through 'Optional Features' and then under 'Advanced Features' choose 'Install for all users'
It is possible that you will need to make a symbolic link so that the Makefile can find Python 3. To do so, type cmd in the Run Window so that the Developer Command Prompt icon appears in the Start Menu. Select the small arrow to the right of the icon, and then select "Run as administrator." Navigate to C:\Program Files\Python37 and make a symlink by running
Open a new Command Prompt window by again navigating from the Windows Menu to Windows > Visual Studio 2019 > Developer Command Prompt. Closing/re-opening will set the environment variable that we configured above.
Navigate to the pico-examples folder. For me, this was in the directory C:\Users\vha3\Pico\pico-examples
Build the "Hello World" example by running:
C:\Users\vha3\Pico> cd pico-examples C:\Users\vha3\Pico\pico-examples> mkdir build C:\Users\vha3\Pico\pico-examples> cd build C:\Users\vha3\Pico\pico-examples\build> cmake -G "NMake Makefiles" .. C:\Users\vha3\Pico\pico-examples\build> nmake
Within the build directory, you will now find a hello_world directory. You will find directories for each of the other example projects too. These folders will contain the ELF, bin, and uf2 target files for each project. The uf2 target file can be dragged-and-dropped directly onto an RP2040 board attached to your PC via USB, as explained in the next section.
Navigate to the Hunter-Adams-RP2040-Demos folder. For me, this was in the directory C:\Users\vha3\Pico\Hunter-Adams-RP2040-Demos
Build the examples by running:
C:\Users\vha3\Pico> cd Hunter-Adams-RP2040-Demos C:\Users\vha3\Pico\Hunter-Adams-RP2040-Demos> mkdir build C:\Users\vha3\Pico\Hunter-Adams-RP2040-Demos> cd build C:\Users\vha3\Pico\Hunter-Adams-RP2040-Demos\build> cmake -G "NMake Makefiles" .. C:\Users\vha3\Pico\Hunter-Adams-RP2040-Demos\build> nmake
Within the build directory, you will now find a directory for each example project. These folders will contain the ELF, bin, and uf2 target files for each project. The uf2 target file can be dragged-and-dropped directly onto an RP2040 board attached to your PC via USB, as explained in the next section.
While holding down the BOOTSEL button, plug the Pico into a USB port.
The Pico will appear as a mass storage device in your file navigator.
Drag-and-drop C:\Users\vha3\Pico\pico-examples\build\blink.uf2 to the Pico, as you would if you were moving a file to a flash drive.
The Pico will automatically reboot, and start running the Blink example, flashing the LED.
Building the example projects from Visual Studio Code¶
NOTE: You are welcome to make these configurations on your own machine, but in the Phillips 238 laboratory we will build from the command line, as explained above.¶
Navigate via the Windows Menu to Windows > Visual Studio 2019 > Developer Command Prompt
When the command prompt window opens, type C:\Users\vha3\Pico > code. This will open Visual Studio Code with all of the correct environment variables set so that the toolchain is correctly configured.
Note from the guide: If you start Visual Studio Code by clicking on its desktop icon, or directly from the Start Menu, then the build environment will not be correctly configured. This can be done manually later in the CMake Tools Settings, but the easiest way to configure the Visual Studio Code environment is just to open it from a Developer Command Prompt Window where these environment variables are already set.
Click on the Extensions icon in the left-hend toolbar (or type Ctrl + Shift + X) and search for "CMake Tools"
Click the "CMake Tools" entry in the list, and then click the install button
Click the Cog Wheel at the bottom of the navigation bar on the left-hand side of the interface and select "Settings"
In the Settings pange, click on "Extensions" and the "CMake Tools configuration."
Scroll down to "Cmake: Configure Environment" and click on "Add Item"
Set the Item to PICO_SDK_PATH and set the Value to ..\..\pico-sdk as shown below
Cmake: Configure Environment
Scroll down to "Cmake: Generator" and enter "NMake Makefiles" into the box.
Close the Settings panel.
Navigate to File > Open Folder and navigate to the pico-examples repo, then hit "Okay."
You will be prompted to configure the project, as shown below. Click "Yes" and then select "GCC for arm-none-eabi" for your compiler.
See lower-right corner prompt to configure the project
Click the "Build" button (with a cog wheel) in the blue bottom bar of the window. This will create the build directory and run CMake and build the example projects.
Program the Pico by navigating to an example project directory within the build directory and drag/dropping onto the Pico, as explained in the previous section.