This tutorial does not need to be started from Visual Studio. For details, please see the third part directly.
1. Install the necessary tools
- ARM GCC compiler download address
Download the exe installation version
to install
2. CMake download address After the
installation is complete, add cmake to the environment variable.
3. VSCode (I believe everyone will install it)
4. Python
installation tutorial
5. Git download address The
default editor here can be any choice, and it is not used much in actual use. During the installation process, if you have any questions about some options, just press the default installation, or you can Baidu the detailed tutorial yourself.
2. Download and configure SDK
First enter the location you want to install and then enter the following instructions
to clone the SDK from github
git clone -b master https://github.com/raspberrypi/pico-sdk.git
Automatically download SDK dependencies
cd pico-sdk
git submodule update --init
Add a variable named PICO_SDK_PATH to the environment variables, the path is the path of the pico-sdk folder just downloaded.
3. Configure vscode
1. Install the plug-in
Open the 3 plug-ins in the vscode installation diagram
2. Settings
Open the CMake Tools plug-in settings
Add the PICO_SDK_PATH variable again in the Cmake Environment The
Raspberry Pi compilation process is actually cmke generates a makefile, and then make compiles according to the makefile. Make is actually a batch processing tool. Currently, tools similar to make include Nmake and Ninja. Nmake is selected in the official document, so fill in the NMake Makefiles in the cmake tool in the cmake generator.
But this requires the installation of Visual Studio, but I just looked at it and it seems that nmake can be downloaded separately. You can try to configure environment variables after downloading to see if it can compile.
After all, it was developed in C/C++, so I must have written c. So I used mingw32_make in MinGW, which is actually make under Linux. Just fill in MinGW Makefiles in Cmake Generator.
Then
select ARM GCC compiler as the compiler tool, and click Generate on the right.
4. Sample
Clone the official sample.
git clone -b master https://github.com/raspberrypi/pico-examples.git
The official sample is compiled with a lot of examples, here I wrote a single sample compiled Download
I am limited, if there are errors in the article, please point out