Repository navigation
feat: FreeRTOS port, with ESP-IDF as its first platform - #13
Merged
Merged
Conversation
The connections and TLS of <tedge/port/net.h>, and the device key and CSR of <tedge/port/crypto.h>, only need BSD sockets and mbedTLS 4. They move from the POSIX port to ports/common/, so the ESP-IDF port can use them too. The POSIX port keeps the interface queries, the key file, and its socket options, through the hooks in tedge_common.h. The CA bundle generation moves to ports/common/cmake/tedge_ca_bundle.cmake. check-portability.py lets ports use ports/common, and holds ports/common to the same rules as the core. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ports/freertos/ holds the kernel services on the FreeRTOS API (static tasks, mutexes, queues, event groups, timers), which any FreeRTOS platform can reuse. ports/freertos/esp-idf/tiny_edge/ is an ESP-IDF component that adds NVS settings, esp_netif, SNTP, OTA with rollback, and ESP_LOG, and uses ports/common/ for sockets, TLS, and the device key. Every option is in Kconfig as CONFIG_TEDGE_*. Threads that run a TLS handshake of their own get a 12 KB stack: the log upload used 8.1 KB on an ESP32-C6 and overflowed 8 KB. Log lines longer than the 127-byte upload buffer are cut with "..." and keep their line break. The samples/minimal application joins Wi-Fi, logs the registration URL, and publishes a measurement. A CI workflow builds it for the ESP32-C6, ESP32-S3, and ESP32. Core printf formats use PRId32/PRIu32, because int32_t is long on the ESP-IDF toolchains. Co-Authored-By: Claude Opus 5.5 <[email protected]>
An image built without a Wi-Fi network uses the one ESP-IDF stored on the device, so a firmware image uploaded to Cumulocity carries no Wi-Fi password. The README lists what was tested on an ESP32-C6: parameter changes and a firmware update, besides what was there before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The ESP-IDF port runs an allow-listed esp_console command that the application registered, on a thread of its own, and reports what it printed. While a command runs, stdout keeps only what the command's task prints and passes everything else to the console. The allow-list, the "help" answer, and the timeout are the core's, as on Zephyr; the default allow-list is empty, so nothing runs until the integrator names commands. The sample registers free, version, and uptime, and allows those three. The command thread's stack defaults to 4 KB: the sample's commands used 1.2 KB on an ESP32-C6. The README lists what was tested on an ESP32-C6 (shell commands, and a firmware rollback), and that debug lines also need CONFIG_LOG_MAXIMUM_LEVEL_DEBUG. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A FreeRTOS port of tiny-edge, so ESP-IDF applications can use the same client as the Zephyr and POSIX ports: the same core, the same options, and the same behavior in Cumulocity.
About 93% of the ESP-IDF build is shared code:
core/ports/common/(new)ports/freertos/src/ports/freertos/esp-idf/tiny_edge/src/Commits
ports/common. The POSIX port shrinks by about 790 lines and keeps only its platform hooks (interface queries, key file, socket options).scripts/check-portability.pyallows ports to useports/common/, and holds it to the core's rules.pvPortMalloc. It uses only the FreeRTOS API, so another FreeRTOS platform (an STM32 with lwIP, for example) can reuse it.tiny_edge: NVS settings,esp_netif, SNTP,esp_otawith bootloader rollback, andESP_LOGwith log upload. Every option is aCONFIG_TEDGE_*Kconfig option.samples/minimal: joins Wi-Fi, logs the registration URL, and publishes a measurement..github/workflows/freertos.yml): ESP-IDF 6.1 builds for the ESP32-C6, ESP32-S3, and ESP32 with every feature, and an ESP32-C6 build with a reduced set.PRId32/PRIu32in two log lines, becauseint32_tislongon the ESP-IDF toolchains.Testing
-Werror: 3/3 tests pass, and the core still compiles without an RTOS.help,free,version, anduptimereturned their output, andrestart(not on the allow-list) was refusedc8y_Command) withesp_console(see the README's "Shell commands"; the command thread used 1.2 KB of stack, and defaults to 4 KB), and let the sample build images without Wi-Fi settings: they use the network stored on the device, so an image uploaded to Cumulocity carries no Wi-Fi password.Not in this port yet
Crash dumps, the provisioning library (Improv), and plain FreeRTOS builds outside ESP-IDF.
Related
#12 reports an operation interrupted by a reset as failed. This PR's README lists that behavior as tested on the C6, so merge #12 first.
🤖 Generated with Claude Code