Skip to content

Quick start

This page assumes you have completed the installation and can run make TARGET=host. We will build the examples and run a few of them on the host — no hardware required.

A Lapilli application includes one header, hal/hal.h, and calls only lpl_* symbols. This blinks an LED:

#include "hal.h"
int main(void) {
lpl_system_init();
lpl_gpio_init(LPL_PIN_A0, LPL_GPIO_OUTPUT);
while (1) {
lpl_gpio_toggle(LPL_PIN_A0);
lpl_timer_delay_ms(500);
}
}

On an STM32L452RE this toggles a physical pin. On the host it prints GPIO state changes to stderr. There is no #ifdef, no platform check — the build system selects the port.

  1. Build the library and every example for the host:

    Terminal window
    make TARGET=host examples
  2. Run blinky — it prints GPIO state changes to stderr:

    Terminal window
    ./build/host/examples/blinky/blinky
  3. Run uart_echo — two processes talking over a Unix named pipe, exactly like two boards wired via UART:

    Terminal window
    ./build/host/examples/uart_echo/node_b &
    ./build/host/examples/uart_echo/node_a

Each example also has its own Makefile and can be built standalone from its own directory:

Terminal window
make -C examples/blinky TARGET=host ROOT=$(pwd)
Terminal window
make TARGET=host test

The HAL tests run as ordinary host processes. The POSIX port is the primary CI target — hardware is never a prerequisite for a green build.

If you installed arm-none-eabi-gcc, the very same examples cross-compile to a flashable binary:

Terminal window
make TARGET=stm32l4 examples
# → build/stm32l4/examples/blinky/blinky.bin (ready to flash)

See it live

The dashboard visualizes GPIO, UART, ADC, and the simulation bus in real time — and lets you inject signals back into the running firmware.