You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "tmedicci (via GitHub)" <gi...@apache.org> on 2026/03/26 18:53:05 UTC

[PR] xtensa/espressif: Update common-source integration for Xtensa devices [nuttx]

tmedicci opened a new pull request, #18614:
URL: https://github.com/apache/nuttx/pull/18614

   ## Summary
   
   Following [#18492](https://github.com/apache/nuttx/pull/18492), this PR updates the common-source integration for Xtensa-based
   Espressif devices (ESP32, ESP32-S2, and ESP32-S3). This is part of a larger common-source update split by architecture for better maintainability.
   
   Major components updated:
   - IRQ allocator refactoring with intr_alloc integration
   - Common-source drivers (GPIO, RMT, I2C, SPI, UART, etc.)
   - Espressif components upgrade to release/master.b-test, just like it was done for Espressif's RISC-V-based devices.
   - Peripheral drivers (ADC, PWM, LEDC, MCPWM, PCNT, Temperature Sensor, etc.)
   - Wireless adapters (Wi-Fi and BLE)
   - esp_timer migration to the common-source path for Xtensa devices
   - Common-source power management implementation (auto-sleep and wakeup paths)
   - Board defconfigs for all Xtensa Espressif boards
   - SMP support improvements for ESP32-S3
   - Critical section handling improvements
   
   Key architectural changes:
   - IRQ Allocator: The new interrupt allocator enables multiple mapping options from interrupt sources to CPU interrupts, providing flexibility required by modern peripherals. Although this introduces breaking changes to the interrupt handling API, the required `ARCH_MINIMAL_VECTORTABLE` Kconfig option is explicitly checked during startup to ensure proper configuration. This validation prevents runtime issues from configuration mismatches.
   - Xtensa-specific interrupt handling via esp_xtensa_intr.c providing NuttX-native implementations of xt_ints_on/off and interrupt handlers, avoiding conflicts with NuttX's core Xtensa macros.
   - Timer/RTC unification: ESP32/ESP32-S2/ESP32-S3 move from chip-specific RTC/RT-timer code to common-source Espressif integration, including esp_timer_adapter/esp_rtc paths and the required bringup/defconfig updates.
   - Power management consolidation: Xtensa PM follows the common-source implementation, including common-source auto-sleep behavior, UART/Wi-Fi wakeup coordination, and tickless-safe sleep flow compatibility.
   
   Note: This is a large commit to maintain bisectability. Breaking the changes into smaller commits would result in non-building intermediate states across the common-source infrastructure update.
   
   ### Note to the Reviewers:
   
   Although it's a huge PR, reviewing it is not that difficult. Some key points can be summarized here:
   - Peripherals' changes (`nuttx/arch/xtensa/src/common/espressif/`) are mostly related to either path changes and the new IRQ allocator.
   - Exceptions are:
     - The RMT peripheral, which required a refactor to be fully compatible with the new common-source base (deprecated code was removed) and the `espXX_rt_timer`, which was moved to a common-source approach. Public API's didn't change.
   - `defconfigs` were updated to be compatible with the new IRQ allocator. Although it is a breaking change from user's perspective, the required Kconfig-selectable options are checked at `arch/xtensa/src/common/espressif/esp_irq.c`
   
   ## Impact
   
   Impact on user: Yes, they need to update their defconfig to select the following Kconfig:
   
   ```
   CONFIG_ARCH_IRQ_TO_NDX=y
   CONFIG_ARCH_MINIMAL_VECTORTABLE_DYNAMIC=y
   CONFIG_ARCH_NUSER_INTERRUPTS=2
   ``` 
   
   Please note that these options are checked with pre-processor macros, so it can't be "left behind".
   
   Impact on build: Yes. Build will fail if the newer Kconfig options aren't selected.
   
   Impact on hardware: Yes. This change is mandatory to support newer Espressif devices on NuttX.
   
   Impact on documentation: No.
   
   Impact on security: No.
   
   Impact on compatibility: Yes, this is a breaking change with minor effects. The missing Kconfig options are checked with pre-processor macros and guide the user to select the required configs.
   
   ## Testing
   
   All Espressif's defconfigs were tested with hardware in the loop. In addition to peripherals' testing, `ostest` is checked too
   
   ### Building
   
   #### Cleaning Existing Builds
   
   ```
   make -j distclean
   ``` 
   
   #### Select either ESP32, ESP32-S2 or ESP32-S3
   
   ##### ESP32
   ```
   ./tools/configure.sh -S esp32-devkitc:ostest
   ```
   
   ##### ESP32-S2
   ```
   ./tools/configure.sh -S esp32s2-saola-1:ostest
   ```
   
   ##### ESP32-S3
   ```
   ./tools/configure.sh -S esp32s3-devkit:ostest
   ```
   
   #### Building and Flashing
   
   ```
   make flash -s -j$(nproc) && picocom -b 115200 /dev/ttyUSB0
   ```
   
   ### Running
   
   ```
   nsh> ostest
   ```
   
   ### Results
   
   ```
   ostest_main: Exiting with status 0
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] xtensa/espressif: Update common-source integration for Xtensa devices [nuttx]

Posted by "simbit18 (via GitHub)" <gi...@apache.org>.
simbit18 commented on PR #18614:
URL: https://github.com/apache/nuttx/pull/18614#issuecomment-4141308124

   HI @tmedicci please fix
   
   ```
   ====================================================================================
   Configuration/Tool: heltec_wifi_lora32/sx1276
   2026-03-26 20:25:54
   ------------------------------------------------------------------------------------
     Cleaning...
     Configuring...
     Building NuttX...
   board/esp32_sx127x.c: In function 'sx127x_irq0_attach':
   Error: board/esp32_sx127x.c:93:3: error: implicit declaration of function 'esp32_gpioirqdisable'; did you mean 'esp_gpioirqdisable'? [-Wimplicit-function-declaration]
      93 |   esp32_gpioirqdisable(irq);
         |   ^~~~~~~~~~~~~~~~~~~~
         |   esp_gpioirqdisable
   Error: board/esp32_sx127x.c:108:3: error: implicit declaration of function 'esp32_gpioirqenable'; did you mean 'esp_gpioirqenable'? [-Wimplicit-function-declaration]
     108 |   esp32_gpioirqenable(irq, RISING);
         |   ^~~~~~~~~~~~~~~~~~~
         |   esp_gpioirqenable
   board/esp32_sx127x.c: In function 'sx127x_chip_reset':
   Error: board/esp32_sx127x.c:128:3: error: implicit declaration of function 'esp32_gpiowrite'; did you mean 'esp_gpiowrite'? [-Wimplicit-function-declaration]
     128 |   esp32_gpiowrite(GPIO_SX127X_RESET, 0);
         |   ^~~~~~~~~~~~~~~
         |   esp_gpiowrite
   make[1]: *** [/github/workspace/sources/nuttx/boards/Board.mk:83: esp32_sx127x.o] Error 1
   make[1]: Target 'libboard.a' not remade because of errors.
   make: *** [tools/LibTargets.mk:89: arch/xtensa/src/board/libboard.a] Error 2
   make: Target 'all' not remade because of errors.
   /github/workspace/sources/nuttx/tools/testbuild.sh: line 385: /github/workspace/sources/nuttx/../nuttx/nuttx.manifest: No such file or directory
     [1/1] Normalize heltec_wifi_lora32/sx1276
   ====================================================================================
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] xtensa/espressif: Update common-source integration for Xtensa devices [nuttx]

