Skip to content
Kio edited this page Oct 7, 2026 · 16 revisions

Welcome to the lib kilipili wiki!

Lib kilipili "Kios Little Pico Library" is a collection of tools to convert a Raspberry Pico board into a Gaming Device or a Computer. It started of with a VGA video library, as i tried to understand what Scanvideo does.

the Wiki is currently under reconstruction!

Boards

TODO

Quick Start, Quirks and Types

boards/ important settings are read from the boards header file as defined by the cmake variable PICO_BOARD.

Video output runs on core 1, uses 2 PIO state machines and 3 DMA channels.

Audio output runs on core 0 and uses 1 or 2 PIO state machines and 1 or 2 DMA channels.

SDCard normally uses an SPI instance, but uses a PIO-SPI to support non-standard pin assignment.

namespaces Lib kilipili is organized in 6 submodules, each in it's own namespace inside the overarching namespace kilipili: Audio, Devices, Graphics, USB and Video. common resides in namespace kilipili directly. Make your life easy by using namespace kilipili::Video etc.

common/standard_types.h provides the universal types as used in the library

cstr a data type seen throughout the library: a const char* intented to be a c string.

common/cstrings.h a c string library backed by tempmem.

common/tempmem.h a variant of an Arena memory management. Memory is tied to each core. Tempory memory is handed out as needed, most notably to cstring functions and piles up, so you must take actions:
IMPORTANT: call purge_tempmem() at least in your lowest level round-robin loop (or whatever).

common/RCPtr.h The reference counting pointer is the smart pointer used in the library. It requires a int rc of any integer type and size in the class. It basically does what std::shared_ptr does, but has a more conveniant syntax in many cases.

Exceptions Lib kilipili uses class Error instead of std::exception. class Error is just a fancy name for const char*. Exceptions normally throw a constexpr char[] and can therefore be even tested for by address. (at least so is the theory) Even the new replacement throws an Error. This should be fine even with stl libraries as long as they catch any exception, but probably they only catch std::exception. So that's the catch here, so to speak. Rationale for this choice is that this, at least in theory, uses less resources when throwing an exception.

common/malloc.h Lib kilipili provides a malloc replacement. This is because i found out that the original malloc from the stdc library sometimes did not return memory *even if it was available*. Side effect is that lib kilipili now offers lots of helper and inspection tools around the heap. And new and delete replacement functions.
In order to use lib kilipilis malloc, the file common/malloc.cpp must be included in the main project's make or cmake file. It cannot be part of the library, because this would end in some files using the old and some files using the new malloc, instant heap corruption guaranteed!

Clone this wiki locally