SkillAgentSearch skills...

PicoLibSDK

Alternative extended C/C++ SDK library for Raspberry Pico/Pico2 and RP2040/RP2350.

Install / Use

/learn @Panda381/PicoLibSDK
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

PicoLibSDK - Alternative SDK library for Raspberry Pico, RP2040 and RP2350

SDK Programmer's Guide, Version 2.09, May 2025

Copyright (c) 2023-2025 Miroslav Nemecek

Panda38@seznam.cz hardyplotter2@gmail.com https://github.com/Panda381/PicoLibSDK https://www.breatharian.eu/hw/picolibsdk/index_en.html https://github.com/pajenicko/picopad https://picopad.eu/en/

About

PicoLibSDK is an alternative extended C/C++ SDK library for the Raspberry Pico or Pico 2 module with the RP2040 or RP2350 processor (in the ARM or RISC-V mode), but it can also be used for other modules which use these processors. Compared to the original SDK library, officially provided with the Raspberry Pico, the PicoLibSDK library tries to extend the functionality of the original library and especially to make the SDK library easier to use. But most of functions of original SDK are provided here as well, for backwards compatibility. What you can find in the PicoLibSDK library:

  • Boot Loader: Boot loader allowing to select and run UF2 programs from SD card.

  • SDK hardware control: ADC, boot ROM, clocks control, CPU control, hardware divider, DMA, doorbells, double and float arithmetics, FIFO mailboxes, flash programming, GPIO, HSTX, I2C, hardware interpolator, IRQ, multicore, PIO, PLL, PWM, QSPI, reset and power control, ROSC, RTC, SHA256, SPI, spinlocks, SysTick, alarm timer, TMDS, TRNG, watchdog, XOSC. The RP2350 processor can be used in ARM or RISC-V mode.

  • Tool library: alarm, 32-bit Unix calendar, long 64-bit astronomic calendar, canvas drawing, RGBA color vector, CRC check with DMA support, decode numbers, emulators, escape packet protocol, event ring buffer, FAT file system, doubly linked list, memory allocator, 2D transformation matrix, mini-ring buffer, formatted print, PWM sound output with ADPCM, random generator, rectangle, ring buffer, DMA ring buffer, SD card, streams, text strings, text list, text print, tree list, VGA drawing, video player, MP3 player.

  • USB library: multiplayer mini-port, CDC device and host - serial communication, HID device and host - including external keyboard and mouse.

  • Big intergers: calculations with large integers, calculation of Bernoulli numbers.

  • Real numbers: calculations with floating-point numbers with optional precision up to 3690 digits and 30-bit exponent. Scientific functions with optional calculation method - Ln, Exp, Sqrt, Sin, Cos, Tan, arcus, hyperbolic functions and many more. Linear factorials with accurate and fast calculation.

  • Display drivers: Prepared support of TFT, VGA and HDMI display with resolution 320x240 up to 800x600, with 4, 8, 15 or 16 bits output.

  • Devices: Support of Picoino/PicoinoMini with 8-bit QVGA display, DemoVGA with 16-bit VGA display, Picotron with 4-bit VGA display and PicoPad with 16-bit TFT display. Some samples are also prepared for the basic Raspberry Pico without additional hardware.

License

The library source code is, with a few exceptions, completely free to use for any purpose, including commercial use. It is possible to use and modify all or parts of the library source code without restriction. Some libraries (mainly single- and double-floating-point mathematics) are mostly the copyrighted work of Raspberry Pi and are therefore subject to the licensing terms of the original authors.

Building

The compilation of the PicoLibSDK library and its sample examples is mainly prepared for easy use on Windows. It does not require any additional programs and utilities, only the installation of the GCC ARM compiler.

GCC ARM Installation in Windows

Download the GCC ARM compiler from https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads. You can use Windows Installer. To compile RP2350 (Pico 2), you will need GCC-ARM compiler version 13.3 or more. To compile RP2350 in RISC-V mode, you will need Hazard3 RISC-V compiler. You can use GCC-RISCV32 compiler version 13.2 or more: https://www.embecosm.com/resources/tool-chain-downloads/#corev. This version does not support compressed instructions, resulting code is a litle bigger. If you will use GCC version 14.2, you will need to build it yourself, but you can also use compressed RISC-V instructions, the resulting code will be smaller. In such case, edit Makefile.inc in base directory of PicoLibSDK, and change compilation switch to GCC 14 (search “CPU Architecture”). You can install both compilers in the same directory, e.g. C:\ARM.

