Back in January of this year (2021), the Raspberry Pi Foundation came out with their first microcontroller board calling it the Raspberry Pi Pico.
The microcontroller chip (RP2040) used on the Pico was designed by the Raspberry Pi foundation and features a dual-core Arm Cortex-M0+ processor with 264KB internal RAM, support for up to 16MB of off-chip Flash and a wide range of flexible I/O options which includes I2C, SPI, and Programmable I/O (PIO). The PIO is something unique in the microcontroller world. The RP2040 was also made available to other microcontroller board manufacturers so we are now seeing boards from Adafruit, Arduino, Sparkfun and others. It will be interesting to see how this chip is used in the future, especially in regards to the programmable I/O (PIO).
Coding (i.e. setting up a development environment) for the Raspberry Pi Pico on a Raspberry Pi is made easy by all the great documentation that is available from the Raspberry Pi Foundation.
Although, the documentation is designed specifically for using a Raspberry Pi and the Rasbian OS, you might find other similar Linux distros mentioned in the documentation (like Debian). There is a pico-setup script provided but it is only useful on Rasbian.
Programmers have their choice of Python (using MicroPython or CircuitPython), C/C++ (using the SDK) or native assembler (using pioasm). If you are developing in C/C++, I highly recommend the Pico Project Generator tool for creating new projects.
I happen to like and use the Fedora Linux distro (Fedora 34 at the time of this post). Fedora is a lot different than Raspbian and some of the software dependencies needed for pico development and debugging are not documented. Actually, some of the pico tools do not compile correctly on Fedora without some modifications. Fedora tends to be on the leading edge and has more recent software development ‘toolchain‘ packages.
There were two specific things I found that did not work on Fedora without modification. OpenOCD and PicoTool (both documented in the Getting Started Guide) compiled and worked OK on Raspbian but did not compile under Fedora.
To resolve these issues and make something to easily install ‘everything’, I created a Python script (and other shell based scripts) to download and install the software development kit (SDK), tools, documentation and software dependencies for either Fedora or Raspian. All of these scripts work on either OS. When installing on Fedora, the scripts make the necessary modifications to compile OpenOCD and PicoTool correctly.
Download the pico-setup.zip file and unzip it to a directory of your choice. Something like:
mkdir /opt/pico
cd /opt/pico
wget https://microcontrollerelectronics.com/sourcecode/pico-setup.zip
unzip pico-setup.zip
The python script (pico-setup.py) and all of the provided shell scripts are designed to run either on a RedHat (Fedora) system or a Raspberry Pi with Raspbian. The scripts (if necessary) determine which OS is being used at runtime.
Pico-setup.py accepts from one to three parameters (Toolchain, Install, Remove).
The ‘toolchain‘ parameter installs (via APT or DNF depending on the OS) the necessary prerequisite packages for these scripts to work on the underlying OS. The ‘install’ parameter runs all the provided shells scripts. However, the shell scripts can be run independently and thus only the ones specifically desired (although some depend on the SDK being installed first and they also depend on the OS toolchain dependencies being installed). The provided README.txt file provides more documentation on its usage.
Recent Comments