Posted by "tmedicci (via GitHub)" <gi...@apache.org>.
tmedicci commented on PR #18614:
URL: https://github.com/apache/nuttx/pull/18614#issuecomment-4142496556

   > I agree with @lupyuen. @tmedicci Please create a new pull request with the changes to the CI jobs
   
   Alright, I'll create a new PR only for that. But I'll keep the commit here to avoid interrupting the current pipeline. It'd be ignored when rebasing after all.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] xtensa/espressif: Update common-source integration for Xtensa devices [nuttx]

Posted by "tmedicci (via GitHub)" <gi...@apache.org>.
tmedicci commented on PR #18614:
URL: https://github.com/apache/nuttx/pull/18614#issuecomment-4142092043

   > HI @tmedicci please fix
   > 
   > ```
   > ====================================================================================
   > Configuration/Tool: heltec_wifi_lora32/sx1276
   > 2026-03-26 20:25:54
   > ------------------------------------------------------------------------------------
   >   Cleaning...
   >   Configuring...
   >   Building NuttX...
   > board/esp32_sx127x.c: In function 'sx127x_irq0_attach':
   > Error: board/esp32_sx127x.c:93:3: error: implicit declaration of function 'esp32_gpioirqdisable'; did you mean 'esp_gpioirqdisable'? [-Wimplicit-function-declaration]
   >    93 |   esp32_gpioirqdisable(irq);
   >       |   ^~~~~~~~~~~~~~~~~~~~
   >       |   esp_gpioirqdisable
   > Error: board/esp32_sx127x.c:108:3: error: implicit declaration of function 'esp32_gpioirqenable'; did you mean 'esp_gpioirqenable'? [-Wimplicit-function-declaration]
   >   108 |   esp32_gpioirqenable(irq, RISING);
   >       |   ^~~~~~~~~~~~~~~~~~~
   >       |   esp_gpioirqenable
   > board/esp32_sx127x.c: In function 'sx127x_chip_reset':
   > Error: board/esp32_sx127x.c:128:3: error: implicit declaration of function 'esp32_gpiowrite'; did you mean 'esp_gpiowrite'? [-Wimplicit-function-declaration]
   >   128 |   esp32_gpiowrite(GPIO_SX127X_RESET, 0);
   >       |   ^~~~~~~~~~~~~~~
   >       |   esp_gpiowrite
   > make[1]: *** [/github/workspace/sources/nuttx/boards/Board.mk:83: esp32_sx127x.o] Error 1
   > make[1]: Target 'libboard.a' not remade because of errors.
   > make: *** [tools/LibTargets.mk:89: arch/xtensa/src/board/libboard.a] Error 2
   > make: Target 'all' not remade because of errors.
   > /github/workspace/sources/nuttx/tools/testbuild.sh: line 385: /github/workspace/sources/nuttx/../nuttx/nuttx.manifest: No such file or directory
   >   [1/1] Normalize heltec_wifi_lora32/sx1276
   > ====================================================================================
   > ```
   
   Wow, I had fixed that internally, I may have dropped the fix during squash. Thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] xtensa/espressif: Update common-source integration for Xtensa devices [nuttx]

