-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
Description
Hello,
I would like to propose an implementation approach to add ESP-Hosted support for NuttX.
I've researched the implementation required to support ESP-Hosted on NuttX. I studied the architecture of ESP-Hosted-NG (the Linux kernel module) and the NuttX network stack along with its lower-half network driver interfaces.
Implementation
ESP-Hosted-NG exposes an API compatible with Linux 802.11 drivers. Its internal architecture roughly follows the structure below (this is largely undocumented, so I derived it from the source code).
+------------------------------------------------------------------------------+
| ESP-Hosted-NG Linux Kernel Module Architecture |
|------------------------------------------------------------------------------|
| Linux Networking Interface |
| cfg80211/mac80211 subsystem hooks and registered driver |
|------------------------------------------------------------------------------|
| ESP hosted Core Driver API (esp_api / esp_cmd) |
| Provides the primary API used by the driver to communicate with the |
| ESP32-series co-processor (esp_api.h & esp_cmd.h) |
|------------------------------------------------------------------------------|
| . . . |
|------------------------------------------------------------------------------|
| Transport Abstraction (esp_if_ops) |
| struct esp_if_ops provides function pointers for transport operations such |
| as read(), write(), init(), etc. |
|------------------------------------------------------------------------------|
| Physical Transport Driver implementation (OS specific) (SPI/SDIO) |
| Populates esp_if_ops with implementation for read, write, init, etc. as per |
| communcation medium |
|------------------------------------------------------------------------------|
- ESP-Hosted provides the
esp_apiinterface used by the host driver to interact with the ESP co-processor.. (esp_apiesp_cmd - This API includes functions for device initialization, configuration, and wireless interface management.
- There is a transport abstraction
esp_if_opswhich stores function pointers for a communication interface. Transport implementations (e.g., SDIO or SPI) populate this structure to provide read(), write(), init(), and related operations.
esp_hosted nuttx module functionality
- The module registers as a lower-half network driver with the NuttX network stack and populates the
netdev_ops_s(and wireless control operations where applicable) structs with implementations that forward calls to the correspondingesp_apifunctions. - Implementation of an
esp_nuttx_spitransport interface that operates on a NuttXspi_dev_sdevice and populatesesp_if_ops, registering itself as a communication interface. - During initialization, the driver acquires the SPI device, initializes the
esp_adapter, and performs device initialization.
current Progress
- I've setup esp-hosted on raspi 3B+ connected to ESP32C3 running esp-hosted firmware and acting as a co-processor for the host. The additional wlan interface functions normally (running it in AP mode) .
- I have also got stm32F107 running nuttX where I plan to carry further development.
upcoming planned tasks
I intend to demonstrate a module interfacing with an ESP32xx device over SPI via esp_api. The initial goal is a basic example that initializes the device and fetches firmware info.
For this I would need to:-
- Port esp_api from linux to nuttx. (
esp_apicurrently relies on Linux data structures and kernel primitives for threading and synchronisation.) - Develop an
esp_nuttx_spitransport implementation that operates on a NuttX SPI device and binds it to theesp_apitransport abstraction (esp_if_ops). - make API calls to initialise the device and interface and get device info via
esp_get_hardware_name().
About Me
- I'm a final-year B.Tech student in Electronics and Telecommunication Engineering at VIIT, Pune.
- I've previously contributed to linux kernel (IIO subsystem) and micro-ROS
- I've experience working with various RTOSes such as FreeRTOS, zephyr and ESP-IDF specifically with ESP32xx MCUs.
References
Reactions are currently unavailable