<< Back

 

Cesky: , English:

PiLibSDK

Raspberry Pi bare-metal SDK library

Pre-alpha version 0.30, in progress - under development

Last Update: 06/05/2026

(c) 2026 Miroslav Nemecek

https://github.com/Panda381/PiLibSDK

Download library along with sample applications and all resources (360 MB)

Notes: Schematics and printed circuit boards are in KiCAD 9 format.

Contents

 

Intro

PiLibSDK is a bare-metal library for Raspberry Pi modules. "Bare-metal" means that programs run directly on the hardware without an operating system, they are not controlled by the operating system, and they have full access to the hardware. Raspberry Pi modules can thus be used in a similar way to microchips. Another advantage is that the device is fully operational within 3 seconds of powering on. Currently, the Raspberry Zero 1, Zero 2 W, Pi 2, and Pi 3 modules are supported. Support for the Pi 4 and Pi 5 modules is very limited, and they will likely not be supported in the future either, as their benefits for bare-metal use are minimal.

Sample programs have been prepared for the BarePi modular microchip kit (links: www, GitHub). Of course, you don’t have to follow the hardware wiring exactly, but this is the most common pin-to-signal mapping. The main device is the ZeroTiny game console, which corresponds to the configuration of the "Zero," "Base," and "KeyPad" modules.

A boot loader is available for BarePi devices, which allows easy launching of programs from an SD card. The programs are ready for BarePi and ZeroTiny, with Zero 1, Zero 2 32-bit, or Zero 2 64-bit modules. The Zero 1 and Zero 2 modules differ primarily in speed - the Zero 2 is noticeably faster than the Zero 1. The higher speed is due not only to a higher processor frequency but also to a newer architecture. In addition, the Zero 2 module has 4 cores, while the Zero 1 has only one core. Therefore, it is strongly recommended to use the Zero 2 module. Use the Zero 1 module only if you own it and have no better use for it. The Zero 2 module can be operated in 32-bit or 64-bit mode. The compilations are prepared for both modes. From a user’s point of view, there is no noticeable difference between the modes. It is recommended to prefer 64-bit mode, which may be slightly faster in some cases.

The BarePi kit can be controlled using either the "KeyPad" gaming keyboard or the "MiniKey" alphanumeric keyboard. The keys on the "KeyPad" keyboard are also mapped to the keys on the "MiniKey" keyboard. To distinguish between key labels, action keys from the gaming keyboard are listed in square brackets, while character keys are listed without brackets. For example, "[A]" denotes the "A" action key on the gaming keyboard. The meanings of the keys on the gaming keyboard and their mapping to the alphanumeric keyboard are as follows.

Note: A boot loader is not required to run programs. You can run programs directly on the Zero1/Zero2 module itself, without additional hardware or a boot loader. Copy the system files from the Root directory of the corresponding !ZeroTiny* folder to the SD card. You will need the files "bootcode.bin", "config.txt", "fixup.dat", and "start.elf". Copy the program to the Root folder as well, and rename it to KERNEL.IMG. The program will start automatically when power is turned on.

 

License

All of my source code and data are completely free to use for any purpose. The exception is certain files derived from third-party sources - these are subject to the original author’s license. This includes most fonts, as well as portions of source files taken from the Circle library and Linux code - these sections are marked in the source files.

Most fonts in this library are not my creation. They were downloaded from the internet from unknown sources, with unknown license terms of use. If you want to use only strict licenses, do not use fonts from this library.

 

Compilation

To compile 32-bit mode, you will need AArch32 GCC (tool name "arm-none-eabi"). Install to C:\ARM_GCC32.

https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/arm-gnu-toolchain-15.2.rel1-mingw-w64-i686-arm-none-eabi.msi

To compile 64-bit mode, you will need AArch64 GCC (tool name "aarch64-none-elf"). Install to C:\ARM_GCC64.

https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/arm-gnu-toolchain-15.2.rel1-mingw-w64-i686-aarch64-none-elf.msi

from https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads

If you will use another paths, edit paths in _c1.bat (set GCC_PI_PATH).

 

Directories

To prepare the SD card, format it to FAT32, copy the contents of the !BarePi folder to it, as well as one of the !BarePi_* folder (depending on the module type).

 

