Raspberry Pi Pico program template for C. https://www.hs-anhalt.de

Tobias Müller 2596ff69e4 update settings.json to adjust cmake update changes 8 meses atrás
.vscode 2596ff69e4 update settings.json to adjust cmake update changes 8 meses atrás
core f22c8a3822 update firmware files 8 meses atrás
docs 6e7a395eb0 inital commit 1 ano atrás
inc 376e1315b5 update cmakelist, main, header 1 ano atrás
libs 40348faac3 update CMakeLists.txt 1 ano atrás
pics 6e7a395eb0 inital commit 1 ano atrás
src 376e1315b5 update cmakelist, main, header 1 ano atrás
.gitignore 6e7a395eb0 inital commit 1 ano atrás
CMakeLists.txt 376e1315b5 update cmakelist, main, header 1 ano atrás
LICENSE 6e7a395eb0 inital commit 1 ano atrás
README.md 2596ff69e4 update settings.json to adjust cmake update changes 8 meses atrás
README.pdf 2596ff69e4 update settings.json to adjust cmake update changes 8 meses atrás

README.md

Raspberry Pi Pico - Template for C

Table of Content

  1. Introduction
  2. Required Software and Library
  3. Required Visual Studio Code Plugins
  4. Recommended Visual Studio Code Plugins
  5. Optional Visual Studio Code Themes

1. Introduction

This repository can be used as a template for a new Raspberry Pi Pico C-Project.

Note: Once you have downloaded/cloned this repository, open it in Visual Studio Code. Note, to follow the guideline of folder structure and all necessary programs and plugins for Visual Studio Code. Open cmake in Visual Studio Code and build the "blink" project. Copy the "blink.uf2" file from the build folder to the Raspberry Pi Pico by following the instructions according to the description in Core.

2. Required Software and Library (Windows/Mac-OS/Linux)

Regardless which operating system is used for compilation, the Pico-SDK is always needed. The Raspberry Pi version of OpenOCD is optional and only required, if the Pico should be debugged and the system integrated version of OpenOCD does not support Picoprobe as a debugger. Picoprobe is also optional and only required, if a second Pico should be used as a debugger.

Name Description Link
Raspberry Pi Pico-SDK
The Raspberry Pi Pico SDK (henceforth the SDK) provides the headers, libraries and build system necessary to write programs for the RP2040-based devices such as the Raspberry Pi Pico in C, C++ or assembly language. https://github.com/raspberrypi/pico-sdk
Raspberry Pi OpenOCD
(optional)
OpenOCD provides on-chip programming and debugging support with a layered architecture of JTAG interface and TAP support. https://github.com/raspberrypi/openocd
Raspberry Pi Debugprobe
(optional)
Debugprobe allows a Pico / RP2040 to be used as USB -> SWD and UART bridge. This means it can be used as a debugger and serial console for another Pico. https://github.com/raspberrypi/debugprobe

This repository refers to the Pico-SDK, which must be in search path. The Pico-SDK must be at the same folder level as this repository. If debugging is needed, also the OpenOCD folder must be at the same level.

Project Folder
 |
 ├──Pico-SDK
 |
 ├──OpenOCD (optional)
 |
 └──<This Repository>

Windows

For windows is an installer available, which provide all the necessary tools to compile C-Code for the Raspberry Pi Pico.

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

This intstaller includes the following software:

Mac-OS

On Mac-OS the following software is needed to compile C-Code for the Raspberry Pi Pico.

Name Description Link
Visual Studio Code
Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, macOS and Linux. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages and runtimes (such as C++, C#, Java, Python, PHP, Go, .NET). https://code.visualstudio.com/
Git
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. https://git-scm.com/
Homebrew Formulae (CMake)
CMake is an extensible, open-source system that manages the build process in an operating system and in a compiler-independent manner. Unlike many cross-platform systems, CMake is designed to be used in conjunction with the native build environment. https://formulae.brew.sh/formula/cmake
Homebrew Formulae (Arm-None-EABI-GCC)
The GNU Arm Embedded Toolchain is a ready-to-use, open-source suite of tools for C, C++ and assembly programming. The GNU Arm Embedded Toolchain targets the 32-bit Arm Cortex-A, Arm Cortex-M, and Arm Cortex-R processor families. The GNU Arm Embedded Toolchain includes the GNU Compiler (GCC) and is available free of charge directly from Arm for embedded software development on Windows, Linux, and Mac OS X operating systems. https://formulae.brew.sh/formula/arm-none-eabi-gcc#default

The Installation for Toolchain and CMake depends on Homebrew, if you don’t have Homebrew installed you should go ahead and install it.

$ /bin/bash -c "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Then install the Toolchain and CMake.

$ brew install cmake
$ brew tap ArmMbed/homebrew-formulae
$ brew install arm-none-eabi-gcc

Linux

On Linux the following software is needed to compile C-Code for the Raspberry Pi Pico.

Name Description Link
Visual Studio Code
Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, macOS and Linux. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages and runtimes (such as C++, C#, Java, Python, PHP, Go, .NET). https://code.visualstudio.com/
Git
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Part of Linux Distribution
CMake
CMake is an extensible, open-source system that manages the build process in an operating system and in a compiler-independent manner. Unlike many cross-platform systems, CMake is designed to be used in conjunction with the native build environment. Part of Linux Distribution
Arm-None-EABI
The GNU Arm Embedded Toolchain is a ready-to-use, open-source suite of tools for C, C++ and assembly programming. The GNU Arm Embedded Toolchain targets the 32-bit Arm Cortex-A, Arm Cortex-M, and Arm Cortex-R processor families. The GNU Arm Embedded Toolchain includes the GNU Compiler (GCC) and is available free of charge directly from Arm for embedded software development on Windows, Linux, and Mac OS X operating systems. Part of Linux Distribution

Git, CMake and Toolchain are normally part of the Linux Distribution and can be installed with the package manager.

Arch Linux

pacman -S git cmake arm-none-eabi-gcc arm-none-eabi-gdb arm-none-eabi-newlib arm-none-eabi-binutils

Debian/Ubuntu based Linux

sudo apt update
sudo apt install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib build-essential

Raspbian (Raspberry Pi)

If you are developing for Raspberry Pi Pico on the Raspberry Pi 4B, or the Raspberry Pi 400, most of the installation steps can be skipped by running the setup script.

Note: This setup script requires approximately 2.5GB of disk space on your SD card, so make sure you have enough free space before running it. You can check how much free disk space you have with the df -h command.

wget https://raw.githubusercontent.com/raspberrypi/pico-setup/master/pico_setup.sh
chmod +x pico_setup.sh
./pico_setup.sh

3. Required Visual Studio Code Plugins

Name Description Link
C/C++
The C/C++ extension adds language support for C/C++ to Visual Studio Code, including editing (IntelliSense) and debugging features. https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools
CMake
This extension provides support for CMake in Visual Studio Code. https://marketplace.visualstudio.com/items?itemName=twxs.cmake
CMake Tools
CMake Tools CMake Tools provides the native developer a full-featured, convenient, and powerful workflow for CMake-based projects in Visual Studio Code. https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools