radio_esp32
The adapter between Espressif’s radio blobs and FlintOS.
Phase 3 of doc/plan-radio.md, issue #65.
What this is
Section titled “What this is”Espressif’s Wi-Fi and BLE support ships as precompiled .a files built
against FreeRTOS. They do not link against an RTOS directly — they call out
through [osi::WifiOsiFuncs], a table of 115 function pointers covering
tasks, queues, semaphores, event groups, allocation, interrupts and the
PHY. This crate fills that table in.
Everything the object-model half needs already exists: kernel::dynobj
(#58) and kernel::heap (#57) were built for exactly this and are host- and
hardware-tested on their own. Most of what remains here is translation —
FreeRTOS’s conventions into FlintOS’s — and the translation is where the
bugs live, so each one is written down at the function that performs it.
The layer concession
Section titled “The layer concession”This is the only crate in the tree permitted to name kernel. That is a
deliberate, single exception recorded in tools/check-layers.sh: the blob
demands a kernel’s object model, and the alternative to answering here is
answering everywhere. If a second crate ever wants kernel, that is a
signal to ask why rather than to widen the rule.
Status
Section titled “Status”The table is complete: 115 of 115 on the target, and
esp_wifi_init_internal returns ESP_OK on an ESP32-DevKitC. That is the
first thing that has ever proved an entry right — a table can only be
checked by the blob calling it, and until #67 nothing had.
What has not been proved is every entry: init exercises allocation, task creation, queues, semaphores, the PHY and the NVS family. Scan and associate (5.2, 5.3) are what reach the rest.
[WifiOsiFuncs::for_each_null] reports whatever is still null, by name.
There is deliberately no hand-written list of gaps — there was one, and it
was a year out of date; see the note above table().
The blobs are fetched, not vendored — make blobs pulls them at pinned
revisions with checksums, and build.rs links whatever is in
.blobs/esp32, or tells you to run make blobs if it is empty. Without
that step this crate still builds and tests on its own.
Modules
Section titled “Modules”adapter— Filling in [crate::osi::WifiOsiFuncs].calibration— RF calibration data, persisted across reboots.coex— The nineteen_coex_*entries: Wi-Fi/Bluetooth coexistence.ets_timer—ETSTimer— the blob’s software timers, andesp_timer_get_time.events— The driver’s events: a bounded queue and a task that drains it.interrupts—_set_intr,_clear_intrand_set_isr— the blob’s route to annet— The smoltcp link layer for an associated Wi-Fi station.nvs—nvs_*— the blob’s key/value store, overlib/kvstore.osi—wifi_osi_funcs_t: the table Espressif’s blobs call out through.phy— Bringing the PHY up, and the calibration that goes with it.phy_init— The PHY’s initialisation parameters.scan— Scanning for access points. Step 5.2 ofdoc/plan-radio.md, issue #67.station— The ESP32 blob backend of [hal::wifi::Station].supplicant— The radio glue for the first-party WPA2 supplicant.tasks—_task_create,_task_create_pinned_to_coreand_task_delete— thewifi—esp_wifi_init_internal— handing the Wi-Fi driver its configuration.