Posted by "tmedicci (via GitHub)" <gi...@apache.org>.
tmedicci commented on PR #18614:
URL: https://github.com/apache/nuttx/pull/18614#issuecomment-4144927626

   > > I agree with @lupyuen. @tmedicci Please create a new pull request with the changes to the CI jobs
   > 
   > Alright, I'll create a new PR only for that. But I'll keep the commit here to avoid interrupting the current pipeline. It'd be ignored when rebasing after all.
   
   Tracked at https://github.com/apache/nuttx/pull/18641


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] xtensa/espressif: Update common-source integration for Xtensa devices [nuttx]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #18614:
URL: https://github.com/apache/nuttx/pull/18614


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] xtensa/espressif: Update common-source integration for Xtensa devices [nuttx]

Posted by "lupyuen (via GitHub)" <gi...@apache.org>.
lupyuen commented on PR #18614:
URL: https://github.com/apache/nuttx/pull/18614#issuecomment-4142383444

   Maybe we can split the CI Jobs into a separate PR? Might be easier to review (and potentially rollback) thanks :-)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] xtensa/espressif: Update common-source integration for Xtensa devices [nuttx]

Posted by "simbit18 (via GitHub)" <gi...@apache.org>.
simbit18 commented on PR #18614:
URL: https://github.com/apache/nuttx/pull/18614#issuecomment-4142463169

   I agree with @lupyuen. @tmedicci Please create a new pull request with the changes to the CI jobs 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org