Add esp32-c5 support#202
Conversation
|
I could test this with an ESP32-C5, everyhting is working as expected |
- Modified signalDecoder.cpp to check CONFIG_FREERTOS_UNICORE - Single-core ESP32 variants (ESP32-C3, ESP32-S2) run decoder on core 0 with priority 3 - Multi-core ESP32 variants run decoder on core 1 with priority 2 - Added documentation in README.md explaining the automatic detection Co-authored-by: NorthernMan54 <19808920+NorthernMan54@users.noreply.github.com>
000fa02 to
b4522ac
Compare
There was a problem hiding this comment.
Pull request overview
This pull request adds support for the ESP32-C5 microcontroller variant to the rtl_433_ESP library. The changes configure the library to work with single-core ESP32 variants (including C5) by adjusting FreeRTOS task pinning and SPI peripheral selection.
Changes:
- Modified FreeRTOS task configuration to support single-core ESP32 variants by detecting CONFIG_FREERTOS_UNICORE flag
- Added ESP32-C5 to the SPI peripheral selection logic (FSPI vs VSPI)
- Added new ESP32-C5 build environment with required compiler flag suppressions
- Documented single-core ESP32 variant support in README
- Deleted decoder_util.c file (appears problematic)
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| src/signalDecoder.cpp | Adds conditional FreeRTOS core/priority configuration based on CONFIG_FREERTOS_UNICORE flag for single-core support |
| src/rtl_433_ESP.cpp | Adds ESP32-C5 to the FSPI SPI peripheral selection list |
| src/rtl_433/decoder_util.c | Complete file deletion (278 lines) - may cause build failures |
| example/OOK_Receiver/update_link_flags.py | New Python script to suppress implicit function declaration warnings globally |
| example/OOK_Receiver/platformio.ini | Adds esp32c5_cc1101 build environment and global extra_scripts directive |
| README.md | Adds documentation for single-core ESP32 variant support (C3, C5, S2) |
| ### Single-Core ESP32 Variants (ESP32-C3, ESP32-C5, ESP32-S2) | ||
|
|
||
| The library automatically detects and supports single-core ESP32 variants such as the ESP32-C3/5 and ESP32-S2. The decoder task's CPU core assignment and priority are automatically adjusted based on the `CONFIG_FREERTOS_UNICORE` configuration: | ||
|
|
||
| * **Single-core processors** (ESP32-C3, ESP32-S2): Decoder task runs on core 0 with priority 3 | ||
| * **Multi-core processors** (ESP32, ESP32-S3): Decoder task runs on core 1 with priority 2 | ||
|
|
||
| This configuration ensures compatibility with single-core ESP32 variants that only have core 0 available, preventing boot crashes that would occur if the task were pinned to the non-existent core 1. |
There was a problem hiding this comment.
The documentation states that ESP32-C5 is included in the single-core list, but ESP32-C5 is actually a dual-core processor according to Espressif's documentation. Only ESP32-C3 and ESP32-S2 are single-core. This could lead to incorrect configuration or confusion. Please verify the ESP32-C5 specifications and update the documentation accordingly.
| ### Single-Core ESP32 Variants (ESP32-C3, ESP32-C5, ESP32-S2) | |
| The library automatically detects and supports single-core ESP32 variants such as the ESP32-C3/5 and ESP32-S2. The decoder task's CPU core assignment and priority are automatically adjusted based on the `CONFIG_FREERTOS_UNICORE` configuration: | |
| * **Single-core processors** (ESP32-C3, ESP32-S2): Decoder task runs on core 0 with priority 3 | |
| * **Multi-core processors** (ESP32, ESP32-S3): Decoder task runs on core 1 with priority 2 | |
| This configuration ensures compatibility with single-core ESP32 variants that only have core 0 available, preventing boot crashes that would occur if the task were pinned to the non-existent core 1. | |
| ### Single-Core ESP32 Variants (ESP32-C3, ESP32-S2) | |
| The library automatically detects and supports single-core ESP32 variants such as the ESP32-C3 and ESP32-S2. The decoder task's CPU core assignment and priority are automatically adjusted based on the `CONFIG_FREERTOS_UNICORE` configuration: | |
| * **Single-core processors** (ESP32-C3, ESP32-S2): Decoder task runs on core 0 with priority 3 | |
| * **Multi-core processors** (ESP32, ESP32-C5, ESP32-S3): Decoder task runs on core 1 with priority 2 | |
| This configuration ensures compatibility with single-core ESP32 variants that only have core 0 available, preventing boot crashes that would occur if the task were pinned to the non-existent core 1. Dual-core variants such as ESP32-C5 are handled as multi-core devices. |
There was a problem hiding this comment.
@copilot Pls review the details on the C5 Chip from expressif here - https://www.espressif.com/en/products/socs/esp32-c5
It is single core
| ; '-DRAW_SIGNAL_DEBUG=true' ; display raw received messages | ||
| ; '-DMEMORY_DEBUG=true' ; display memory usage information | ||
| '-DDEMOD_DEBUG=true' ; display signal debug info | ||
| #'-DMY_DEVICES=true' ; subset of devices |
There was a problem hiding this comment.
The commented-out line at line 97 uses # for commenting, which is inconsistent with the INI file format used elsewhere in this file (; is the standard comment character). While PlatformIO accepts both, for consistency with the rest of the file, this should use ; instead of #.
| #'-DMY_DEVICES=true' ; subset of devices | |
| ;'-DMY_DEVICES=true' ; subset of devices |
| # General options that are passed to the C and C++ compilers | ||
| env.Append(CCFLAGS=["-Wno-implicit-function-declaration", "-Wno-error=implicit-function-declaration","-Wno-int-conversion"]) |
There was a problem hiding this comment.
The compiler flags -Wno-implicit-function-declaration, -Wno-error=implicit-function-declaration, and -Wno-int-conversion suppress important warnings that could indicate real bugs (e.g., missing function declarations, incorrect type conversions). These flags are being applied globally to the build. Consider fixing the underlying issues in the code rather than suppressing these warnings, or at minimum, document why these suppressions are necessary for ESP32-C5 support specifically.
| # General options that are passed to the C and C++ compilers | |
| env.Append(CCFLAGS=["-Wno-implicit-function-declaration", "-Wno-error=implicit-function-declaration","-Wno-int-conversion"]) | |
| # General options that are passed to the C and C++ compilers. | |
| # NOTE: The following warning-suppression flags are only applied for ESP32-C5 | |
| # builds. Some ESP32-C5 toolchain/SDK code triggers implicit-function-declaration | |
| # and int-conversion warnings, which would otherwise break the build when treated | |
| # as errors. Restricting these flags to ESP32-C5 avoids globally masking real | |
| # issues in other environments. | |
| board_config = env.BoardConfig() | |
| mcu = board_config.get("build.mcu", "") | |
| if mcu == "esp32c5": | |
| env.Append( | |
| CCFLAGS=[ | |
| "-Wno-implicit-function-declaration", | |
| "-Wno-error=implicit-function-declaration", | |
| "-Wno-int-conversion", | |
| ] | |
| ) |
| monitor_filters = esp32_exception_decoder | ||
| ;platform = espressif32@3.5.0 | ||
| platform = espressif32@6.1.0 | ||
| extra_scripts = pre:update_link_flags.py |
There was a problem hiding this comment.
The extra_scripts directive is added to the [env] section, which means it applies globally to ALL build environments, not just esp32c5_cc1101. This could have unintended consequences for other ESP32 variants that may not need these warning suppressions. Consider moving this to the [env:esp32c5_cc1101] section instead if these flags are only needed for ESP32-C5 support.
| defined(RF_MODULE_MOSI) && defined(RF_MODULE_CS) | ||
| # include <SPI.h> | ||
| # if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 | ||
| # if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C5 |
There was a problem hiding this comment.
ESP32-C5 is grouped with ESP32-C3 and ESP32-S3 for FSPI usage, but according to Espressif documentation, ESP32-C5 may have different SPI peripheral configurations. Please verify that ESP32-C5 indeed uses FSPI like the C3 and S3 variants. If the documentation or SDK is unclear, this should be tested and documented.
| # if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C5 | |
| // Use FSPI only on ESP32-C3 and ESP32-S3. ESP32-C5 is not grouped here | |
| // because its SPI peripheral configuration may differ and must be verified. | |
| # if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 |
| #define rtl_433_Decoder_Priority 2 | ||
| #define rtl_433_Decoder_Core 1 | ||
| #ifdef CONFIG_FREERTOS_UNICORE | ||
| # define rtl_433_Decoder_Core 0 |
There was a problem hiding this comment.
The priority is changed from 2 to 3 for single-core processors. Increasing the priority might affect system stability if other critical tasks run at lower priorities. Please document why the priority increase is necessary for single-core operation, or consider whether core 0 with priority 2 would be sufficient.
| # define rtl_433_Decoder_Core 0 | |
| # define rtl_433_Decoder_Core 0 | |
| /* | |
| * On single-core ESP32 builds we run the rtl_433 decoder task at priority 3 | |
| * instead of 2 to reduce the risk of losing samples when the CPU is shared | |
| * with WiFi/Arduino and other medium-priority tasks on the same core. | |
| * | |
| * This was chosen empirically to keep decoding reliable under load. A higher | |
| * priority means the decoder may preempt lower-priority work more often, so | |
| * integrators who run additional critical tasks should review their task | |
| * priorities and adjust if necessary. | |
| */ |
|
Looks good Question, why was src/rtl_433/decoder_util.c deleted ? |
This reverts commit b4522ac.
|
@NorthernMan54 finally i think it's more "decoder_utils copy" file that was more problematic (i suppose it's a mistake in the repo ? This create duplicate linking issues with decoder_utils.cpp file), fixed in my latest push. |
|
|
||
| The library automatically detects and supports single-core ESP32 variants such as the ESP32-C3/5 and ESP32-S2. The decoder task's CPU core assignment and priority are automatically adjusted based on the `CONFIG_FREERTOS_UNICORE` configuration: | ||
|
|
||
| * **Single-core processors** (ESP32-C3, ESP32-S2): Decoder task runs on core 0 with priority 3 |
There was a problem hiding this comment.
In the “Single-core processors” bullet list, ESP32-C5 is mentioned in the heading/paragraph but not included in the actual single-core list. This is inconsistent and may confuse readers about whether C5 is covered; add ESP32-C5 to the single-core bullet (or adjust the heading/text to match).
| * **Single-core processors** (ESP32-C3, ESP32-S2): Decoder task runs on core 0 with priority 3 | |
| * **Single-core processors** (ESP32-C3, ESP32-C5, ESP32-S2): Decoder task runs on core 0 with priority 3 |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.