A port implements the hardware abstraction layer (../hal/lx_hal.h) for one MCU family. How to write one: docs/firmware/porting.md.
| Port | Status | Flash / RAM used | Build | Flash with |
|---|---|---|---|---|
| host | simulator and tests, used by CI on every change | PC | make test, make sim |
|
| attiny1616 | builds and links; not yet tested on hardware | 11.4 KB of 16 KB / 0.2 KB of 2 KB | make tiny1616 BOARD=<board> |
UPDI (pymcuprog) |
| ch32v003 | builds and links; not yet tested on hardware | 11.8 KB of 15.75 KB / 0.5 KB of 2 KB | make ch32v003 BOARD=<board> |
WCH-LinkE (minichlink) |
| esp32c3 | experimental; checked against the ESP-IDF API, CI build configured (allowed to fail until it has passed once); not yet compiled with ESP-IDF or tested on hardware | idf.py build |
USB |
“Not yet tested on hardware” means exactly that: the code follows the datasheets and reference manuals and has been checked by building, by disassembly (vector tables, start-up) and by review, but nobody has run it on a board. The first board for each port goes through the bring-up in docs/testing.md before anything else.
ports/host/sim.cpp implements the HAL on top of a simulated flashlight (cell, LED and driver,
two-node thermal model, sensor with lag and noise, USB charger, emulated EEPROM, console).
Details: docs/firmware/simulator.md.
The MCU of many current enthusiast drivers (Microchip tinyAVR 1-series).
LX_TINY_PWM_WO (default WO0 = PB0).LX_TINY_TEMP_OFFSET_DC adds a board offset.make tiny1616-fuses UPDI_PORT=<port> (0x44: 2.6 V, on while running, off in
power-down) (DRV-8).avr/pgmspace.h; the chip header
tiny1x_io.h is generated from Microchip’s ATDF file by atdf_to_header.py, and
crt_avrxmega3.S is the start-up code, so the port does not depend on avr-libc’s device
support for this chip.A 32-bit RISC-V MCU that costs about $0.13 in quantity and runs from 2.7 to 5.5 V.
LX_CH32_EN_PORT/LX_CH32_EN_PIN) switches the driver off at level 0.LX_CH32_VREFINT_MV;
calibrate with BAT_CAL).LX_CH32_NTC_RFIX, _R25 and _BETA (../hal/lx_ntc.h).link.ld) emulate the
EEPROM; a changed page is erased and written again. The parameters, the calibration and the
lockout/memory record are in different pages, so the frequent state saves never touch the
calibration. Known limitation: every state save erases its page, and flash has a limited
number of erase cycles (see the datasheet); a wear-levelling log is planned.startup.S (vector table with absolute addresses, mtvec mode 3), link.ld.riscv64-unknown-elf-gcc 13 (Ubuntu package gcc-riscv64-unknown-elf) with
-march=rv32ec_zicsr -mabi=ilp32e.The ESP32-C3 port runs the FlashKa keychain light under ESP-IDF 5.x: v0.5 with one button, and v0.6 with three buttons on a resistor ladder (one pin measures the ladder with the ADC, a second pin on the same net wakes the chip), of which LuxLibre uses the main button. How a board declares a ladder: docs/firmware/porting.md. See esp32c3/README.md for building and its limitations; the ladder path is untested on hardware.