In the last stage of the installation, enable the "Add path to environment variable" option. This will ensure that the compiler files will be found. Note: If you are using a shell program such as FAR, you must exit and restart the program to update the PATH system variable.

How to compile in Windows

The compilation of the PicoLibSDK library was prepared primarily for ease of use in cooperation with the FAR file manager or another file manager that supports the console window. For each sample application, there are several BAT command files that can be easily run from the FAR by pressing a letter and Enter. The compilation is done using c.bat (in FAR press letter C and Enter). The d.bat file is used to clean up the compilation and delete generated intermediate files. Use e.bat to send the compiled program to the Raspberry Pico. The a.bat file performs all 3 operations at once - cleaning up old compilation, compile the program and send it to the Pico.

The target device for which the compilation is performed is passed as a parameter via the command line. A default target device is prepared in the c.bat file in case you do not specify it as a parameter. In the Pico folder, the default compilation is for the target device 'pico' (the Raspberry Pico module itself without any added hardware), in the DemoVGA folder the compilation is for 'demovga', in the Picoino folder the compilation is for 'picoino10', in the Picotron folder the compilation is for 'picotron' and in the PicoPad folder the default compilation is for 'picopad20' (or select 'picopad10' or 'picopad20riscv' batch file).

If the target device is not passed to the compilation files, it is compiled for the default device set in the _setup.bat file. This also applies if you compile all programs using c_all.bat. You can change the default target device by moving the :default label in the _setup.bat file.

Sending the program to Pico using e.bat is done by copying the file to the Pico access disk. This assumes that the Pico access disk is labeled R: (like Raspberry). If your disk has a different name, correct the disk name in the _e1.bat file (in the base folder of the PicoLibSDK library) or rename the disk in the system disk management (This Computer - Service - Disk Management - Change Drive Letter and Paths).

Cleaning up the compilation can be useful not only to clean up the application directory, but also during application development. Normally, all files are compiled during the first compilation. When recompiling, only the changed files are compiled. However, this only applies to *.c and *.cpp and *.s files, not *.h header files. If you make a change to a *.h file, you may need to either modify the C file that uses that *.h file, or clean up the compilation with d.bat before recompiling to do a complete compilation.

The Windows compilation does not use CMake to optimize the compilation, all files are always compiled. This can be tedious, however - the programmer usually spends most of the time thinking and writing the program, and only a small part on compiling. Therefore, it may be preferable to handle the compilation more easily, rather than saving some compilation time. The final code is not affected

  • the linker will only use the parts of the program that are really needed in the final code. If you want to use some part of the library, you usually don't need to activate its compilation (with exceptions such as USB or real numbers), you just use necessary functions in the program.

How to compile in Linux

The PicoLibSDK library contains basic script files for program compilation. After downloading the PicoLibSDK library to the Linux, it is necessary to set the EXEC attribute of the execution scripts - the scripts are exported from the Windows environment and therefore do not have the EXEC attribute set. You can use the following command to set the script attribute in a batch:

find . -type f -name *.sh -exec chmod +x {} ;

To compile, you need at least the elf2uf2 program, which you can get from the original SDK library. Place the program in the _tools folder. Second, you will need the LoaderCrc program, which is used to calculate the checksum of applications run by the boot3 loader. You can find the source code for this program in the _tools/PicoPadLoaderCrc folder where you can compile it.

As a working environment, it is a good idea to use Midnight Commander, with which you can edit programs and immediately compile and run them using prepared scripts.

To compile the program, run the c.sh script. Compilation is done implicitly for the target device PicoPad 1.0. If you want to compile for a different device, you can either pass the device name as a parameter via the command line, or edit the parameters for the default target device in the _setup.ch script, where you can also find the names of possible target devices.

The d.sh script is used to clean up the compilation and delete generated intermediate files. Use e.sh to send the compiled program to the Raspberry Pico

  • to use it, edit mount point in _e1.sh. The a.sh file performs all 3 operations at once - cleaning up old compilation, compile the program and send it to the Pico. You will also need to delete the compiled files using d.sh if you change the contents of the *.h header file. Without clearing the compilation, the recompilation of dependent *.c files would not take place (dependency method is not us
View on GitHub
GitHub Stars89
CategoryDevelopment
Updated17d ago
Forks13

Languages

C++

Security Score

85/100

Audited on Mar 10, 2026

No findings