Picofuse is an SDK for developing embedded systems. You can use it to build applications that run on various boards and hosts, leveraging Objective-C and the provided frameworks. See the examples for how to get started:
- Download the SDK from the releases on GitHub, for your host.
- Unpack it in
/opt, or another absolute path of your choice. - Set the
PICOFUSE_SDKenvironment variable to the installation path, if it's not/opt/picofuse. - Create your project from a copy of an example in the
examplesdirectory, such ashelloworld. - Run
maketo build your project on the host, ormake DEVICES=<device>to build for a specific device: one of the project's JSON files, such asprestoforpresto.json, or a board, such aspico_w.
- Objective-C runtime
- Foundation framework, including threads and mutable objects
- Application framework: the application, its run loop, timers, pins, LEDs, serial ports, and key and move events
- Graphics framework: displays and drawing
- Devices framework:
a class for each device, such as
SDLWindow,PimoroniPrestoorLinuxInput - Network framework: the Wi-Fi radio, scanning, joining networks, an access point on a Pico, host name lookups, and the time from an NTP server
Build it with make doc, which runs Doxygen in Docker and writes it to doc/.
Each release has a tarball for each host: linux-amd64, linux-arm64 (which
covers a Raspberry Pi) and darwin-arm64. Each is a whole picofuse/ tree, to
unpack in /opt: picofuse and picofuse-objc for the host, with picotool and
testrunner, and for each board in boards.txt, with the
examples and the tutorial. A release is built with picofuse's release of the same
tag, so picofuse is tagged first.
picofuse-objc is built against an installed copy of
picofuse, and is installed into the
same place, so that the two make up one installation. That's /opt/picofuse,
unless you set PREFIX to another absolute path for both.
This builds and installs the Objective-C runtime and the Foundation, Application, Graphics, Devices and Network frameworks:
lib/<target>/libpicofuse-objc-gcc.a,-foundation.a,-application.a,-graphics.a,-devices.aand-network.a, with apkg-configfile for each inlib/<target>/pkgconfig/.<target>is the board, or the host (e.g.darwin-arm64)include/runtime/,include/Foundation/,include/Application/,include/Graphics/,include/Devices/andinclude/Network/- their headerscmake/picofuse_objc.cmakeandcmake/picofuse_objc_devices.cmake- what a program builds withexamples/andtutorial/- the examples, and the tutorial, whose links to them work in the installation too
A program links a framework other than Application with
picofuse_objc_executable(... FRAMEWORKS Devices), which links only the parts
it uses, and Devices brings Graphics with it. A window on a Mac or Linux needs SDL3,
which picofuse finds when it's built.
A program describes its hardware in a JSON file beside its sources, one for each setup, such as examples/bricks/presto.json:
{ "board": "pimoroni_presto",
"display": { "@class": "PimoroniPresto", "size": 480, "clock": 200 } }DEVICESnames the file:make DEVICES=presto, or-D DEVICES=presto- without it, it's
host.json, with no board, for the host "board"is the board it's built for, so a program doesn't needPICO_BOARD- a program without a file, such as helloworld, takes a board:
DEVICES=pico_w - with
NXApplicationFeatureDevices,[[application deviceManager] display]is its display, and only the classes it names are linked - on a host,
--devices <file>adds settings, such as a panel's"vcom" - see cmake/picofuse_objc_devices.cmake
The frameworks themselves are still built for a board with PICO_BOARD, below.
Requirements:
brew install cmake pkgconf gcc openssl@3 libusb sdl3Install picofuse, then test and install this:
# In picofuse
make install
# In picofuse-objc
make test
make install- This uses the latest version of GCC that Homebrew installed. Set
OBJC_COMPILERfor another. - Apple's
clang(and itsgccalias) can't be used: it doesn't support the GCC Objective-C runtime on a Mac.
Requirements on Debian (tested with trixie), where gobjc is the Objective-C
compiler for GCC:
sudo apt install build-essential cmake git pkgconf gobjc libssl-dev libusb-1.0-0-dev libsdl3-devInstall picofuse, then test and install this:
# In picofuse
make install
# In picofuse-objc
make test
make installRequirements, in addition to CMake and pkg-config:
- The Arm GNU Toolchain (
arm-none-eabi-gcc), which compiles picofuse and links programs. On a Mac,brew install --cask gcc-arm-embedded - Python 3, which the pico-sdk needs.
- The LLVM Embedded Toolchain for Arm,
which compiles Objective-C: the Arm GNU Toolchain has no Objective-C compiler.
It's expected in
/opt/LLVM-ET-Arm-19.1.5-Darwin-universal
Install picofuse for the board, then this. For example, for a Pico 2 W:
# In picofuse
make PICO_BOARD=pico2_w BUILD_DIR=build-pico2_w install
# In picofuse-objc
make PICO_BOARD=pico2_w BUILD_DIR=build-pico2_w install- Setting
PICO_BOARDcross-compiles for that board. - To flash and run the tests, connect the board through a debug probe, and use
make PICO_BOARD=pico2_w BUILD_DIR=build-pico2_w test. This needsopenocd, and the host installation of picofuse, fortestrunner. - If the LLVM toolchain is elsewhere, run
cmake -B <build directory> -D PICO_BOARD=<board> -D LLVM_ARM_TOOLCHAIN=<dir>first. - Use a separate build directory for each board.
- Use
picofor the Pico,pico_wfor the Pico W andpico2for the Pico 2.