Developer news
2026-11-12 12:15
ESP32 daily use
We've been using PXX successfully for an ESP32 project involving multiple devices. Sensors, networking, mesh (ESP-NOW), OTA (over the air updates) all work. Pxx had some optimizations to reduce code size. Networking and ansistring on an ESP32 with hundreds of kilobytes heap RAM available!
- Boards and chips. The same Pascal source builds and runs on the ESP32-C3 (RISC-V), the ESP32-S3 and the classic ESP32 (Xtensa), as an ESP-IDF component. The ESP32-S2 builds too, but is untested on hardware.
- Smaller code. On
--platform=esp, riscv32 now emits RV32C compressed instructions by default. In our test programs that cut the compiler-reported code size by about 16–18%. Dead-code elimination now drops unreferenced literals, constants and class tables. RTTI and VMTs move to flash, and smallerTextbuffers alone give back almost 20 KB of RAM. - I/O and networking. GPIO, ADC, I2C and an RTC on the hardware side. Wi-Fi as access point and station, an HTTP server with a captive portal, NTP, ESP-NOW between boards, and the coroutine scheduler's reactor on lwIP.
- OTA updates with rollback. A new image is uploaded over Wi-Fi; an image that crashes on its first boot is rolled back. One board can also pass its own firmware on to another.
- Room to spare. With Wi-Fi up and the web server running, the C3 still has about 230 KB of free heap at boot, and the S3 about 260 KB.
Our application
A home sensor project - networked devices with a web UI, ESP-NOW between the boards and OTA updates.
- About 11,000 lines of Pascal in 27 units and some 900 routines. It is one firmware for every role and chip.
- No C of its own. Even
app_maincomes from the pxx-built object; C appears only as the ESP-IDF headers it imports. - Managed strings throughout. It uses
AnsiStringeverywhere: config parsing, the web pages, JSON and the log. The strings are reference-counted, with no fixed buffers to overflow;PCharappears only at the IDF boundary. - Heap. It has about 229 KB free at boot on the C3, and about 226.6 KB after heavy web use. The heap stays flat in long soak runs.
Current work
Work on master continues: Nil Python keeps closing gaps against CPython. Code size on the ESP is a standing item, with 64-bit arithmetic and string building at the top of the list.
BSD
We started work on kernels other than Linux, beginning with the BSDs: a native FreeBSD target over raw syscalls, and OpenBSD through its libc.