Skip to content

espressif: Add CMake build paths for Xtensa ESP32 chips and esp32c3-legacy.#18828

Draft
arjav1528 wants to merge 3 commits intoapache:masterfrom
arjav1528:dev-issue-15839
Draft

espressif: Add CMake build paths for Xtensa ESP32 chips and esp32c3-legacy.#18828
arjav1528 wants to merge 3 commits intoapache:masterfrom
arjav1528:dev-issue-15839

Conversation

@arjav1528
Copy link
Copy Markdown
Contributor

Note: Please adhere to Contributing Guidelines.

Summary

Extends the NuttX CMake flow for Espressif targets that were mainly covered by Make before.

  • Xtensa (arch/xtensa): Shared Espressif Xtensa CMake under arch/xtensa/src/common/espressif/, plus chip CMakeLists.txt / hal_*.cmake for ESP32, ESP32-S2, and ESP32-S3 (HAL includes via ESP_HAL_3RDPARTY_REPO / CHIP_SERIES).
  • Boards (boards/xtensa): CMakeLists.txt for common, common/src, and esp32-devkitc, esp32s2-saola-1, esp32s3-devkit.
  • Legacy RISC-V: CMake for esp32c3-legacy and esp32c3-legacy-devkit (hal_esp32c3-legacy.cmake and board/common CMake).

Additive build-system files only; no runtime OS logic changes in this PR.

Impact

  • Users: CMake builds for the listed Xtensa boards and esp32c3-legacy-devkit gain explicit wiring; Make builds are unaffected by these files.
  • Build / hardware: As above; no Kconfig changes in this scope.
  • Docs / security / compatibility: No doc changes; no new security surface; backward compatible for Make users.

Testing

Hardware: I do not have Espressif boards available, so I could not flash images, exercise the serial console, or run on-target tests (e.g. NSH, drivers).

Build / CI: This change is CMake-only (new CMakeLists.txt / .cmake wiring). Please rely on NuttX CI and/or a maintainer/local build with the documented Espressif toolchains and esp-hal-3rdparty checkout for full configure + link verification, for example:

cd nuttx
cmake -B build -DBOARD_CONFIG=esp32-devkitc:nsh -GNinja
cmake --build build

arjav1528 added 3 commits May 1, 2026 02:19
Add a shared Espressif Xtensa CMake layer and chip-level CMake entry points
for ESP32, ESP32-S2, and ESP32-S3 to mirror existing Make-based bring-up.
This enables CMake builds to resolve common Espressif arch and HAL wiring.

Signed-off-by: Arjav Patel <arjav1528@gmail.com>
…ards.

Introduce common and board-level CMakeLists for esp32-devkitc,
esp32s2-saola-1, and esp32s3-devkit so the new Xtensa arch CMake paths
are reachable through board builds.

Signed-off-by: Arjav Patel <arjav1528@gmail.com>
Add esp32c3-legacy architecture CMake entry points and representative
board/common CMake files so legacy ESP32-C3 targets can be built through
the same CMake flow used by modern Espressif RISC-V targets.

Signed-off-by: Arjav Patel <arjav1528@gmail.com>
@github-actions github-actions Bot added Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Arch: xtensa Issues related to the Xtensa architecture Size: L The size of the change in this PR is large Board: risc-v Board: xtensa labels May 1, 2026
@simbit18 simbit18 marked this pull request as draft May 1, 2026 07:12
@simbit18
Copy link
Copy Markdown
Contributor

simbit18 commented May 1, 2026

Hi @arjav1528 , I've marked PR as a draft.

Hi @fdcavalcanti @tmedicci @eren-terzioglu, can you run some tests?

@simbit18
Copy link
Copy Markdown
Contributor

simbit18 commented May 1, 2026

A quick test I ran

Nuttx repository: arjav1528/nuttx
    Nuttx branch: dev-issue-15839
 Apps repository: apache/nuttx-apps
     Apps branch: master
          Config: esp32-devkitc:nsh
    Build system: all
Nuttx repository: arjav1528/nuttx
    Nuttx branch: dev-issue-15839
 Apps repository: apache/nuttx-apps
     Apps branch: master
          Config: esp32s2-kaluga-1:nsh
    Build system: all

Same issue

Configuring incomplete, errors occurred!

-- nuttx_add_subdirectory: Skipping cxx-oot-build
-- Initializing NuttX
Loaded configuration '/github/workspace/sources/nuttx/build/.config.compressed'
Minimal configuration saved to '/github/workspace/sources/nuttx/build/defconfig.tmp'
  Select HOST_LINUX=y
--   CMake:  3.26.0
--   Ninja:  1.10.1
--   Board:  esp32-devkitc
--   Config: nsh
--   Appdir: /github/workspace/sources/apps
-- The C compiler identification is GNU 12.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /tools/ccache/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- NuttX Host Tools
-- CMake C compiler: GNU
-- CMake system name: Linux
-- CMake host system processor: x86_64
   TOOLS_DIR path is "/github/workspace/sources/nuttx"
   HOST = Linux
-- Configuring done (0.4s)
-- Generating done (0.0s)
-- Build files have been written to: /github/workspace/sources/nuttx/build/bin_host
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- The ASM compiler identification is unknown
-- Found assembler: xtensa-esp32-elf--gcc
CMake Error at CMakeLists.txt:475 (project):
  The CMAKE_C_COMPILER:

    xtensa-esp32-elf--gcc

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:475 (project):
  The CMAKE_CXX_COMPILER:

    xtensa-esp32-elf--g++

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:475 (project):
  The CMAKE_ASM_COMPILER:

    xtensa-esp32-elf--gcc

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "ASM" or the CMake cache entry CMAKE_ASM_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


-- Warning: Did not find file Compiler/-ASM
-- Configuring incomplete, errors occurred!

Hi @arjav1528 , as you’re using macOS, I’d recommend you run some tests with this #18568 tool before adding a new PR.

Workflow -> Manually Compiling with Make or Cmake for test

@arjav1528 Please also include full build logs !

@simbit18 simbit18 requested a review from lupyuen May 1, 2026 08:10
Copy link
Copy Markdown
Contributor

@linguini1 linguini1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take a look at the CMake support PRs from @simbit18 to see an example of the test logs you should include.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Arch: xtensa Issues related to the Xtensa architecture Board: risc-v Board: xtensa Size: L The size of the change in this PR is large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants