This document should give insights about the WHY we did WHAT and WHEN.
The FalconAS Linux port allows binding processes to CPU core IDs. The ESP32-C3 is a single core processor, and thus limited. A bigger variant ESP32-S3 integrates 2 CPU cores, it could be a good idea to seperate the web server processing and the micropython code execution.
To produce clean code we should abstract these two layers for both a) single core and b) dual core processing in a generic way. These two possibilities exist:
- RTOS tasks
- C++11 threading library
Seperating the web server and the python code could be done using 2 RTOS tasks, on dual-core controllers the micropython task later on can be run on a different CPU core.
Note
The C++ POSIX Thread Wrapper Library runs perfectly on the ESP-IDF platform. The LED fading control has been implemented using the POSIX thread API. Additionally, because RISC-V 32-bit and Xtensa 32-bit chipsets execute atomic reads and writes of 32-bit variables, using a thread::lock is unnecessary for simple, unprotected read / write mechanisms.
The project goal is to provide a in-web-server playable PONG game on two connected wifi-clients (smartphones). The ESP32-C3 acts as a Micropython Application Server, the game logic will be programmed in Python.
The ESP32-C3 has an attached OLED 1306 display which renders the complete game in realtime. The ESP32-C3 integrated web server will also host the application files, on smartphone browser connect the application will be transfered to the browser, started; following communication is abstracted via HTTP/1.1 POST with JSON payload.
To connect the smartphones without using other peripherals, we also will integrate a micro-tiny DNS (UDP-only) server which will only react on a single static DNS IPv4 A query to the applications host pong.game.
The DNS server also will be run as RTOS task.
- Networking sockets (lwIP) type is BSD
- Networking sockets (lwIP) must be implemented non-blocking
We will provide ESP32 C++ higher level networking abstraction libraries with the following logical components:
- Networking
- ServerTCP
- ServerUDP
- ClientHandler
The resulting firmware binary should be small in size, include all required functionality and security features.
With the following settings, we achieved to build a firmware image of apx. 500 Kilobyte size:
- Wifi access point (only WPA2 personal, WPA3 and WPA3 enterprise disabled)
- Include mbedTLS library (for HTTPS server)
- Disable debug build, optimize for size (-Os compiler flag)
- Only IPv4 (no IPv6) lwIP stack
- Disable C++ exceptions and RTTI (real time type information)