A portable driver for the Morse Micro MM6108/MM8108 802.11ah (Wi-Fi HaLow) transceivers: host-agnostic C that an embedding environment integrates by providing a small configuration header. It presents a compact station model -- a state object holding the lwIP interfaces, a link status that folds the WLAN and TCP/IP state together, and a poll function the host drives.
The vendor stack (morselib) and the transceiver firmware/board-configuration
blobs come from the Morse Micro
MM-IoT-SDK, included here as the
lib/mm-iot-sdk submodule. morselib is a prebuilt library under the Morse
Micro Binary Distribution Licence; the driver runs it cooperatively off the
host's scheduler through a small OSAL shim -- no vendor RTOS.
src/-- the driver:mm_halow_config.h-- the host integration contract. The embedder providesmm_halow_configport.h(or the file named byMM_HALOW_CONFIG_FILE) supplying atomic sections, a millisecond tick, pin accessors, and themm_halow_port_*functions (SPI transport, private heap backing, hardware RNG, fallback MAC, optional edge IRQ).mm_halow_ctrl.c-- driver core: init/deinit, connect/scan/status, the morselib event plumbing.mm_halow_lwip.c-- the lwIP netif.mm_halow_hal.c-- morselib'smmhalinterface, mapped onto themm_halow_port_*hooks (SD-over-SPI framing, reset/wake sequencing, firmware/BCF blob serving).mm_halow_osal.c/mm_halow_sched.c-- morselib'smmosalinterface: a private heap (morselib allocates from interrupt context, where a host GC must not run) and a cooperative scheduler with a wall-clock budget.mm_halow_pktmem.c-- the packet-memory pool.mmport.h-- morselib's port header (name fixed by the SDK).
mm_halow.mk-- build fragment for make-based embedders: prebuilt morselib linkage (grouped with the target multilib's libc/libm) and the firmware/BCF blob embedding.tests/host-- allocator tests, compiled natively from the real sources (make,make asan).tests/qemu-- scheduler tests on a Cortex-M55 under QEMU (make), since the context switch is naked asm that cannot run on the host.
- Add
src/to the include path along withlib/mm-iot-sdk/framework/morselib/include, and compilesrc/*.c. - Provide
mm_halow_configport.h;src/mm_halow_config.hdocuments every hook and fails the build naming whatever is missing. - Link the prebuilt
morseliband the transceiver firmware blob --mm_halow.mkdoes both for make-based builds. morselib is built against newlib and pulls in a few C library functions (sscanf,qsort,setjmp, ...) that in turn reference newlib's syscall back-end (_sbrk,_write, ...). The host must provide that back-end; MicroPython's ports already do. morselib never calls these at run time, so the back-end only needs to satisfy the link -- and_sbrkin particular should fail rather than hand out memory, since the driver runs entirely from its own heap. (If the host links-nostdlib, also group libc/libm with morselib, as the fragment does.) - Drive
mm_halow_poll()from the host's deferred-work mechanism and callmm_halow_schedule_poll()when the transceiver's IRQ line asserts (or poll by level; the driver checks the line each pass).
The MicroPython network.HALOW binding is the reference embedding.