Skip to content

v0.18.0

Choose a tag to compare

@GianfriAur GianfriAur released this 31 Aug 13:18
· 40 commits to master since this release
bf2fc70

[0.18.0] — Benchmarks, memory introspection, a SQLite API choice, PHP 8.5.10, and project foundations

Added

  • baremetal_utility: read the real memory footprint from PHP. A built-in extension (always
    compiled in, like gpio) exposing the ESP-IDF heap: psram_free(), psram_size(),
    psram_largest_free(), heap_free(), heap_size(). It fills a real gap -- with USE_ZEND_ALLOC=0
    the Zend heap lives in PSRAM via malloc, so PHP's own memory_get_usage() reads 0; these
    report the actual heap, which also counts everything (op_arrays, zvals, buffers), not just PHP's
    arena. Registered across every PHP version (8.3-8.5).
  • New benchmark example: real, on-device numbers for memory and GPIO. It
    prints, at boot, the engine's PSRAM baseline, the PSRAM a compiled script costs (three reference
    classes), the working set of a data workload (sized to the PSRAM on hand, so it runs on a 2 MB board
    too), and the GPIO toggle rate from a tight PHP loop. Verified across the PSRAM range -- ESP32-S3-Zero
    "Super Mini" (2 MB Quad), ESP32-S3 (8 MB Octal), ESP32-P4 (32 MB): a compiled script costs ~5x its
    source everywhere (it's the engine, not the chip); the PHP GPIO loop is CPU-bound (~155 kHz at
    160 MHz, ~279 kHz at 360 MHz). Answers the memory and throughput questions people ask with
    measurements instead of estimates.
  • PHP 8.5.10 available. A drop-in patch update of 8.5.9 (all 10 port patches apply unchanged and
    the source file set is identical). Verified on ESP32-S3 hardware. 8.5.9 stays available; the default
    stays 8.4.25.
  • [extensions.sqlite] type: choose the SQLite API layer. The sqlite extension now builds either
    PDO + pdo_sqlite (type = "pdo-sqlite", the default) or the procedural SQLite3-class API
    (type = "sqlite3", ext/sqlite3). Both share the same SQL engine (the amalgamation is built once),
    so the choice is only the API surface: sqlite3 is about 45 KB smaller (no PDO layer) and gives
    the SQLite3/SQLite3Stmt/SQLite3Result classes; pdo-sqlite keeps portable PDO code working.
    Wired end to end -- a new enum setting in the manifest (the first kind = "enum" setting, validated
    by check-manifest), phpflash's config, interactive init and -DPHP_EXT_SQLITE_API flag, and the
    CMake source/registration split across every PHP version (8.3-8.5). Verified on ESP32-S3 hardware:
    both APIs create a table, insert and query. New sqlite3-notes example
    (the SQLite3-class counterpart to sqlite-notes, which now spells out
    type = "pdo-sqlite").
  • Continuous integration (GitHub Actions). Checks each version's manifest and compiles the base
    firmware across versions, boards and project types, with caching and a per-board image-size budget
    (.github/workflows/ci.yml, ci/check-size.sh). QEMU smoke test scaffolded (WIP).
  • Project docs: a roadmap (the 1.0.0 → 3.0.0 milestones), contributing
    guidelines (hardware verification is mandatory before a PR), a security policy, and an
    AI usage policy.

Fixed

  • SQLite loadExtension() no longer breaks the link. SQLITE_OMIT_LOAD_EXTENSION drops
    sqlite3_load_extension() from the amalgamation, but both Pdo\Sqlite::loadExtension() and
    SQLite3::loadExtension() reference it -- an undefined reference that surfaced when SQLite was
    linked alongside other extensions. Added no-op stubs (components/php/compat/sqlite_loadext_stub.c):
    the method links and fails cleanly at runtime, since loading a shared object isn't possible on the chip.
  • CI build reliability. Fixed a stale PHP_VERSION default and a source check firing during
    ESP-IDF's early expansion (guarded with CMAKE_BUILD_EARLY_EXPANSION); fetch-php.sh now caches the
    verified tarball, not the read-only extracted tree, so a restored cache can't leave an empty source dir.