ZeroTiny

ZeroTiny is the simplest game console based on the Raspberry Pi Zero 1 or Zero 2 modules. This corresponds to the assembly of the "Zero," "Base," and "KeyPad" modules from the BarePi kit. It is recommended to preferably use the Zero 2 module in 64-bit mode. The Zero 1 module may be noticeably slower in some applications. ZeroTiny features 9 buttons, a stereo PWM audio output, and an HDMI display output. A boot loader is available, allowing for easy program launch from an SD card.

The ZeroTiny is designed in a sandwich-style construction. In my prototype, I connected the Zero module to the motherboard via an 8mm header - primarily to facilitate easy module replacement. If you solder the Zero module to the board using only a pin header, the design will be lower. However, this may make repairs more difficult, such as replacing a button.

Detailed materials for ZeroTiny hardware can be found in the "_devices/BarePi/ZeroTiny" folder.

Source code and sample programs can be found in the "Apps" folder.

You can find the compiled sample programs in the "!BarePi*" folders, organized by module type and processor mode.

The ZeroTiny console built from the BarePi modules:

 

Sample Applications

System


KERNEL - Loader of
applications

SYSINFO - System
information

Book


ABC - Fairy Tales
from the Alphabet
(Czech)

GINGER - Gingerbread
House (English)

GINGERCZ -
Gingerbread House
(Czech)
   

Demo


BALLOONS - Flying
balloons

BIGFACT - Factorial of
123456789!

DRAW - Drawing
graphic elements

EARTH - Rotating
globe

FLAG - Fluttering flag

FLAG2 - Fluttering
custom flag

FOUNTAIN - Draw
3D graph

FRUITY - 130 music
loops with MP3
compression

HELLO - Simplest
example

HYPNO - hypnotic
rotating pattern

LEVMETER -
simulation of music
spectrum indicator

LINEART - draw line
flower

LINES - relaxation line
pattern generator

MATRIX - matrix code
rain

OSCIL - simulation of
oscilloscope signal

PF2027 - Christmas
animation

PI - calculating
number Pi to 4780
digits

PIXELS - random
generation of colored
pixels

RAYTRACE - 3D
pattern generation by
ray tracing method

SPHERES - random
spheres

SPOTS - random
spots

TWISTER - twisting
textured block

WATER - simulation
of rippling water
surface
 

Games


ANTS - card game

ATOMS - Game of exploding atoms

EGGS - Logic game as Reversi

FIFTEEN - Logic puzzle game

FLAPPY - Logic game from Sharp MZ800

CHESS - Chess game

INVADERS - Shooting game Space Invaders

LIFE - Cell life simulator

MAZE - Find way out of maze

PACMAN - Action game Pac-Man

PICTOR - Picopad Collector

RAPTOR - Shooting game

MP3

I recommend using MP3 files with a constant bitrate. Some older MP3 formats, or MP3s with a variable bitrate, may not allow you to move the playback pointer, or the track may end prematurely before the end. The player only supports short file names - that is, the name of an MP3 file can be up to 8 characters long. If a folder also contains a JPG image with the same name as the MP3, with dimensions of 320x240 pixels, it will be displayed instead of the info page. You can switch between the image and the info using the [X] key. The [B] key plays the current directory starting from the first track. The [A] key starts playback from the current track.

The player comes with a sample set of songs, in the style of various artists, created in Suno AI. In total, there are 248 tracks, containing 13 hours of music. Samples can be downloaded here.

Download samples part 1 (200 MB): styles of ABBA, The Beatles, Breton Celtic, Classical

Download samples part 2 (224 MB): styles of Computer, Cyberpunk, Enya, Folk

Download samples part 3 (213 MB): styles of Children, Jean-Michel Jarre, J-pop

Download samples part 4 (217 MB): styles of Loreena McKennitt, Medieval, Meditation, Metal, Vox Angeli

Download samples part 5 (207 MB): styles of Mixed, Nightwish with Tarja Turunen, Mike Oldfield


MP3 - MP3 player

Test


TESTLED - test
BarePi bus with
TESTLED module

 

Miroslav Nemecek

<< Back