Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4465

SDK • Some notes on installing and using Pico SDK 2.1.1 on MSYS2

$
0
0
Here are some notes and shell scripts for installing and using Pico C/C++ SDK 2.1.1 on MSYS2 on Windows. I searched a bit and found one partial guide on installing the SDK on MSYS2 [1], so I adapted and extended it.

[1] Setup Raspberry PI Pico SDK in 5 minutes
https://gist.github.com/thewh1teagle/70 ... 4b0ae31f69

MSYS2 does have a picotool binary package, so some folks may be using the SDK on MSYS2 just fine. But I couldn't find any complete guides... anyway I got it done myself, the MSYS2 cmake reported some warnings but otherwise building stuff works almost like the Linux Mint setup that I was using. Also got picotool and pioasm built and installed.

Notes and shell scripts are in the attached archive. The notes are reproduced below for convenience, with some formatting adjustments.

Setup C/C++ SDK on MSYS2
========================


The following is based on the work of thewh1teagle at:

https://gist.github.com/thewh1teagle/70 ... 4b0ae31f69

Download and run the MSYS2 installer from:

https://www.msys2.org/

Follow the basic steps to get a default terminal for the UCRT64 environment.

Install dependencies:

Code:

pacman --needed -S $MINGW_PACKAGE_PREFIX-{toolchain,cmake,libusb,arm-none-eabi-toolchain,make} git make
where MINGW_PACKAGE_PREFIX should be mingw-w64-ucrt-x86_64. You can verify the environment variable using:

Code:

set | grep MINGW
Clone the SDK repos using an adapted version of pico_setup.sh. Run the following from the user's home directory:

Code:

./pico_repo_setup_msys2.sh
If for some reason the new environment variables are not picked up, source the startup script:

Code:

source ~/.bashrc
Checking with:

Code:

set | grep PICO
there should be four entries:

Code:

PICO_EXAMPLES_PATH=/home/khman/pico/pico-examplesPICO_EXTRAS_PATH=/home/khman/pico/pico-extrasPICO_PLAYGROUND_PATH=/home/khman/pico/pico-playgroundPICO_SDK_PATH=/home/khman/pico/pico-sdk
Now MSYS2 has a picotool binary:

https://packages.msys2.org/packages/min ... 4-picotool

but let's build from source. Clone the picotool repo and build it using the following script:

Code:

./picotool_setup_msys2.sh
Build and install pioasm, using the following script:

Code:

./pioasm_setup_msys2.sh
Build the SDK samples:

Code:

cd ~/pico/pico-examplesmkdir build && cd buildcmake .. -DPICO_BOARD=pico -DPICO_PLATFORM=rp2040 -G "MSYS Makefiles"make
Some picotool commands that worked. picotool may ask the user to install a driver via Zadig.

Code:

picotool infopicotool reboot -fpicotool load -x blink.uf2
Tested on a Win 10 Pro (22H2) Intel PC.

I don't fully understand everything (especially stuff like build options) and I would want to test some more but it seems to be usable. MSYS2 cmake defaults to ninja. Built all pico-examples for pico/rp2040 successfully I think and blink_simple.uf2 ran fine on a Pico, uploaded using picotool. Since I won't be putting stuff on github, I am just dumping it here. :D
pico_sdk_setup_msys2.zip

Statistics: Posted by katak255 — Tue Mar 04, 2025 8:27 pm — Replies 0 — Views 28



Viewing all articles
Browse latest Browse all 4465

Trending Articles